/* ============================================================
   QUIZORIA - reusable component system
   Focus is expressed with THREE cues at once (rim light, lift,
   inner glow) so it is unmistakable from across a room.
   ============================================================ */

@property --sweep { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

/* ---------- Brand lockup ---------- */
.logo { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); }
.logo__mark { width: calc(var(--u) * 7); height: calc(var(--u) * 7); filter: drop-shadow(var(--glow-gold)); }
.logo__word {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-mega);
  letter-spacing: calc(var(--u) * .28);
  line-height: .95;
  background: var(--gold-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 calc(var(--u) * 2.6) rgba(243,200,96,.30);
}
:root[dir="rtl"] .logo__word { letter-spacing: 0; }
.logo__sub {
  font-size: var(--fs-lead);
  letter-spacing: calc(var(--u) * .5);
  color: var(--c-text-dim);
  text-transform: uppercase;
}
:root[dir="rtl"] .logo__sub { letter-spacing: 0; text-transform: none; }
.logo__rule { width: 46%; height: 1px; background: var(--gold-line); margin: var(--sp-2) auto; }

/* ---------- Section headings ---------- */
.eyebrow {
  font-size: var(--fs-small);
  letter-spacing: calc(var(--u) * .32);
  text-transform: uppercase;
  color: var(--c-gold);
  opacity: .9;
}
:root[dir="rtl"] .eyebrow { letter-spacing: 0; text-transform: none; }
.screen__title { font-size: var(--fs-title); font-weight: 700; line-height: 1.1; }
.screen__hint  { font-size: var(--fs-body); color: var(--c-text-dim); }
.screen__head { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-4); }

/* ---------- Panel ---------- */
.panel {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 1.4rem 3.4rem rgba(0,0,0,.5);
}
.panel--gold { border-color: rgba(243,200,96,.4); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), var(--glow-gold); }

/* ---------- Generic focusable button ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-size: var(--fs-lead);
  font-weight: 600;
  color: var(--c-text);
  transition: transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-base), border-color var(--t-base),
              background var(--t-base), color var(--t-base);
}
.btn.is-focused {
  transform: translateY(calc(var(--u) * -.18)) scale(1.045);
  border-color: var(--c-gold);
  background: var(--gold-fill);
  color: #17120a;
  box-shadow: var(--glow-gold), 0 1.2rem 2.6rem rgba(0,0,0,.55);
}
.btn--ghost { background: rgba(255,255,255,.04); }
.btn--primary { border-color: rgba(243,200,96,.45); box-shadow: 0 0 1.4rem rgba(243,200,96,.18); }

/* ---------- Tile (menu / category / language cards) ---------- */
.tile {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: var(--sp-1);
  padding: var(--sp-4);
  min-height: calc(var(--u) * 7.4);
  text-align: start;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  overflow: hidden;
  transition: transform 180ms var(--ease-out), box-shadow var(--t-base),
              border-color var(--t-base), background var(--t-base);
}
/* Rim light that races around the focused tile */
.tile::after {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--sweep, 0deg), transparent 0deg, var(--c-gold) 40deg, transparent 120deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--t-base);
  pointer-events: none;
}
.tile.is-focused {
  transform: translateY(calc(var(--u) * -.3)) scale(1.035);
  border-color: rgba(243,200,96,.55);
  background: linear-gradient(160deg, rgba(64,48,150,.8), rgba(16,20,54,.92));
  box-shadow: var(--glow-violet), 0 1.6rem 3.2rem rgba(0,0,0,.6);
  z-index: 2;
}
.tile.is-focused::after { opacity: 1; animation: rimSweep 2.4s linear infinite; }
@keyframes rimSweep { to { --sweep: 360deg; } }

.tile__icon { font-size: calc(var(--u) * 2.4); line-height: 1; }
.tile__label { font-size: var(--fs-h2); font-weight: 700; }
.tile__meta { font-size: var(--fs-small); color: var(--c-text-dim); }
.tile.is-selected { border-color: var(--c-gold); }
.tile.is-selected .tile__label { color: var(--c-gold-pale); }

/* ---------- Pills / chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: calc(var(--u) * .35) var(--sp-3);
  border-radius: var(--r-pill);
  background: rgba(255,255,255,.06);
  border: 1px solid var(--hairline);
  font-size: var(--fs-small);
  color: var(--c-text-dim);
  white-space: nowrap;
}
.chip--gold { border-color: rgba(243,200,96,.45); color: var(--c-gold-pale); background: rgba(243,200,96,.10); }

/* ---------- Footer hint bar (remote legend) ---------- */
.legend {
  display: flex; align-items: center; gap: var(--sp-4);
  margin-top: var(--sp-3);
  font-size: var(--fs-small);
  color: var(--c-text-faint);
  flex-wrap: wrap;
}
.legend__item { display: inline-flex; align-items: center; gap: var(--sp-1); }
.key {
  display: inline-grid; place-items: center;
  min-width: calc(var(--u) * 2.1); height: calc(var(--u) * 2.1);
  padding: 0 calc(var(--u) * .45);
  border-radius: calc(var(--u) * .45);
  border: 1px solid var(--hairline-strong);
  background: rgba(255,255,255,.06);
  font-size: var(--fs-micro); font-weight: 700; color: var(--c-text-dim);
}

/* ---------- On-screen keyboard ---------- */
.kbd { display: flex; flex-direction: column; gap: var(--sp-2); }
.kbd__row { display: flex; gap: var(--sp-2); justify-content: center; }
.kbd__key {
  flex: 0 0 auto;
  min-width: calc(var(--u) * 3.4);
  height: calc(var(--u) * 3.4);
  display: grid; place-items: center;
  padding: 0 calc(var(--u) * .6);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  font-size: var(--fs-lead); font-weight: 600;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-base),
              background var(--t-base), color var(--t-base), border-color var(--t-base);
}
.kbd__key.is-focused {
  transform: scale(1.16);
  background: var(--gold-fill); color: #17120a;
  border-color: var(--c-gold);
  box-shadow: var(--glow-gold);
  z-index: 3;
}
.kbd__key--wide { min-width: calc(var(--u) * 7.2); }
.kbd__key--action { background: rgba(122,79,224,.22); border-color: rgba(150,120,255,.4); }
.kbd__key--go { background: rgba(47,224,138,.16); border-color: rgba(47,224,138,.45); color: #d6ffe9; }

/* ---------- Progress / meters ---------- */
.meter { height: calc(var(--u) * .45); border-radius: var(--r-pill); background: rgba(255,255,255,.08); overflow: hidden; }
.meter__fill { height: 100%; background: var(--gold-fill); box-shadow: var(--glow-gold); transition: width var(--t-slow) var(--ease-out); }

/* ---------- Overlay ---------- */
.overlay {
  position: absolute; inset: 0; z-index: var(--z-overlay);
  display: grid; place-items: center;
  background: rgba(3,4,12,.74);
  animation: screenIn 280ms var(--ease-out) both;
}
.overlay__box {
  width: min(60vw, calc(var(--u) * 46));
  padding: var(--sp-5);
  text-align: center;
  display: flex; flex-direction: column; gap: var(--sp-4);
}
.overlay__title { font-size: var(--fs-h1); font-weight: 700; }
.overlay__row { display: flex; gap: var(--sp-3); justify-content: center; }
