:root {
  --bg: #000000;
  --ink: #F1F3EE;
  --muted: #949A92;
  --dim: #6E736C;
  --line: #2A2D2A;
  --green: #B6E388;
  --yellow: #F2D45C;
  --blue: #9CCBEB;
  --head: 'Space Grotesk', system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
a { color: var(--green); }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.grow { flex: 1; }

/* Toppen */
.meta { padding: 28px 24px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.meta .accent { color: var(--blue); }
.tabs { display: flex; gap: 20px; padding: 18px 24px 0; }
.tabs button { background: none; border: 0; padding: 8px 0; font-family: var(--head); font-size: 15px; font-weight: 600; color: var(--dim); }
.tabs button.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--green); }
.iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; padding: 0; }

/* Rubriker */
.hero { padding: 26px 24px 24px; display: flex; flex-direction: column; gap: 8px; }
.h-xl { margin: 0; font-family: var(--head); font-size: clamp(64px, 22vw, 88px); line-height: .9; font-weight: 700; letter-spacing: -.05em; }
.h-l { margin: 0; font-family: var(--head); font-size: clamp(40px, 12vw, 60px); overflow-wrap: anywhere; hyphens: auto; line-height: .9; font-weight: 700; letter-spacing: -.05em; }
.h-m { margin: 0; font-family: var(--head); font-size: 52px; line-height: .92; font-weight: 700; letter-spacing: -.04em; }
.sub { font-family: var(--head); font-size: 20px; font-weight: 500; color: var(--muted); letter-spacing: -.01em; }
.note { font-size: 14px; line-height: 1.5; color: var(--muted); margin: 0; }
.label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.green { color: var(--green); } .yellow { color: var(--yellow); } .blue { color: var(--blue); } .dim { color: var(--dim); }

/* Rader */
.rows { border-top: 1px solid var(--ink); display: flex; flex-direction: column; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px; min-height: 72px;
  border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; color: var(--ink); }
.row.tight { min-height: 54px; }
.row .t { font-size: 17px; font-weight: 500; }
.row .s { font-size: 12px; margin-top: 4px; }
.row .big { font-family: var(--head); font-size: 32px; font-weight: 600; letter-spacing: -.03em; white-space: nowrap; }
.row .mid { font-family: var(--head); font-size: 22px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.row.sel { background: var(--green); color: #000; border-bottom-color: var(--green); }
.row.sel .dim, .row.sel .muted { color: #000; }
.num { width: 26px; font-family: var(--head); font-size: 13px; font-weight: 600; color: var(--dim); flex: none; }

/* Inmatning */
.field { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; min-height: 88px; border-bottom: 1px solid var(--line); }
.field .fl { font-size: 17px; font-weight: 500; }
.field input { width: 120px; text-align: right; background: transparent; border: 0; padding: 0; font-family: var(--head); font-size: 40px; font-weight: 600; letter-spacing: -.03em; outline: none; }
.field input::placeholder { color: #4A4F49; }
.field .unit { width: 26px; font-size: 14px; color: var(--muted); margin-left: 8px; }
.field:focus-within .fl { color: var(--green); }
.textopt { background: none; border: 0; padding: 10px 0 7px; font-family: var(--head); font-size: 24px; font-weight: 600; letter-spacing: -.02em; color: var(--dim); border-bottom: 3px solid transparent; }
.textopt.on { color: var(--ink); border-bottom-color: var(--green); }

/* Rutnät av val */
.cells { display: grid; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.cells button { border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--dim); font-family: var(--head); font-weight: 600; min-height: 64px; }
.cells button:last-child { border-right: 0; }
.cells button.on { background: var(--green); color: #000; }
.cells.big button { height: 112px; font-size: 44px; }
.seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 24px; }
.seg button { border: 0; background: transparent; color: var(--muted); min-height: 72px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; padding: 0 10px; text-align: left; font-size: 12px; font-weight: 600; }
.seg button.on { background: var(--green); color: #000; }
.bars { display: flex; gap: 2px; }
.bars i { width: 6px; height: 10px; background: var(--line); display: block; }
.bars i.f { background: var(--ink); }
.seg button.on .bars i { background: rgba(0,0,0,.2); }
.seg button.on .bars i.f { background: #000; }
.feel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 24px; }
.feel button { min-height: 56px; border: 1px solid var(--line); border-left-width: 0; background: transparent; font-family: var(--head); font-size: 18px; font-weight: 600; }
.feel button:first-child { border-left-width: 1px; }
.feel button.on { background: var(--green); border-color: var(--green); color: #000; }

/* Knappar */
.cta { position: sticky; bottom: 0; width: 100%; min-height: calc(96px + var(--safe-b)); border: 0; border-radius: 0; background: var(--yellow); color: #000;
  font-family: var(--head); font-size: 28px; font-weight: 700; letter-spacing: -.02em; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px calc(12px + var(--safe-b)); text-align: left; }
.cta:disabled { background: #3A3A2A; color: #6E6A50; }
.cta svg { flex: none; }
.ghost { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 12px 0; text-decoration: underline; text-underline-offset: 3px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.split button { min-height: 64px; border: 0; border-right: 1px solid var(--line); background: transparent; font-family: var(--head); font-size: 18px; font-weight: 600; }
.split button:last-child { border-right: 0; }
.sq { width: 52px; height: 52px; border: 1px solid var(--line); background: transparent; display: inline-flex; align-items: center; justify-content: center; }

/* Pass */
.progress { margin: 14px 24px 0; height: 2px; background: var(--line); }
.progress > div { height: 2px; background: var(--ink); }
.giant { font-family: var(--head); font-size: clamp(130px, 44vw, 176px); line-height: .8; font-weight: 700; letter-spacing: -.07em; }
.timerbar { height: 8px; background: #1A1C1A; }
.timerbar > div { height: 8px; background: var(--yellow); }
.cue { font-size: 14px; line-height: 1.5; color: var(--muted); margin: 0; }

/* Medaljer */
.mgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 12px; padding: 20px 24px 32px; }
.mcell { background: none; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink); min-height: 44px; }
.mcell svg { width: 100%; height: auto; display: block; }
.mcell span { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.2; word-break: break-word; }
.medal-hero { display: flex; justify-content: center; padding: 10px 24px 6px; }
.medal-hero svg { width: min(72vw, 300px); height: auto; }
@keyframes pop { 0% { transform: scale(.4) rotate(-20deg); opacity: 0; } 70% { transform: scale(1.06) rotate(3deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
.pop svg { animation: pop .7s cubic-bezier(.2,.9,.3,1.2) both; }

/* Övrigt */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); font-family: var(--head); font-size: 22px; font-weight: 600; letter-spacing: -.02em; padding: 0 24px; }
.toast { position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #000; padding: 12px 18px; font-size: 14px; font-weight: 600; z-index: 10; }
.pad { padding: 0 24px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.stats > div { padding: 16px 24px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.stats > div:last-child { border-right: 0; }
.stats b { font-family: var(--head); font-size: 30px; font-weight: 600; letter-spacing: -.03em; }
.stats span { font-size: 12px; color: var(--muted); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
