:root {
  --ink: #0d0d0d;
  --ink-soft: #161616;
  --ink-card: #1c1c1c;
  --ink-line: #2a2a2a;
  --gold: #d4af37;
  --gold-bright: #f5c518;
  --gold-dim: #8a7324;
  --mist: #a3a3a3;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[x-cloak] { display: none !important; }

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(212, 175, 55, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(212, 175, 55, 0.05), transparent 50%),
    linear-gradient(180deg, #121212 0%, #0d0d0d 40%, #0a0a0a 100%);
  pointer-events: none;
}

.auth-shell {
  min-height: 100dvh;
  padding: 2rem 1.25rem 2.5rem;
  max-width: 28rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
}

.auth-brand {
  text-align: center;
}

.auth-brand.compact {
  text-align: left;
}

.brand-mark {
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto 1rem;
  border-radius: 1.25rem;
  display: grid;
  place-items: center;
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: 2rem;
  color: #0d0d0d;
  background: linear-gradient(145deg, #f5c518, #d4af37 55%, #8a7324);
  box-shadow: 0 0 0 2px rgba(245, 197, 24, 0.25), 0 12px 32px rgba(0, 0, 0, 0.5);
  transform: rotate(-3deg);
}

.brand-title {
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: 2.25rem;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 2px 0 rgba(212, 175, 55, 0.35);
}

.brand-title.sm {
  font-size: 1.5rem;
}

.brand-sub {
  margin-top: 0.35rem;
  color: var(--mist);
  font-size: 0.9rem;
}

.auth-card {
  background: rgba(28, 28, 28, 0.92);
  border: 1px solid var(--ink-line);
  border-radius: 1.25rem;
  padding: 1.5rem 1.25rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.auth-step-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.auth-step-desc {
  margin-top: 0.25rem;
  margin-bottom: 1.25rem;
  color: var(--mist);
  font-size: 0.875rem;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  color: var(--mist);
  margin-bottom: 0.5rem;
}

.input {
  width: 100%;
  background: #121212;
  border: 1px solid var(--ink-line);
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  color: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.phone-row {
  display: flex;
  gap: 0.5rem;
}

.country-select {
  position: relative;
  flex-shrink: 0;
}

.country-btn {
  height: 100%;
  min-width: 4.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.85rem 0.75rem;
  border-radius: 0.85rem;
  background: #121212;
  border: 1px solid var(--ink-line);
  color: var(--gold-bright);
  font-weight: 600;
}

.country-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 20;
  min-width: 10rem;
  background: #1a1a1a;
  border: 1px solid var(--ink-line);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

.country-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.9rem;
  color: #fff;
  font-size: 0.875rem;
}

.country-item.active {
  color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.08);
}

.country-item.disabled {
  color: #555;
}

.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.25rem;
  border-radius: 999px;
  font-weight: 700;
  color: #0d0d0d;
  background: linear-gradient(180deg, #f5c518 0%, #d4af37 70%, #b8962a 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 6px 0 #6e5a16, 0 10px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.15s;
}

.btn-gold:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #6e5a16, 0 6px 12px rgba(0, 0, 0, 0.35);
}

.btn-gold:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  font-weight: 600;
  color: var(--gold-bright);
  border: 1px solid var(--gold-dim);
  background: transparent;
}

.gender-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.gender-opt {
  text-align: center;
  padding: 0.9rem;
  border-radius: 0.85rem;
  border: 1px solid var(--ink-line);
  background: #121212;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.gender-opt.active {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-bright);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.25);
}

.error-banner {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #fca5a5;
  font-size: 0.85rem;
}

.error-banner.empty:empty {
  display: none;
}

.error-banner.success {
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.35);
  color: var(--gold-bright);
}

.hint-text {
  color: var(--mist);
  font-size: 0.8rem;
}

.back-link {
  color: var(--mist);
  font-size: 0.875rem;
}

.back-link:hover {
  color: var(--gold-bright);
}

/* App shell */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 28rem;
  margin: 0 auto;
  position: relative;
}

.app-main {
  flex: 1;
  padding: 1.25rem 1.25rem calc(5.5rem + var(--safe-bottom));
}

.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(28rem, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  padding: 0.55rem 0.5rem calc(0.55rem + var(--safe-bottom));
  background: rgba(13, 13, 13, 0.92);
  border-top: 1px solid var(--ink-line);
  backdrop-filter: blur(12px);
  z-index: 40;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem;
  color: #6b6b6b;
  font-size: 0.7rem;
  border-radius: 0.75rem;
}

.tab-item.active {
  color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.08);
}

.tab-icon {
  font-size: 1.1rem;
  line-height: 1.2;
}

.location-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 1rem 0;
  padding: 0.75rem 0.85rem;
  border-radius: 0.9rem;
  background: linear-gradient(90deg, #f5c518, #d4af37);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.banner-btn {
  flex-shrink: 0;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: #0d0d0d;
  color: var(--gold-bright);
  font-size: 0.8rem;
  font-weight: 700;
}

.banner-close {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.15);
  color: #0d0d0d;
  font-size: 1.1rem;
  line-height: 1;
}

.placeholder-panel {
  margin-top: 3rem;
  text-align: center;
  padding: 2rem 1rem;
  border: 1px dashed var(--ink-line);
  border-radius: 1.25rem;
  background: rgba(28, 28, 28, 0.5);
}

.placeholder-icon {
  font-size: 2.5rem;
  filter: grayscale(0.2);
}

.placeholder-title {
  margin-top: 0.75rem;
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: 1.5rem;
  color: var(--gold-bright);
}

.placeholder-desc {
  margin-top: 0.5rem;
  color: var(--mist);
  font-size: 0.9rem;
}

.me-panel .me-hero {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.avatar-ring {
  width: 6.5rem;
  height: 6.5rem;
  margin: 0 auto;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f5c518, #8a7324);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
  display: block;
}

.avatar-img,
.avatar-img-lg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: #1a1a1a;
  display: block;
}

.avatar-preview {
  width: 7.5rem;
  height: 7.5rem;
  margin: 0.75rem auto 0;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f5c518, #8a7324);
}

.avatar-preview.is-empty {
  display: grid;
  place-items: center;
  background: #1a1a1a;
  border: 1px dashed var(--gold-dim);
  padding: 0;
}

.avatar-empty-tip {
  color: #666;
  font-size: 0.75rem;
}

.avatar-workbench {
  margin-top: 0.75rem;
}

.avatar-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.avatar-col {
  text-align: center;
}

.avatar-col-label {
  font-size: 0.75rem;
  color: var(--mist);
  margin-bottom: 0.35rem;
}

.avatar-col .avatar-preview {
  margin-top: 0;
}

.avatar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.avatar-actions .btn-gold,
.avatar-actions .btn-outline {
  min-width: 0;
}

.avatar-reset {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  color: #777;
  font-size: 0.8rem;
  text-align: center;
  padding: 0.5rem;
}

.avatar-busy {
  margin-top: 0.75rem;
  text-align: center;
  color: var(--gold-bright);
  font-size: 0.85rem;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: block;
}

.upload-box.has-file {
  border-style: solid;
  color: var(--gold);
  min-height: 3.25rem;
  font-size: 0.85rem;
}

.me-panel .me-hero .avatar-ring {
  transition: transform 0.2s ease;
}

.me-panel .me-hero .avatar-ring:active {
  transform: scale(0.96);
}

.me-name {
  margin-top: 1rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.me-tag {
  margin-top: 0.25rem;
  color: var(--gold);
  font-size: 0.85rem;
}

.info-list {
  margin-top: 1.25rem;
  border: 1px solid var(--ink-line);
  border-radius: 1rem;
  overflow: hidden;
  background: rgba(28, 28, 28, 0.8);
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--ink-line);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--mist);
  font-size: 0.9rem;
}

.info-value {
  font-weight: 600;
}

.info-row-edit {
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.info-value-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.link-edit {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 500;
}

.nick-edit-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.nick-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
}

.btn-mini-gold {
  flex-shrink: 0;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #0d0d0d;
  background: linear-gradient(180deg, #f5c518, #d4af37);
}

.btn-mini-ghost {
  flex-shrink: 0;
  padding: 0.45rem 0.55rem;
  color: var(--mist);
  font-size: 0.8rem;
}

.settings-panel .section-title {
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: 1.6rem;
  color: var(--gold-bright);
  margin-bottom: 1.25rem;
}

.settings-block {
  padding: 1.15rem;
  border-radius: 1rem;
  border: 1px solid var(--ink-line);
  background: rgba(28, 28, 28, 0.85);
}

.block-title {
  font-weight: 700;
}

.block-desc {
  margin-top: 0.25rem;
  color: var(--mist);
  font-size: 0.8rem;
}

.upload-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 8rem;
  border: 1px dashed var(--gold-dim);
  border-radius: 1rem;
  background: #121212;
  color: var(--mist);
  cursor: pointer;
  overflow: hidden;
}

.upload-preview {
  width: 100%;
  height: 8rem;
  object-fit: cover;
}

.logout-link {
  display: block;
  text-align: center;
  margin-top: 2rem;
  color: #777;
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
