/* combina ≈ — sistema visual
 * Tinta #0B0E12 · Guix #ECE8DF · Or de Gauss #E6B85C (accent) · Or de text #EDB24A
 * STIX Two Text (matemàtiques) · IBM Plex Mono (xifres) · IBM Plex Sans (interfície) */

:root {
  --ink: #0B0E12;
  --surface: rgba(18, 22, 28, .92);
  --surface-2: #151A21;
  --line: #262D37;
  --line-2: #2E3641;
  --chalk: #ECE8DF;
  --muted: #9AA3B0;
  --faint: #7D8693;
  --gold: #E6B85C;
  --gold-t: #EDB24A;
  --gold-rgb: 230, 184, 92;
  --err: #E39B8A;
  --serif: 'STIX Two Text', 'Cambria Math', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 76px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--chalk);
  font-family: var(--sans);
  background-color: var(--ink);
  background-image:
    linear-gradient(rgba(236, 232, 223, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 232, 223, .035) 1px, transparent 1px),
    linear-gradient(rgba(236, 232, 223, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 232, 223, .07) 1px, transparent 1px);
  background-size: 12px 12px, 12px 12px, 60px 60px, 60px 60px;
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
button:not(:disabled) { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
p { margin: 0; }
h1, h2 { margin: 0; font-weight: 400; }
sup { font-size: .6em; line-height: 0; }

/* ---------- Fons: operacions que cauen ---------- */
.rain { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.rain span {
  position: absolute; top: -60px; white-space: nowrap;
  font-family: var(--serif); font-style: italic; color: rgba(236, 232, 223, .09);
  animation: fall linear infinite;
}
@keyframes fall { from { transform: translateY(0) rotate(-3deg); } to { transform: translateY(calc(100vh + 120px)) rotate(3deg); } }

/* ---------- Estructura ---------- */
.shell { position: relative; z-index: 1; }
.view {
  max-width: 540px; margin: 0 auto;
  padding: 0 20px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
}
.no-nav .view { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.screen { display: flex; flex-direction: column; gap: 18px; padding-top: max(18px, env(safe-area-inset-top)); animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Navegació inferior (mòbil) */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: rgba(11, 14, 18, .96); border-top: 1px solid #1E242D;
  backdrop-filter: blur(8px);
}
.no-nav .nav { display: none; }
.nav-brand { display: none; }
.nav-item {
  border: 0; background: none; color: var(--faint);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px;
}
.nav-item.on { color: var(--chalk); }
.nav-item:hover { color: var(--chalk); }

/* ---------- Tipografia i peces comunes ---------- */
.wordmark { display: inline-flex; align-items: baseline; gap: 5px; font-family: var(--serif); font-size: 26px; line-height: 1; }
.wordmark em { font-style: italic; letter-spacing: -.5px; }
.wordmark b { font-weight: 400; color: var(--gold); }
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.kicker.gold, .gold { color: var(--gold-t); }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.5; }
.chalk { color: var(--chalk); font-weight: 600; }
.pad { padding: 28px 0; }
.title { font-family: var(--serif); font-size: 32px; line-height: 1.1; letter-spacing: -.3px; margin-top: 6px; }
.title.sm { font-size: 28px; margin-top: 4px; }
.title em, .muted-em { color: var(--muted); }
.lead { font-size: 15px; line-height: 1.55; color: var(--muted); }
.card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }

.topbar { display: flex; align-items: center; justify-content: space-between; padding-top: 4px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.chip {
  height: 32px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 13px; color: var(--chalk);
}
.chip svg { color: var(--gold); }
button.chip { background: none; }
button.chip:hover { border-color: #4A525E; }
.chip-sound { padding-left: 9px; padding-right: 9px; cursor: pointer; }
.chip-sound.off svg { color: var(--muted); }
.chip-sep { width: 1px; height: 14px; background: var(--line-2); margin: 0 2px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid #B9C3D0; background: var(--surface-2);
  font-family: var(--mono); font-size: 12px; font-weight: 600; overflow: hidden; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.btn {
  min-height: 54px; border-radius: 14px; padding: 0 20px; border: 1px solid transparent;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 16px; font-weight: 600; text-decoration: none; transition: transform .12s ease, background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--chalk); color: var(--ink); }
.btn-primary:hover { background: #fff; }
.btn-ghost { background: rgba(11, 14, 18, .6); border-color: var(--line-2); color: var(--chalk); font-weight: 500; }
.btn-ghost:hover { border-color: #4A525E; }
.btn-split { justify-content: space-between; padding: 0 22px; width: 100%; }
.btn-meta { font-family: var(--mono); font-size: 13px; font-weight: 500; color: #3A414C; }
.cta-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cta-stack { display: flex; flex-direction: column; gap: 12px; }

.countdown { font-family: var(--mono); font-weight: 600; letter-spacing: 1px; color: var(--gold); font-variant-numeric: tabular-nums; }
.countdown.big { font-size: 20px; text-shadow: 0 0 12px rgba(var(--gold-rgb), .45); }
.countdown-row { display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 4px; }
.countdown-line { text-align: center; font-family: var(--mono); font-size: 12px; color: var(--faint); margin-top: -6px; }

/* ---------- Medalles ---------- */
.medal { position: relative; display: inline-block; flex: none; }
.medal-halo { position: absolute; left: -18%; top: -18%; width: 136%; height: 136%; overflow: visible; pointer-events: none; }
.medal-art { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* ---------- Entrada ---------- */
.entrada { min-height: calc(100vh - 28px); padding-top: max(44px, env(safe-area-inset-top)); }
.brand-hero { text-align: center; }
.brand-hero .wordmark { font-size: 32px; }
.brand-hero .kicker { margin-top: 8px; letter-spacing: 2.5px; }
.hero-demo { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 22px; }
.mini-tiles { display: flex; gap: 8px; }
.mini-tile {
  width: 46px; height: 54px; border: 1px solid var(--line-2); border-radius: 10px; background: #12161C;
  display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 20px; font-weight: 500;
  animation: rise .8s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.ops-line { display: flex; align-items: center; gap: 14px; font-family: var(--serif); font-size: 22px; color: var(--faint); }
.ops-line span { width: 44px; height: 1px; background: var(--line-2); }
.hero-target { display: flex; align-items: baseline; gap: 12px; font-family: var(--serif); font-size: 92px; font-weight: 500; line-height: 1; letter-spacing: -2px; margin-top: -8px; }
.hero-target b { font-size: 44px; font-weight: 400; color: var(--gold); }
.hero-title { font-family: var(--serif); font-size: 34px; line-height: 1.12; letter-spacing: -.4px; margin-top: 10px; }
.hero-title em { color: var(--gold-t); }
.entrada .cta-stack { margin-top: auto; padding-top: 18px; }

/* ---------- Avui ---------- */
.avui-grid { display: flex; flex-direction: column; gap: 18px; }
.avui-grid > div { display: flex; flex-direction: column; gap: 16px; }
.lvl-list { list-style: none; margin: 0; padding: 4px 18px; }
.lvl-row { display: grid; grid-template-columns: 1fr auto 72px; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #222832; font-size: 13px; color: var(--muted); }
.lvl-row:last-child { border-bottom: 0; }
.lvl-row.next > span:first-child { color: var(--chalk); font-weight: 600; }
.dots { display: flex; gap: 4px; }
.dots i { width: 8px; height: 8px; border-radius: 2px; background: var(--chalk); }
.lvl-right { text-align: right; font-family: var(--mono); font-size: 13px; }
.lvl-right b { color: var(--chalk); }
.lvl-right b.gold { color: var(--gold-t); }
.yesterday { display: flex; align-items: center; gap: 16px; padding: 14px 16px; }
.y-medal { width: 56px; display: flex; justify-content: center; }
.y-text { flex: 1; min-width: 0; }
.y-rank { font-family: var(--serif); font-size: 18px; margin: 2px 0 10px; }
.week { display: flex; gap: 6px; }
.wk { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wk i { display: block; width: 24px; height: 6px; border-radius: 3px; }
.wk i.empty { background: var(--line); }
.wk i.today { border: 1px dashed #4A525E; }
.wk small { font-family: var(--mono); font-size: 9px; color: var(--faint); }

/* ---------- Joc ---------- */
.game-head { display: flex; align-items: center; gap: 14px; }
.icon-btn {
  width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(11, 14, 18, .6);
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.icon-btn:hover { color: var(--chalk); }
.game-progress { flex: 1; min-width: 0; }
.game-progress .kicker { margin-bottom: 6px; }
.segs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.segs span { height: 4px; border-radius: 2px; background: var(--line); }
.segs .done { background: var(--chalk); }
.segs .exact { background: var(--gold); }
.segs .cur { background: var(--gold); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.timer { position: relative; width: 54px; height: 54px; flex: none; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 3; }
.ring { fill: none; stroke: var(--chalk); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .2s linear, stroke .3s; }
.timer span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.timer.low .ring { stroke: var(--gold); }
.timer.low span { color: var(--gold); animation: pulse 1s ease-in-out infinite; }

.game { display: flex; flex-direction: column; gap: 18px; }
.game-main { display: flex; flex-direction: column; gap: 16px; }
.target { text-align: center; }
.target .kicker { letter-spacing: 3px; }
.target-num { font-family: var(--serif); font-size: 92px; font-weight: 500; line-height: 1; letter-spacing: -2px; margin-top: 2px; }
.expr-card { border: 1px solid var(--line-2); border-radius: 18px; background: rgba(18, 22, 28, .94); padding: 16px 18px 12px; }
.expr { font-family: var(--serif); font-size: 30px; line-height: 1.25; min-height: 40px; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.expr::-webkit-scrollbar { display: none; }
.expr .tk-o { margin: 0 .22em; }
.expr .tk-hole { color: var(--gold); }
.placeholder { font-family: var(--sans); font-size: 15px; color: var(--faint); }
.caret { display: inline-block; width: 2px; height: 28px; background: var(--gold); margin-left: 4px; vertical-align: -5px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.expr-live { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
#live-val { font-family: var(--mono); font-size: 20px; }
.pill { min-height: 28px; padding: 4px 10px; border-radius: 999px; background: rgba(var(--gold-rgb), .12); color: var(--gold-t); font-family: var(--mono); font-size: 12px; display: inline-flex; align-items: center; text-align: right; }
.pill.exact { background: var(--gold); color: var(--ink); font-weight: 600; }
.pill.err { background: rgba(227, 155, 138, .12); color: var(--err); }
.pill.hidden { display: none; }
.nudge { animation: nudge .35s ease; }
@keyframes nudge { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.tiles { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 8px; }
.tile {
  height: 60px; border-radius: 12px; border: 1px solid #3A424E; background: #181D25;
  font-family: var(--mono); font-size: 22px; font-weight: 500; transition: transform .1s ease, opacity .2s;
}
.tile:not(:disabled):hover { border-color: var(--gold); }
.tile:not(:disabled):active { transform: scale(.94); }
.tile:disabled:not(.used) { opacity: .5; }
.tile.used { background: transparent; border: 1px dashed var(--line); color: #4A525E; text-decoration: line-through; }
.hint { text-align: center; font-size: 12px; color: var(--faint); }

.keypad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.key {
  height: 56px; border-radius: 12px; border: 1px solid #2A313B; background: var(--surface-2);
  font-family: var(--serif); font-size: 24px; transition: transform .1s ease, opacity .2s;
}
.key:not(:disabled):hover { border-color: #4A525E; }
.key:not(:disabled):active { transform: scale(.95); }
.key:disabled { opacity: .32; }
.key.soft { font-family: var(--sans); font-size: 17px; color: var(--muted); }
.key.small { font-size: 14px; }
.key.submit { grid-column: span 2; background: var(--chalk); color: var(--ink); border: 0; font-family: var(--sans); font-size: 16px; font-weight: 600; }
.key.submit b { font-family: var(--serif); font-size: 22px; font-weight: 400; margin-left: 6px; }
.kbd-hint { display: none; grid-column: 1 / -1; font-size: 12px; color: var(--faint); text-align: center; margin-top: 4px; }

.intro { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 36px 0 8px; text-align: center; }
.intro-big { font-family: var(--serif); font-size: 44px; line-height: 1.1; }
.intro-big em { color: var(--gold-t); }
.intro-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.intro-tiles span { width: 44px; height: 52px; border-radius: 10px; border: 1px dashed var(--line-2); display: flex; align-items: center; justify-content: center; font-family: var(--mono); color: var(--faint); }
.intro .btn { width: 100%; max-width: 360px; }

/* ---------- Correcció ---------- */
.corr-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.corr-head .right { text-align: right; }
.corr-target { font-family: var(--serif); font-size: 34px; font-weight: 500; line-height: 1; margin-top: 2px; }
.steps { list-style: none; margin: 0; padding: 4px 16px; }
.steps li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid #1E242D; }
.steps li:last-child { border-bottom: 0; }
/* El subratllat daurat sobresortia de la caixa i feia aparèixer una barra de desplaçament:
   ara té espai a dins i, si una expressió és molt llarga, es pot lliscar sense barra visible */
.step-expr { font-family: var(--serif); font-size: 23px; white-space: nowrap; overflow-x: auto; overflow-y: hidden; max-width: 100%; padding: 4px 4px 8px; scrollbar-width: none; }
.step-expr::-webkit-scrollbar { display: none; }
.step-expr.final { font-size: 30px; font-weight: 500; }
.chip-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .4px; color: var(--muted); border: 1px solid #2A313B; border-radius: 999px; padding: 3px 8px; white-space: nowrap; }
.step { opacity: 0; animation: stepIn .55s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: var(--d, 0s); }
@keyframes stepIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.ink { position: relative; color: var(--gold-t); }
.ink::after {
  content: ''; position: absolute; left: -2px; right: -2px; bottom: -3px; height: 2px; border-radius: 2px; background: var(--gold);
  transform-origin: left; transform: scaleX(0); animation: draw .45s ease forwards; animation-delay: calc(var(--d, 0s) + .3s);
}
@keyframes draw { to { transform: scaleX(1); } }
.empty-corr { padding: 18px; display: flex; flex-direction: column; gap: 8px; }

.numline { padding: 0 6px; }
.nl { position: relative; height: 66px; }
.nl-axis { position: absolute; left: 0; right: 0; top: 30px; height: 1px; background: #3A424E; }
.nl-gap { position: absolute; top: 28px; height: 5px; border-radius: 3px; background: var(--gold); transform-origin: left; transform: scaleX(0); animation: draw .6s ease forwards; animation-delay: calc(var(--d, 0s) + .3s); }
.nl-mark { position: absolute; top: 18px; width: 2px; height: 25px; margin-left: -1px; background: var(--chalk); }
.nl-mark.you { top: 22px; height: 17px; background: var(--gold); }
.nl-mark span { position: absolute; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.nl-mark.goal span { top: -18px; font-weight: 600; }
.nl-mark.you span { top: 22px; color: var(--gold-t); }
.nl-end { position: absolute; top: 46px; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.nl-end.l { left: 0; } .nl-end.r { right: 0; }
.nl-eq { text-align: center; font-family: var(--serif); font-size: 19px; margin-top: 4px; }

.points { display: flex; align-items: center; justify-content: center; gap: 14px; }
.points .muted { font-size: 13px; line-height: 1.4; }
.pop { font-family: var(--serif); font-size: 72px; font-weight: 500; line-height: 1; letter-spacing: -1px; }
.points.step .pop { animation: pop .6s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: var(--d, 0s); }
.pop.exact { color: var(--gold); text-shadow: 0 0 18px rgba(var(--gold-rgb), .6); }
#pts-pop { font-variant-numeric: tabular-nums; transition: color .2s; }
#pts-pop.burst { animation: burst .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes burst { 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* ---------- Resultat: total en 3D i recta dels savis ---------- */
/* Total «flotant»: pla, sense relleu; la profunditat la dona una ombra llunyana i separada,
   l'entrada des del fons cap a l'espectador i el «/ 1000» que es queda al pla de la pantalla */
.score3d { position: relative; display: flex; align-items: baseline; justify-content: center; gap: 12px; padding: 26px 0 46px; perspective: 900px; }
.s3d-num {
  position: relative; z-index: 2;
  font-family: var(--serif); font-size: 108px; font-weight: 600; line-height: 1; letter-spacing: -3px;
  color: var(--c); font-variant-numeric: tabular-nums; transition: color .25s;
  text-shadow: 0 0 28px rgba(var(--rgb), .28);
  filter: drop-shadow(0 26px 18px rgba(0, 0, 0, .55)) drop-shadow(0 50px 40px rgba(0, 0, 0, .45));
  animation: emerge 1.1s cubic-bezier(.16, 1.2, .3, 1) both, hover 5s ease-in-out 1.1s infinite;
}
@keyframes emerge {
  from { opacity: 0; transform: translateZ(-420px) scale(.7); filter: blur(6px) drop-shadow(0 4px 4px rgba(0, 0, 0, .3)); }
  to { opacity: 1; transform: translateZ(60px) scale(1); }
}
@keyframes hover {
  0%, 100% { transform: translateZ(60px) translateY(0); }
  50% { transform: translateZ(80px) translateY(-10px); }
}
.s3d-max { position: relative; z-index: 1; font-family: var(--serif); font-size: 22px; color: var(--muted); opacity: .8; }
.s3d-floor {
  position: absolute; left: 50%; bottom: 10px; width: 240px; height: 22px; margin-left: -120px; border-radius: 50%; z-index: 0;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0) 70%); filter: blur(6px);
  animation: floorShadow 5s ease-in-out 1.1s infinite;
}
.s3d-floor::after { content: ''; position: absolute; inset: 4px 30px; border-radius: 50%; background: radial-gradient(ellipse, rgba(var(--rgb), .22), transparent 70%); }
@keyframes floorShadow { 0%, 100% { transform: scale(1); opacity: .95; } 50% { transform: scale(.82); opacity: .6; } }
.score3d.done .s3d-num { text-shadow: 0 0 36px rgba(var(--rgb), .45); }

/* Barra de càrrega de joc: tota la barra pren el color del rang assolit */
.rank-line { position: relative; padding: 58px 8px 4px; width: 100%; align-self: stretch; }
.rl-medals { position: absolute; left: 8px; right: 8px; top: 0; height: 48px; }
.rl-medal { position: absolute; top: 0; transform: translateX(-50%) scale(.82); opacity: .25; filter: grayscale(1); transition: opacity .45s, filter .45s, transform .45s; }
.rl-medal.lit { opacity: 1; filter: none; transform: translateX(-50%) scale(.95); }
.rl-medal.cur { transform: translateX(-50%) scale(1.14); }
.rl-track {
  position: relative; height: 22px; padding: 3px; border-radius: 999px;
  background: #0E1217; border: 1px solid var(--line-2);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .02);
}
.rl-zones { position: absolute; inset: 3px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); pointer-events: none; z-index: 2; }
.rl-zones i { display: block; border-right: 1px solid rgba(11, 14, 18, .55); }
.rl-zones i:last-child { border-right: 0; }
.rl-fill {
  --fc: #EDE8DC; --frgb: 237, 232, 220;
  position: absolute; left: 3px; top: 3px; bottom: 3px; width: calc((100% - 6px) * var(--p, 0)); min-width: 0;
  border-radius: 999px; overflow: hidden;
  background-color: var(--fc);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, .08) 45%, rgba(0, 0, 0, .12)),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .22) 0 7px, rgba(255, 255, 255, 0) 7px 14px);
  background-size: 100% 100%, 19.8px 19.8px;
  box-shadow: 0 0 14px rgba(var(--frgb), .65), 0 0 2px rgba(var(--frgb), .9);
  transition: background-color .35s, box-shadow .35s;
  animation: stripes .7s linear infinite;
}
@keyframes stripes { to { background-position: 0 0, 19.8px 0; } }
.rl-fill::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  opacity: 0;
}
.rl-fill.complete { animation: none; }
.rl-fill.complete::after { animation: sweep .9s ease-out .1s; }
@keyframes sweep { 0% { left: -40%; opacity: 1; } 100% { left: 110%; opacity: 0; } }
.rl-pct { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); z-index: 3; font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--muted); transition: color .3s; }
.rl-pct.over { color: var(--ink); }
.rl-ticks { position: relative; height: 16px; margin-top: 10px; }
.rl-ticks span { position: absolute; transform: translateX(-50%); font-family: var(--mono); font-size: 10px; color: var(--faint); }
.rl-ticks span:first-child { transform: none; }
.rl-ticks span:last-child { transform: translateX(-100%); }
.rank-reveal { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 14px; opacity: 0; transform: translateY(12px) scale(.96); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .8, .2, 1); }
.rank-reveal.show { opacity: 1; transform: none; }
.rr-medal { padding: 16px; }
.rank-reveal .res-name { text-align: left; margin-top: 6px; }
.rank-reveal { flex-wrap: wrap; }
.rr-words { flex-basis: 100%; margin: 4px 0 0; padding: 16px 18px; border-left: 2px solid var(--line-2); text-align: left; }
.rr-words blockquote { margin: 0; font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.35; color: var(--chalk); }
.rr-words figcaption { margin-top: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: 1px; color: var(--muted); }
.rr-words figcaption span { opacity: .8; }
.rr-cheer { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.rr-gap { display: block; margin-top: 4px; color: var(--chalk); }
.bar-row { opacity: .4; transition: opacity .3s; }
.bar-row.add { opacity: 1; }
.bar i { transition: none; }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
.bands { text-align: center; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.solution summary { cursor: pointer; text-align: center; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.solution p { margin-top: 10px; text-align: center; font-family: var(--serif); font-size: 21px; color: var(--chalk); }

/* ---------- Resultat ---------- */
.res-grid { display: flex; flex-direction: column; gap: 16px; }
.res-grid > div { display: flex; flex-direction: column; gap: 14px; }
.res-hero { align-items: center; }
.res-medal { display: flex; justify-content: center; padding: 34px 0 30px; animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-5px); } }
.res-name { font-family: var(--serif); font-size: 42px; font-weight: 500; line-height: 1; text-align: center; margin-top: 4px; }
.res-total { font-family: var(--serif); font-size: 22px; text-align: center; margin-top: 8px; color: var(--muted); }
.res-total b { font-size: 32px; font-weight: 600; color: var(--chalk); }
.bars { padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 26px 1fr 74px; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; }
.bar-row b { text-align: right; font-weight: 500; }
.bar-row b small { color: var(--faint); font-weight: 400; }
.bar { height: 6px; border-radius: 3px; background: #222832; display: flex; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.scale span { height: 4px; border-radius: 2px; }
.cta-row .btn { padding: 0 12px; font-size: 15px; }
.cta-row .btn svg { flex: none; }

/* ---------- Rànquing ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.tab { flex: 1; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; }
.tab.on { background: var(--chalk); color: var(--ink); }
.dist { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; align-items: end; margin: 4px 0 6px; }
.dist div { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.dist i { width: 100%; border-radius: 4px 4px 1px 1px; opacity: .85; }
.dist small { font-size: 10px; color: var(--muted); font-family: var(--mono); }
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rank-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 12px; border-radius: 12px; border: 1px solid transparent; }
.rank-row.me { background: rgba(var(--gold-rgb), .10); border-color: rgba(var(--gold-rgb), .45); }
.pos { width: 24px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.ring { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; font-weight: 600; }
.who { flex: 1; min-width: 0; }
.who b { display: block; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { display: block; font-size: 11px; color: var(--muted); }
.pts { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.notice { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.stat b { font-family: var(--serif); font-size: 32px; font-weight: 500; }

/* ---------- Savis ---------- */
.sage-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.sage { display: flex; align-items: center; gap: 18px; padding: 18px; border-color: rgba(var(--rgb), .28); }
.sage.current { border-color: var(--c); box-shadow: 0 0 24px rgba(var(--rgb), .25); }
.sage-art { padding: 20px; flex: none; }
.sage-info { min-width: 0; }
.sage h2 { font-family: var(--serif); font-size: 28px; font-weight: 500; margin-top: 6px; }
.sage-meta { font-family: var(--mono); font-size: 13px; color: var(--c); margin-top: 4px; }
.sage-fact { font-family: var(--serif); font-style: italic; font-size: 17px; color: #C9CED6; margin: 10px 0 4px; }
@media (max-width: 480px) {
  .sage { flex-direction: column; text-align: center; }
}

/* ---------- Modal i avís ---------- */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(5, 7, 10, .72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; background: #12161C; border: 1px solid var(--line-2); border-radius: 20px; padding: 26px 22px 22px; display: flex; flex-direction: column; gap: 14px; animation: fadeIn .25s ease both; }
.modal-x { position: absolute; top: 14px; right: 14px; }
.help { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.55; display: flex; flex-direction: column; gap: 6px; }
.help b { color: var(--chalk); font-weight: 600; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); z-index: 30;
  transform: translate(-50%, 10px); max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px;
  background: var(--chalk); color: var(--ink); font-size: 14px; font-weight: 500; white-space: pre-line;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tutorial ---------- */
.tut-intro { display: flex; flex-direction: column; gap: 6px; }
.coach {
  border: 1px solid rgba(var(--gold-rgb), .35); background: rgba(var(--gold-rgb), .08); border-radius: 14px;
  padding: 12px 14px; font-size: 14px; line-height: 1.5; color: var(--chalk); min-height: 48px;
}
.coach b { color: var(--gold-t); }
.small-target .target-num { font-size: 64px; }
.tut-done { padding: 22px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; animation: fadeIn .4s ease both; }
.tut-done .pop { animation: pop .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.tut-done-title { font-family: var(--serif); font-size: 26px; }
.tut-rules { margin: 4px 0 6px; padding-left: 18px; text-align: left; color: var(--muted); font-size: 14px; line-height: 1.55; display: flex; flex-direction: column; gap: 6px; }
.tut-rules b { color: var(--chalk); font-weight: 600; }
.tut-done .btn { width: 100%; }

/* ---------- Ratxa, fites i comodins ---------- */
.side-col { display: flex; flex-direction: column; gap: 16px; }
.wk i.frozen { background: repeating-linear-gradient(135deg, #7FA6DB 0 3px, transparent 3px 6px); opacity: .7; }
.streak-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.streak-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.streak-num { font-family: var(--serif); font-size: 40px; font-weight: 500; line-height: 1; margin-top: 4px; }
.streak-num span { font-size: 18px; color: var(--muted); font-weight: 400; }
.streak-card.compact .streak-num { font-size: 32px; }
.shields { display: flex; align-items: center; gap: 6px; }
.shields small { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: 4px; }
.shield { width: 28px; height: 28px; border-radius: 8px; border: 1px dashed var(--line-2); display: flex; align-items: center; justify-content: center; color: #4A525E; }
.shield.on { border: 1px solid rgba(127, 166, 219, .6); color: #7FA6DB; box-shadow: 0 0 10px rgba(127, 166, 219, .35); }
.ms-bar { height: 6px; border-radius: 3px; background: #222832; overflow: hidden; }
.ms-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, rgba(var(--gold-rgb), .55), var(--gold)); box-shadow: 0 0 10px rgba(var(--gold-rgb), .6); }
.ms-row { display: flex; justify-content: space-between; }
.ms { font-family: var(--mono); font-size: 11px; color: var(--faint); display: flex; align-items: center; gap: 4px; }
.ms::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.ms.on { color: var(--gold-t); }
.ms.on::before { background: var(--gold); box-shadow: 0 0 6px var(--gold); }

/* ---------- Segells i vitrina ---------- */
.seal {
  width: 44px; height: 44px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line-2); color: #4A525E; font-family: var(--serif); font-size: 17px; position: relative;
}
.seal b { font-weight: 500; }
.seal.on { border: 1.5px solid var(--gold); color: var(--gold-t); background: radial-gradient(circle, rgba(var(--gold-rgb), .18), rgba(var(--gold-rgb), 0) 70%); box-shadow: 0 0 14px rgba(var(--gold-rgb), .35); }
.seal.on::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; border: 1px solid rgba(var(--gold-rgb), .35); }
.vitrina-grid { display: flex; flex-direction: column; gap: 16px; }
.v-col { display: flex; flex-direction: column; gap: 16px; }
.coll-card, .seals-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.coll-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.coll-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.coll { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 10px; }
.coll b { font-family: var(--mono); font-size: 14px; }
.coll small { font-size: 11px; color: var(--muted); }
.coll.none b { color: #4A525E; }
.seals { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
.seal-item { display: flex; align-items: center; gap: 12px; opacity: .55; }
.seal-item.on { opacity: 1; }
.seal-item strong, .celebration strong, .banner strong { display: block; font-size: 14px; font-weight: 600; }
.seal-item small, .celebration small, .banner small { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; }
.celebrations { display: flex; flex-direction: column; gap: 8px; }
.celebration {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid rgba(var(--gold-rgb), .4); background: rgba(var(--gold-rgb), .07);
  animation: rise .6s cubic-bezier(.2, .8, .2, 1) both;
}
.banner {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); z-index: 40;
  width: min(420px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 16px; background: #14181F; border: 1px solid rgba(var(--gold-rgb), .55);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 24px rgba(var(--gold-rgb), .18);
  transform: translate(-50%, -140%); transition: transform .45s cubic-bezier(.2, .8, .2, 1); pointer-events: none;
}
.banner.show { transform: translate(-50%, 0); }
.sage-bio { font-size: 14px; line-height: 1.5; color: var(--muted); }
.link-more { border: 0; background: none; color: var(--gold-t); font-size: 13px; text-align: left; padding: 2px 4px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Pantalles mitjanes ---------- */
@media (min-width: 700px) {
  .sage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sage { flex-direction: column; text-align: center; }
}

/* ---------- Ordinador ---------- */
@media (min-width: 960px) {
  :root { --nav-h: 0px; }
  .shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
  .no-nav .shell { grid-template-columns: 1fr; }
  .nav {
    position: sticky; top: 0; height: 100vh; padding: 32px 18px; z-index: 5;
    display: flex; flex-direction: column; gap: 4px; border-top: 0; border-right: 1px solid #1E242D;
    background: rgba(11, 14, 18, .88);
  }
  .nav-brand { display: block; padding: 0 12px 26px; }
  .nav-brand .wordmark { font-size: 30px; }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; height: 46px; padding: 0 12px; border-radius: 12px; font-size: 14px; }
  .nav-item.on { background: rgba(236, 232, 223, .06); }
  .nav-item:last-child { margin-top: auto; }
  .view { max-width: 1040px; padding: 32px 48px 48px; }
  .topbar .wordmark { visibility: hidden; }
  .toast { bottom: 28px; }

  .avui-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); gap: 32px; align-items: start; }
  .avui-grid .side-col { margin-top: 54px; }
  .avui-grid .yesterday { flex-direction: column; text-align: center; padding: 28px 22px; }
  .vitrina-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .seals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .avui-grid .yesterday .y-medal { width: auto; }
  .avui-grid .yesterday .y-medal .medal { width: 120px !important; height: 120px !important; }
  .avui-grid .week { justify-content: center; }
  .title { font-size: 40px; }

  .entrada { max-width: 520px; margin: 0 auto; }

  .joc .game { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 36px; align-items: start; margin-top: 10px; }
  .joc .keypad { position: sticky; top: 32px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 120px; }
  .kbd-hint { display: block; }
  .target-num { font-size: 120px; }
  .expr { font-size: 38px; }
  .tiles { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
  .tile { height: 68px; font-size: 24px; }
  .key { height: 62px; }

  .correccio { max-width: 720px; margin: 0 auto; width: 100%; }
  .res-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: center; }
  .s3d-num { font-size: 140px; }
  .s3d-floor { width: 320px; margin-left: -160px; }
  .ranquing { max-width: 720px; }
  .sage-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .sage { padding: 14px; }
  .sage-art { padding: 14px; }
  .sage-art .medal { width: 130px !important; height: 130px !important; }
}

/* =====================================================================
 * Capa de poliment visual: llum, profunditat i detalls geomètrics.
 * Només canvia l'aspecte; el contingut i la disposició són els mateixos.
 * ===================================================================== */

/* Llum ambiental: halo daurat a dalt, blau fred a baix, vinyeta */
.aura {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60vmax 42vmax at 50% -12%, rgba(var(--gold-rgb), .13), transparent 70%),
    radial-gradient(48vmax 40vmax at 8% 108%, rgba(96, 140, 210, .10), transparent 70%),
    radial-gradient(40vmax 34vmax at 100% 60%, rgba(150, 120, 210, .06), transparent 70%),
    radial-gradient(120vmax 90vmax at 50% 45%, transparent 55%, rgba(0, 0, 0, .55));
  animation: auraBreath 14s ease-in-out infinite alternate;
}
@keyframes auraBreath { to { opacity: .72; } }

/* Figura geomètrica (cercles, triangles i espiral d'or) que gira molt a poc a poc */
.geo {
  position: fixed; z-index: 0; pointer-events: none;
  width: min(120vmin, 980px); height: min(120vmin, 980px);
  right: -28vmin; top: -30vmin; color: var(--gold); opacity: .085;
  animation: geoSpin 240s linear infinite;
}
@keyframes geoSpin { to { transform: rotate(360deg); } }
.no-nav .geo { opacity: .06; }

.rain span { text-shadow: 0 0 14px rgba(var(--gold-rgb), .08); }

/* Marca */
.wordmark b { text-shadow: 0 0 14px rgba(var(--gold-rgb), .55); }
.wordmark em {
  background: linear-gradient(180deg, #FFFDF8 10%, #CFC8BA 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.title em, .hero-title em, .intro-big em {
  background: linear-gradient(100deg, #F6D58C, var(--gold-t) 45%, #C98F2E);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.kicker.gold { text-shadow: 0 0 10px rgba(var(--gold-rgb), .35); }

/* Targetes: vora amb degradat, llum superior i ombra profunda */
.card, .expr-card, .modal-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 38%) padding-box,
    linear-gradient(180deg, rgba(20, 25, 32, .96), rgba(14, 17, 22, .96)) padding-box,
    linear-gradient(160deg, rgba(var(--gold-rgb), .38), rgba(62, 72, 86, .55) 28%, rgba(38, 45, 55, .6) 70%, rgba(var(--gold-rgb), .16)) border-box;
  border: 1px solid transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 18px 40px -18px rgba(0, 0, 0, .75), 0 2px 6px rgba(0, 0, 0, .25);
}
.sage.card { border-color: rgba(var(--rgb), .28); background: linear-gradient(180deg, rgba(var(--rgb), .06), rgba(14, 17, 22, .96) 55%); }
.sage.card.current { border-color: var(--c); }

/* Xips i avatar amb vidre */
.chip { background: rgba(20, 24, 31, .65) !important; backdrop-filter: blur(6px); transition: border-color .2s, box-shadow .2s; }
button.chip:hover { border-color: rgba(var(--gold-rgb), .55); box-shadow: 0 0 14px rgba(var(--gold-rgb), .18); }
.avatar { box-shadow: 0 0 0 3px rgba(var(--gold-rgb), .10), 0 0 16px rgba(var(--gold-rgb), .15); }

/* Botons */
.btn { position: relative; overflow: hidden; isolation: isolate; transition: transform .12s ease, background .2s ease, box-shadow .25s ease, border-color .2s; }
.btn-primary {
  background: linear-gradient(180deg, #FBF8F1, #E6E0D2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 -2px 0 rgba(0, 0, 0, .08) inset, 0 10px 28px -10px rgba(var(--gold-rgb), .55), 0 2px 8px rgba(0, 0, 0, .35);
}
.btn-primary:hover { background: linear-gradient(180deg, #FFFFFF, #EFE9DC); box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 12px 34px -8px rgba(var(--gold-rgb), .7), 0 2px 8px rgba(0, 0, 0, .35); }
.btn-primary::after, .key.submit::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; z-index: -1; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(var(--gold-rgb), .35), transparent);
  transform: skewX(-18deg); animation: sheen 5.5s ease-in-out infinite;
}
@keyframes sheen { 0%, 62% { left: -60%; } 100% { left: 130%; } }
.btn-ghost { backdrop-filter: blur(6px); }
.btn-ghost:hover { border-color: rgba(var(--gold-rgb), .5); box-shadow: 0 0 18px rgba(var(--gold-rgb), .12); }
.btn-meta { color: #6B6455; }

/* Compte enrere */
.countdown { text-shadow: 0 0 10px rgba(var(--gold-rgb), .4); }

/* Navegació */
.nav { background: linear-gradient(180deg, rgba(14, 17, 22, .9), rgba(9, 11, 15, .97)); }
.nav-item { position: relative; transition: color .2s; }
.nav-item svg { transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), filter .25s; }
.nav-item.on { color: var(--gold-t); }
.nav-item.on svg { filter: drop-shadow(0 0 6px rgba(var(--gold-rgb), .6)); transform: translateY(-1px); }
.nav-item.on::before {
  content: ''; position: absolute; top: 0; left: 50%; width: 28px; height: 2px; margin-left: -14px; border-radius: 0 0 2px 2px;
  background: var(--gold); box-shadow: 0 0 10px var(--gold);
}

/* Entrada */
.mini-tile, .tile {
  background: linear-gradient(180deg, #232A35, #161B23);
  border: 1px solid #39424F;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .07) inset, 0 -2px 0 rgba(0, 0, 0, .35) inset, 0 6px 14px -6px rgba(0, 0, 0, .7);
}
.mini-tile:nth-child(2) { animation-delay: .08s; } .mini-tile:nth-child(3) { animation-delay: .16s; }
.mini-tile:nth-child(4) { animation-delay: .24s; } .mini-tile:nth-child(5) { animation-delay: .32s; }
.hero-target, .target-num {
  background: linear-gradient(180deg, #FFFFFF 15%, #E9E2D3 55%, #B9B0A0 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 22px rgba(var(--gold-rgb), .22));
}
.hero-target b { -webkit-text-fill-color: var(--gold); text-shadow: 0 0 18px rgba(var(--gold-rgb), .6); }

/* Avui: llista de nivells */
.lvl-row { position: relative; transition: background .2s; }
.lvl-row.next { margin: 0 -18px; padding-left: 18px; padding-right: 18px; background: linear-gradient(90deg, rgba(var(--gold-rgb), .10), transparent 75%); border-bottom-color: transparent; }
.lvl-row.next::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.lvl-row.next .dots i { background: var(--gold); box-shadow: 0 0 6px rgba(var(--gold-rgb), .6); }
.dots i { border-radius: 50%; }
.wk i:not(.empty):not(.today):not(.frozen) { box-shadow: 0 0 8px currentColor; }

/* Joc: capçalera, progrés i temporitzador */
.segs span { height: 5px; border-radius: 3px; }
.segs .exact, .segs .cur { box-shadow: 0 0 10px rgba(var(--gold-rgb), .7); }
.timer::before {
  content: ''; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(rgba(236, 232, 223, .22) 0 1deg, transparent 1deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%, #000 70%, transparent 71%);
          mask: radial-gradient(circle, transparent 62%, #000 63%, #000 70%, transparent 71%);
}
.timer svg .ring { filter: drop-shadow(0 0 4px rgba(236, 232, 223, .45)); }
.timer.low svg .ring { filter: drop-shadow(0 0 6px rgba(var(--gold-rgb), .9)); }
.timer.low { animation: timerBeat 1s ease-in-out infinite; }
@keyframes timerBeat { 50% { transform: scale(1.06); } }

/* Objectiu: transportador que gira darrere el número */
.target { position: relative; isolation: isolate; }
.target-num { position: relative; display: inline-block; padding: 0 .12em; }
.target-num::before {
  content: ''; position: absolute; z-index: -1; left: 50%; top: 52%; width: 1.9em; height: 1.9em; margin: -.95em 0 0 -.95em;
  border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(circle, rgba(var(--gold-rgb), .16), transparent 62%),
    repeating-conic-gradient(rgba(var(--gold-rgb), .55) 0 .6deg, transparent .6deg 10deg);
  -webkit-mask: radial-gradient(circle, #000 0 40%, transparent 40.5% 44%, #000 44.5% 47%, transparent 47.5%);
          mask: radial-gradient(circle, #000 0 40%, transparent 40.5% 44%, #000 44.5% 47%, transparent 47.5%);
  opacity: .55; animation: geoSpin 60s linear infinite;
}
.target .kicker { color: var(--gold-t); text-shadow: 0 0 10px rgba(var(--gold-rgb), .35); }

/* Expressió */
.expr-card { transition: box-shadow .3s; }
.expr-card:focus-within, .expr-card:has(.tk-n) { box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 0 0 1px rgba(var(--gold-rgb), .22), 0 0 30px -6px rgba(var(--gold-rgb), .28), 0 18px 40px -18px rgba(0, 0, 0, .75); }
.caret { box-shadow: 0 0 8px var(--gold); }
.expr .tk-o, .expr .tk-r { color: var(--gold-t); }
.expr .tk-p { color: var(--muted); }
.pill { border: 1px solid rgba(var(--gold-rgb), .25); }
.pill.exact { background: linear-gradient(180deg, #F3CF7E, var(--gold)); box-shadow: 0 0 18px rgba(var(--gold-rgb), .55); animation: pillPop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pillPop { from { transform: scale(.8); } }

/* Fitxes de xifres */
.tile { position: relative; transition: transform .15s cubic-bezier(.3, 1.6, .5, 1), opacity .2s, border-color .2s, box-shadow .2s; animation: tileIn .5s cubic-bezier(.2, .8, .2, 1) both; }
.tile:nth-child(2) { animation-delay: .05s; } .tile:nth-child(3) { animation-delay: .1s; } .tile:nth-child(4) { animation-delay: .15s; }
.tile:nth-child(5) { animation-delay: .2s; } .tile:nth-child(6) { animation-delay: .25s; } .tile:nth-child(7) { animation-delay: .3s; } .tile:nth-child(8) { animation-delay: .35s; }
@keyframes tileIn { from { opacity: 0; transform: translateY(10px) scale(.92); } }
.tile:not(:disabled):hover {
  transform: translateY(-2px); border-color: rgba(var(--gold-rgb), .8);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 0 0 1px rgba(var(--gold-rgb), .25), 0 10px 22px -8px rgba(var(--gold-rgb), .45);
}
.tile:not(:disabled):active { transform: translateY(1px) scale(.95); }
.tile.used { background: transparent; box-shadow: none; animation: none; }

/* Teclat */
.key {
  background: linear-gradient(180deg, #1B2129, #13171E);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 4px 10px -6px rgba(0, 0, 0, .8);
  transition: transform .12s ease, opacity .2s, border-color .2s, box-shadow .2s, color .2s;
}
.key:not(.soft):not(.submit):not(:disabled) { color: #F1E3C2; }
.key:not(:disabled):hover { border-color: rgba(var(--gold-rgb), .5); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 0 16px -4px rgba(var(--gold-rgb), .35); }
.key.submit {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg, #FBF8F1, #E3DCCC);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 8px 22px -10px rgba(var(--gold-rgb), .6);
}

/* Correcció i resultat */
.steps li { transition: background .2s; }
.step-expr.final { text-shadow: 0 0 22px rgba(var(--gold-rgb), .2); }
.ink::after { box-shadow: 0 0 6px var(--gold); }
.nl-axis { background: linear-gradient(90deg, transparent, #4A5361 8%, #4A5361 92%, transparent); }
.nl-gap { box-shadow: 0 0 10px rgba(var(--gold-rgb), .7); }
.nl-mark.goal { box-shadow: 0 0 8px rgba(236, 232, 223, .6); }
.bar { background: #1C222B; box-shadow: 0 1px 2px rgba(0, 0, 0, .5) inset; }
.rr-words { border-left: 2px solid transparent; border-image: linear-gradient(180deg, var(--gold), transparent) 1; }
.res-medal { filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .6)); }

/* Rànquing, savis i vitrina */
.tabs { background: rgba(14, 17, 22, .8); backdrop-filter: blur(6px); }
.tab { transition: background .2s, color .2s; }
.tab.on { background: linear-gradient(180deg, #FBF8F1, #E3DCCC); box-shadow: 0 4px 14px -6px rgba(var(--gold-rgb), .55); }
.rank-row { transition: background .2s, border-color .2s; }
.rank-row:not(.me):hover { background: rgba(236, 232, 223, .03); border-color: var(--line); }
.rank-row.me { box-shadow: 0 0 22px -6px rgba(var(--gold-rgb), .45); }
.dist i { box-shadow: 0 0 12px -2px currentColor; }
.stat b { background: linear-gradient(180deg, #FFFFFF, #BDB5A6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sage { transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s; }
.sage:hover { transform: translateY(-3px); box-shadow: 0 0 28px rgba(var(--rgb), .22), 0 18px 40px -18px rgba(0, 0, 0, .8); }
.seal.on { animation: sealGlow 3.2s ease-in-out infinite; }
@keyframes sealGlow { 50% { box-shadow: 0 0 22px rgba(var(--gold-rgb), .55); } }
.streak-num { background: linear-gradient(180deg, #FFFFFF, #CFC6B4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.streak-num span { -webkit-text-fill-color: var(--muted); }

/* Avisos */
.banner { visibility: hidden; transform: translate(-50%, calc(-100% - 40px)); transition: transform .45s cubic-bezier(.2, .8, .2, 1), visibility 0s .45s; }
.banner.show { visibility: visible; transform: translate(-50%, 0); transition: transform .45s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.toast { box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .6), 0 0 22px rgba(var(--gold-rgb), .25); }
.modal { background: radial-gradient(circle at 50% 30%, rgba(20, 24, 31, .6), rgba(5, 7, 10, .85)); }

@media (min-width: 960px) {
  .nav { background: linear-gradient(180deg, rgba(16, 19, 25, .88), rgba(10, 12, 16, .92)); }
  .nav::after { content: ''; position: absolute; top: 0; right: -1px; bottom: 0; width: 1px; background: linear-gradient(180deg, transparent, rgba(var(--gold-rgb), .35) 30%, rgba(var(--gold-rgb), .1) 70%, transparent); }
  .nav-item.on { background: linear-gradient(90deg, rgba(var(--gold-rgb), .14), rgba(var(--gold-rgb), 0)); }
  .nav-item.on::before { top: 10px; bottom: 10px; left: 0; width: 2px; height: auto; margin: 0; border-radius: 2px; }
  .nav-item:not(.on):hover { background: rgba(236, 232, 223, .04); }
  .geo { right: -18vmin; top: -26vmin; }
}

@media (prefers-reduced-motion: reduce) {
  .geo, .aura, .target-num::before { animation: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .rain { display: none; }
  .step { opacity: 1; }
}

/* ---------- Jugar ara, convidats i registre ---------- */
.btn-hero {
  min-height: 64px; font-size: 19px; letter-spacing: .2px; background: var(--gold); color: var(--ink);
  box-shadow: 0 12px 34px -12px rgba(var(--gold-rgb), .8), 0 0 0 1px rgba(var(--gold-rgb), .45);
}
.btn-hero:hover { background: #F0C670; }
.btn-hero span { transition: transform .2s ease; }
.btn-hero:hover span { transform: translateX(3px); }
.entrada .cta-stack { width: 100%; max-width: 420px; margin-left: auto; margin-right: auto; }
.btn-text {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; align-self: center;
  padding: 8px 6px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 13.5px; line-height: 1.35; text-align: center;
  text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px;
}
.btn-text:hover { color: var(--chalk); text-decoration-color: currentColor; }
.btn-text svg { width: 15px; height: 15px; flex: none; }
.btn-text.inline { display: inline-flex; padding: 4px 2px; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 13.5px; border-radius: 999px; gap: 8px; }
.btn-sm svg { width: 15px; height: 15px; flex: none; }
.chip-save { cursor: pointer; font-family: var(--sans); font-size: 12.5px; }
.chip-save svg { width: 14px; height: 14px; }
@media (max-width: 440px) { .chip-save span { display: none; } .chip-save { padding: 0 9px; } }
.save-card { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-color: rgba(var(--gold-rgb), .35); }
.save-card p { flex: 1 1 200px; color: var(--muted); line-height: 1.45; }
.nudge-line { margin-top: 14px; text-align: center; font-size: 13.5px; color: var(--muted); }

/* ---------- Reptes entre amics ---------- */
.challenge {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; flex-wrap: wrap;
  border-color: rgba(var(--gold-rgb), .45); background: rgba(var(--gold-rgb), .07);
}
.challenge p { flex: 1 1 180px; font-size: 14.5px; line-height: 1.45; }
.challenge small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.avui .challenge { margin-bottom: 14px; }
.res-grid .challenge { margin-bottom: 14px; }

/* ---------- Rànquing: tothom / amics ---------- */
.scope { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.seg button { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; }
.seg button.on { background: var(--surface-2); color: var(--chalk); box-shadow: inset 0 0 0 1px var(--line-2); }
.center-notice { align-items: center; text-align: center; }

/* ---------- Avatars i perfil ---------- */
.ring.av { font-family: var(--serif); font-size: 18px; font-weight: 500; }
.ring.lg { width: 52px; height: 52px; font-size: 15px; }
.ring.av.lg { font-size: 27px; }
.av-glyph { font-family: var(--serif); font-size: 19px; line-height: 1; }
.prof-head { display: flex; align-items: center; gap: 14px; }
.prof-head b { display: block; font-size: 17px; }
.prof-head small { display: block; font-size: 12.5px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field input {
  height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--surface); color: var(--chalk); font-family: var(--sans); font-size: 16px;
}
.field input:focus { outline: none; border-color: var(--gold); }
.av-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.av-grid button {
  aspect-ratio: 1; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface);
  color: var(--chalk); font-family: var(--serif); font-size: 21px; cursor: pointer;
}
.av-grid button.on { border-color: var(--gold); background: rgba(var(--gold-rgb), .14); color: var(--gold-t); }
.av-colors { display: flex; gap: 12px; }
.av-colors button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ink); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.av-colors button.on { box-shadow: 0 0 0 2px var(--chalk); }
.chip { white-space: nowrap; }
@media (max-width: 440px) { .topbar-right { gap: 6px; } .topbar .chip { padding: 0 9px; } }
@media (max-width: 360px) { .topbar .wordmark { font-size: 22px; } }

/* ---------- Expressió: parèntesis per tancar ---------- */
.ghost-paren { color: var(--faint); opacity: .55; margin-left: 2px; letter-spacing: 2px; }
.pill.warn { box-shadow: inset 0 0 0 1px rgba(var(--gold-rgb), .55); }

/* ---------- Mode aula ---------- */
.aula-link { margin: -2px auto 0; display: flex; font-size: 12.5px; }
.timer.off { display: flex; align-items: center; justify-content: center; border: 1.5px dashed var(--line-2); border-radius: 50%; }
.timer.off span { position: static; font-family: var(--serif); font-size: 24px; color: var(--muted); }
.aula-list li { list-style: none; }
.aula-row { width: 100%; background: none; border: 0; border-bottom: 1px solid #222832; text-align: left; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.aula-row > span:first-child { color: var(--chalk); font-weight: 600; }
.aula-list li:last-child .aula-row { border-bottom: 0; }
.aula-row:hover > span:first-child { color: var(--gold-t); }
.aula { display: flex; flex-direction: column; gap: 14px; }
.day-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.day-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 58px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--chalk); font-family: var(--mono); font-size: 13px; cursor: pointer; }
.day-chip small { font-size: 10.5px; color: var(--muted); }
.day-chip.on { border-color: var(--gold); }

/* ---------- Estadístiques i instal·lació ---------- */
.stats-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.streak-line { font-size: 15px; color: var(--muted); }
.streak-line b { color: var(--chalk); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat-cell { display: flex; flex-direction: column; gap: 2px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.stat-cell b { font-family: var(--mono); font-size: 19px; color: var(--chalk); font-variant-numeric: tabular-nums; }
.stat-cell span { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.next-card { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.next-card .countdown-row { padding-top: 10px; }
.btn-install { min-height: 46px; font-size: 14.5px; }
.ios-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--muted); line-height: 1.5; }
.ios-steps b { color: var(--chalk); }
.ios-steps svg { vertical-align: -3px; color: var(--gold); }

/* ---------- Portada: «Juga ara» sempre visible en mòbils petits ---------- */
@media (max-height: 760px) {
  .entrada { padding-top: max(18px, env(safe-area-inset-top)); }
  .hero-demo { margin-top: 10px; gap: 8px; }
  .mini-tile { width: 38px; height: 44px; font-size: 17px; }
  .ops-line { font-size: 18px; }
  .hero-target { font-size: 64px; margin-top: -4px; }
  .hero-target b { font-size: 32px; }
  .hero-title { font-size: 27px; margin-top: 4px; }
  .entrada .lead { font-size: 14px; }
  .entrada .cta-stack { padding-top: 10px; gap: 8px; }
  .entrada .challenge { padding: 10px 12px; }
  .entrada .ring.lg { width: 40px; height: 40px; }
}
@media (max-height: 640px) {
  .entrada .ops-line, .entrada .lead { display: none; }
}

/* ---------- Normes plegades ---------- */
.rules-box { padding: 0 16px; margin-top: 4px; }
.rules-box summary { padding: 14px 0; cursor: pointer; font-size: 13.5px; color: var(--muted); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.rules-box summary::-webkit-details-marker { display: none; }
.rules-box summary::after { content: '+'; font-family: var(--mono); color: var(--gold); font-size: 16px; }
.rules-box[open] summary::after { content: '−'; }
.rules-box[open] summary { color: var(--chalk); }
.rules-box .tut-rules { margin: 0 0 14px; }

/* =====================================================================
   v3 · Flux ràpid entre nivells, tauler a mida de pantalla, compartir
   ===================================================================== */

/* Tauler de joc: ocupa exactament l'alçada visible (barra de Safari inclosa) */
.no-nav .view:has(.joc), .no-nav .view:has(.tutorial) { padding-bottom: 0; }
.screen.joc, .screen.tutorial {
  min-height: 100vh; min-height: 100dvh;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  gap: calc(14px * var(--k, 1));
}
.joc .game, .tutorial .game { flex: 1; gap: calc(14px * var(--k, 1)); }
.joc .game-main, .tutorial .game-main { gap: calc(14px * var(--k, 1)); }
/* L'objectiu a dalt; xifres i operacions al terç inferior, a l'abast del polze */
@media (max-width: 959px) {
  .joc .game, .tutorial .game { justify-content: flex-end; }
  .joc .game-main, .tutorial .game-main { flex: 1; }
  .joc .target, .tutorial .target { margin-bottom: auto; }
}
.target-num { font-size: calc(92px * var(--k, 1)); }
.small-target .target-num { font-size: calc(64px * var(--k, 1)); }
.tile { height: calc(60px * var(--k, 1)); }
.key { height: calc(56px * var(--k, 1)); }
.expr-card { padding: calc(14px * var(--k, 1)) 16px calc(10px * var(--k, 1)); }
.expr { min-height: calc(40px * var(--k, 1)); }
.expr-live { margin-top: calc(10px * var(--k, 1)); padding-top: calc(8px * var(--k, 1)); }
.view[style*="--k"] .hint, .view[style*="--k"] .tut-intro .lead { display: none; }
.keypad.basic .key.submit { grid-column: span 4; }
.tut-brand { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.tut-brand .wordmark { font-size: 30px; }
.tut-intro { display: flex; flex-direction: column; gap: 8px; }
.tut-intro .challenge { margin: 4px 0; }

/* Entre nivells: només els punts, ràpid, i cap al següent */
.lvl-flash {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(8, 10, 14, .78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fadeIn .2s ease both;
}
.lf-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; animation: pop .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.lf-pts { font-family: var(--serif); font-size: clamp(64px, 22vw, 110px); font-weight: 500; line-height: 1; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.lf-pts.burst { animation: burst .7s cubic-bezier(.3, 1.6, .5, 1); }
.lf-msg { font-size: 17px; color: var(--chalk); }
.lvl-flash.exact .lf-msg { color: var(--gold-t); }
.lf-total { font-family: var(--mono); font-size: 14px; color: var(--muted); margin-top: 6px; }
.lf-total b { color: var(--chalk); font-size: 18px; }
.lf-next { font-family: var(--mono); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); margin-top: 10px; }
.lf-pause { margin-top: 4px; font-size: 13px; }

/* Correcció del mode aula: el botó de continuar sempre a la vista */
.correccio .cta-row {
  position: sticky; bottom: 0; z-index: 3; margin: 0 -20px; padding: 12px 20px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(11, 14, 18, 0), rgba(11, 14, 18, .94) 30%);
}
.no-nav .view:has(.correccio) { padding-bottom: 0; }

/* Resultat: compartir a la vista, sense scroll */
.btn-gold {
  background: linear-gradient(180deg, #F0C976, var(--gold)); color: var(--ink); width: 100%;
  box-shadow: 0 0 0 1px rgba(var(--gold-rgb), .5), 0 10px 30px -10px rgba(var(--gold-rgb), .7);
}
.btn-gold:hover { background: linear-gradient(180deg, #F6D58C, #EBC06A); }
.res-actions { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; animation: fadeIn .4s ease .3s both; }
.res-hero .rr-words { width: 100%; }
.bar-row b .star { font-style: normal; margin-left: 4px; color: var(--line-2); }
.bar-row b .star.on { color: var(--gold); text-shadow: 0 0 8px rgba(var(--gold-rgb), .7); }
.bar-row { grid-template-columns: 26px 1fr 88px; }
@media (max-width: 959px) {
  .resultat .score3d { padding: 8px 0 22px; }
  .resultat .s3d-num { font-size: 84px; }
  .resultat .rank-line { margin-top: -6px; }
  .resultat .rank-reveal { margin-top: 4px; gap: 12px; }
  .resultat .rr-medal { padding: 4px; }
  .resultat .rr-medal .medal { width: 64px !important; height: 64px !important; }
  .resultat .res-name { font-size: 32px; }
}

/* Desglòs del dia */
.dg-item { padding: 0; overflow: hidden; }
.dg-item summary { list-style: none; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; }
.dg-item summary::-webkit-details-marker { display: none; }
.dg-n { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.dg-t { font-size: 15px; }
.dg-t b { font-family: var(--serif); font-size: 20px; font-weight: 500; }
.dg-p { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.dg-body { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid #1E242D; }
.steps-mini { list-style: none; margin: 0; padding: 0; }
.steps-mini li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid #1E242D; }
.steps-mini .step-expr { font-size: 20px; }
.steps-mini .step-expr.final { font-size: 24px; }
.dg-sol { display: flex; flex-direction: column; gap: 4px; font-family: var(--serif); font-size: 19px; }

/* Sobre mi i contacte */
.about-link { margin-top: 8px; font-size: 13px; color: var(--muted); }
.about-card, .contact-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; line-height: 1.55; }
.contact-form { display: flex; flex-direction: column; gap: 14px; }
.field select, .field textarea {
  padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--surface); color: var(--chalk); font-family: var(--sans); font-size: 16px;
}
.field select { height: 46px; padding: 0 12px; }
.field textarea { resize: vertical; min-height: 120px; line-height: 1.45; }
.field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.contact-ok { font-size: 16px; padding: 8px 0; }
@media (min-width: 960px) {
  .target-num { font-size: 120px; }
  .tile { height: 68px; }
  .key { height: 62px; }
  .screen.joc, .screen.tutorial { min-height: 0; }
}

/* Navegació amb «Sobre mi» (6 elements) */
.nav { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.nav-item span { white-space: nowrap; }
@media (max-width: 380px) { .nav-item { font-size: 10px; } }
@media (min-width: 960px) {
  .nav-item:last-child { margin-top: 0; }
  .nav-item[data-go="sobre"] { margin-top: auto; }
}
.about-hi { font-family: var(--serif); font-size: 21px; line-height: 1.35; }

/* Convidat: nom per sortir al rànquing */
.name-card { width: 100%; padding: 16px; display: flex; flex-direction: column; gap: 10px; border-color: rgba(var(--gold-rgb), .35); text-align: left; }
.name-row { display: flex; gap: 8px; }
.name-row input {
  flex: 1; min-width: 0; height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--surface-2); color: var(--chalk); font-family: var(--sans); font-size: 16px;
}
.name-row input:focus { outline: none; border-color: var(--gold); }
.name-row .btn { min-height: 46px; flex: none; }
.name-card .btn-text { align-self: flex-start; font-size: 13px; }
.or-line { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--faint); }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.modal-card .btn small { font-weight: 400; font-size: 12.5px; }
