/* ============================================================
   OGACIAL — SCREEN INTERFACES
   Main menu, auth, profile, world select, settings
   ============================================================ */

/* ---------- Screen shell ---------- */
.screen {
  position: absolute; inset: 0;
  display: flex;
  animation: screen-in var(--t-med) both;
}
@keyframes screen-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Scrim over the 3D backdrop so text stays readable */
.screen-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(90deg,
    rgba(7, 9, 13, 0.92) 0%,
    rgba(7, 9, 13, 0.78) 38%,
    rgba(7, 9, 13, 0.25) 70%,
    rgba(7, 9, 13, 0.05) 100%);
  pointer-events: none;
}
.screen-scrim.full { background: rgba(7, 9, 13, 0.88); }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line-1);
  background: var(--ink-3);
  color: var(--text-0);
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: var(--s3) var(--s5);
  cursor: pointer;
  position: relative;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--ink-4); border-color: var(--text-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 1px solid var(--ice); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary {
  background: var(--ice);
  border-color: var(--ice);
  color: var(--ink-0);
}
.btn.primary:hover { background: #8aeede; border-color: #8aeede; }

.btn.ghost { background: transparent; border-color: transparent; color: var(--text-1); }
.btn.ghost:hover { color: var(--text-0); border-color: var(--line-0); background: var(--ink-2); }

.btn.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn.danger:hover { background: rgba(226, 93, 93, 0.12); }

.btn.block { display: block; width: 100%; text-align: center; }

/* Menu navigation buttons — oversized hit area, left-aligned, marker on hover */
.nav-btn {
  appearance: none; border: none; background: transparent;
  display: flex; align-items: center; gap: var(--s3);
  color: var(--text-1);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: var(--s2) 0;
  cursor: pointer;
  transition: color var(--t-fast), transform var(--t-fast);
  text-align: left;
}
.nav-btn::before {
  content: "";
  width: 10px; height: 10px;
  background: var(--line-1);
  transition: background var(--t-fast), transform var(--t-fast);
}
.nav-btn:hover, .nav-btn:focus-visible {
  color: var(--text-0);
  transform: translateX(4px);
  outline: none;
}
.nav-btn:hover::before, .nav-btn:focus-visible::before {
  background: var(--ice);
  transform: rotate(45deg);
}
.nav-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* ---------- Main menu ---------- */
.menu-rail {
  position: relative;
  width: min(480px, 46vw);
  height: 100%;
  display: flex; flex-direction: column;
  padding: var(--s7) var(--s8);
  gap: var(--s6);
}

.menu-brand { margin-top: auto; }
.menu-brand .wordmark {
  font-size: var(--fs-display);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 0.95;
  color: var(--text-0);
}
.menu-brand .wordmark span { color: var(--ice); }
.menu-brand .tagline {
  margin-top: var(--s3);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-1);
  max-width: 34ch;
}

.menu-nav { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: auto; }

.menu-footer {
  display: flex; align-items: center; justify-content: space-between;
  border-top: var(--hairline);
  padding-top: var(--s4);
}
.menu-version { font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); letter-spacing: 0.08em; }

.menu-session {
  display: flex; align-items: center; gap: var(--s3);
}
.session-chip {
  display: flex; align-items: center; gap: var(--s2);
  border: var(--hairline);
  background: var(--ink-2);
  padding: var(--s2) var(--s3);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t-fast);
}
.session-chip:hover { border-color: var(--ice-dim); }
.session-chip .dot { width: 8px; height: 8px; background: var(--success); }
.session-chip .dot.guest { background: var(--ember); }

/* ---------- Panel (auth / dialogs / sub-screens) ---------- */
.panel-center {
  position: relative;
  margin: auto;
  width: min(420px, calc(100vw - 48px));
}
.panel-wide { width: min(960px, calc(100vw - 48px)); }

.panel {
  background: var(--ink-1);
  border: var(--hairline);
  /* clipped corners — a precise, blocky bevel instead of radius */
  clip-path: polygon(
    var(--s2) 0, calc(100% - var(--s2)) 0, 100% var(--s2),
    100% calc(100% - var(--s2)), calc(100% - var(--s2)) 100%,
    var(--s2) 100%, 0 calc(100% - var(--s2)), 0 var(--s2));
  padding: var(--s6);
}

.panel-head { margin-bottom: var(--s5); }
.panel-head h2 { font-size: var(--fs-xl); font-weight: 700; }
.panel-head .label { display: block; margin-bottom: var(--s2); color: var(--ice-dim); }
.panel-head p { color: var(--text-1); font-size: var(--fs-sm); margin-top: var(--s2); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s4); }
.field label { font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text-2); }

.field input {
  background: var(--ink-0);
  border: var(--hairline);
  color: var(--text-0);
  padding: var(--s3);
  font-size: var(--fs-md);
  font-weight: 500;
  transition: border-color var(--t-fast);
}
.field input::placeholder { color: var(--text-2); }
.field input:focus { outline: none; border-color: var(--ice); }
.field .hint { font-size: var(--fs-xs); color: var(--text-2); font-weight: 500; }
.field.invalid input { border-color: var(--danger); }
.field .err { font-size: var(--fs-xs); color: var(--danger); font-weight: 500; }

.form-error {
  border: 1px solid var(--danger);
  background: rgba(226, 93, 93, 0.08);
  color: var(--danger);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: var(--s3);
  margin-bottom: var(--s4);
}

.form-foot {
  margin-top: var(--s5);
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-sm);
  color: var(--text-1);
}
.link {
  background: none; border: none; padding: 0;
  color: var(--ice); font-weight: 600; font-size: inherit;
  cursor: pointer;
}
.link:hover { text-decoration: underline; }

.divider {
  display: flex; align-items: center; gap: var(--s3);
  margin: var(--s5) 0;
  color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: var(--ls-label);
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-0); }

/* ---------- Back bar (sub-screens) ---------- */
.back-bar {
  position: absolute; top: var(--s5); left: var(--s5);
  display: flex; align-items: center; gap: var(--s3);
  z-index: 5;
}

/* ---------- Profile screen ---------- */
.profile-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 0;
  border: var(--hairline);
  background: var(--ink-1);
}

.profile-preview {
  position: relative;
  border-right: var(--hairline);
  background:
    linear-gradient(180deg, rgba(111, 227, 210, 0.04), transparent 40%),
    var(--ink-0);
  min-height: 480px;
  display: flex; flex-direction: column;
}
.profile-preview canvas { width: 100%; height: 100%; display: block; }
.preview-frame { position: absolute; inset: var(--s4); border: 1px solid var(--line-0); pointer-events: none; }
.preview-caption {
  position: absolute; bottom: var(--s5); left: 0; right: 0;
  text-align: center;
}

.profile-body { padding: var(--s6); display: flex; flex-direction: column; gap: var(--s5); }

.profile-identity { display: flex; align-items: baseline; gap: var(--s3); }
.profile-identity h2 { font-size: var(--fs-2xl); font-weight: 800; }
.profile-identity .tag { color: var(--text-2); font-weight: 600; font-size: var(--fs-md); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: var(--hairline);
}
.stat-cell {
  padding: var(--s4);
  border-right: var(--hairline);
  display: flex; flex-direction: column; gap: var(--s1);
}
.stat-cell:last-child { border-right: none; }
.stat-cell .value { font-size: var(--fs-xl); font-weight: 700; color: var(--text-0); font-variant-numeric: tabular-nums; }

.swatch-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.swatch {
  width: 34px; height: 34px;
  border: 1px solid var(--line-1);
  cursor: pointer;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.swatch:hover { transform: translateY(-2px); }
.swatch.active { border-color: var(--text-0); outline: 1px solid var(--text-0); outline-offset: 1px; }

.profile-actions { margin-top: auto; display: flex; gap: var(--s3); }

/* ---------- World select ---------- */
.world-list { display: flex; flex-direction: column; gap: var(--s3); margin: var(--s5) 0; }
.world-card {
  display: flex; align-items: center; gap: var(--s4);
  border: var(--hairline);
  background: var(--ink-2);
  padding: var(--s4);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
  text-align: left;
}
.world-card:hover { border-color: var(--ice-dim); background: var(--ink-3); }
.world-card .thumb {
  width: 56px; height: 56px;
  background: var(--ice-deep);
  border: 1px solid var(--line-1);
  display: grid; place-items: center;
  color: var(--ice); font-weight: 800; font-size: var(--fs-lg);
}
.world-card .meta { flex: 1; }
.world-card .meta h3 { font-size: var(--fs-md); font-weight: 700; }
.world-card .meta p { font-size: var(--fs-xs); color: var(--text-2); font-weight: 500; margin-top: 2px; }
.world-card .enter { color: var(--ice); font-weight: 700; font-size: var(--fs-sm); letter-spacing: 0.08em; }

/* ---------- Settings ---------- */
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s4) 0;
  border-bottom: var(--hairline);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .meta h3 { font-size: var(--fs-md); font-weight: 600; }
.settings-row .meta p { font-size: var(--fs-xs); color: var(--text-2); margin-top: 2px; }

.seg {
  display: flex; border: var(--hairline);
}
.seg button {
  background: transparent; border: none;
  color: var(--text-2); font-weight: 600; font-size: var(--fs-xs);
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: var(--s2) var(--s3);
  cursor: pointer;
  border-right: var(--hairline);
}
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--ice); color: var(--ink-0); }

@media (max-width: 880px) {
  .menu-rail { width: 100%; padding: var(--s6); }
  .profile-layout { grid-template-columns: 1fr; }
  .profile-preview { border-right: none; border-bottom: var(--hairline); min-height: 320px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-cell:nth-child(2n) { border-right: none; }
  .stat-cell:nth-child(-n+2) { border-bottom: var(--hairline); }
}
