/* Delt stil for billeker-spillenes rammeverk.
   Lastes ETTER assets/base.css (fargetokens, reset, typografi, .wrap-grunnlag).
   Her ligger bare det som er spesifikt for en spillside; per-spill-stil ligger
   i assets/games/<slug>.css. Alle mål er tokens fra Stilguide 2.0. */

button{
  font: inherit;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}

/* Spillsidene er smalere enn forsiden. */
.wrap{
  max-width:var(--width-narrow);
  padding-left: calc(var(--space-5) + env(safe-area-inset-left));
  padding-right: calc(var(--space-5) + env(safe-area-inset-right));
}

/* ---------- topplinje (settes inn av game.js) ---------- */
/* Klistrer seg til toppen slik at navnet paa spillet alltid er synlig. */
.game-top{
  position:sticky; top:0; z-index:20;
  background:var(--bg);
  border-bottom:var(--border-w) solid var(--line);
  display:flex; align-items:center; justify-content:space-between; gap:var(--space-3);
  padding:var(--space-3) var(--space-5);
  padding-top: calc(var(--space-3) + env(safe-area-inset-top));
  padding-left: calc(var(--space-5) + env(safe-area-inset-left));
  padding-right: calc(var(--space-5) + env(safe-area-inset-right));
}
.game-back{
  display:inline-flex; align-items:center; gap:var(--space-1);
  font-weight:600; font-size:var(--text-base); line-height:var(--leading-ui); color:var(--text-dim);
  text-decoration:none; padding:var(--space-2) var(--space-0); white-space:nowrap;
}
.game-back:hover{ color:var(--text); }
.game-name{
  display:inline-flex; align-items:center; gap:var(--space-2);
  font-family:var(--font-display); font-weight:800; font-size:var(--text-md);
  white-space:nowrap;
}
.game-name .mark{
  flex:none;
  width:30px; height:30px; border-radius:var(--radius-sm);
  display:flex; align-items:center; justify-content:center;
  font-size:var(--text-base); line-height:1;
  transform:rotate(-3deg);
}
.game-name .mark-img{ border-radius:0; }  /* logo.svg har egen avrunding */

section[data-screen]{ padding:var(--space-2) 0 calc(var(--space-10) + env(safe-area-inset-bottom)); }

/* ---------- sikkerhetsvarsel (tekst i strings.js) ---------- */
.safety{
  display:flex; gap:var(--space-3); align-items:flex-start;
  background:rgba(255,201,60,0.10);
  border:var(--border-w) solid rgba(255,201,60,0.28);
  border-radius:var(--radius-lg); padding:var(--space-4); margin:var(--space-4) 0 var(--space-6);
}
.safety-icon{ font-size:var(--text-lg); line-height:var(--leading-ui); }
.safety p{ margin:0; font-size:var(--text-base); color:var(--text); }
.safety strong{ color:var(--gul); }

/* ---------- intro ---------- */
.game-title{ font-size:var(--text-2xl); margin-bottom:var(--space-1); }
.game-lead{ color:var(--text-dim); margin:0 0 var(--space-5); }
.rules{
  background:var(--card); border:var(--border-w) solid var(--line);
  border-radius:var(--radius-lg); padding:var(--space-5); margin-bottom:var(--space-6);
}
.rules h2{ font-size:var(--text-body); margin-bottom:var(--space-2); }
.rules ul{ margin:0; padding-left:var(--space-5); color:var(--text-dim); }
.rules ul ul{ margin-top:var(--space-1); }
.rules li{ margin-bottom:var(--space-2); }
.rules li strong{ color:var(--text); }
.rules p{ margin:0; color:var(--text-dim); }
.rules p strong{ color:var(--text); }

/* ---------- knapper ---------- */
.btn{
  font-family:var(--font-display); font-weight:700; font-size:var(--text-base);
  border-radius:var(--radius-full); padding:var(--space-4) var(--space-6); border:none; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; gap:var(--space-2); width:100%;
}
.btn-primary{ background:var(--aksent); color:var(--paa-aksent); }
.btn-primary:hover{ background:var(--aksent-dyp); }
.btn-primary:disabled{ background:#3a3f4d; color:var(--text-dim); cursor:not-allowed; }
.btn-line{ background:transparent; border:var(--border-w) solid var(--line); color:var(--text); }
.btn-line:hover{ background:var(--card); }
.btn-row{ display:flex; gap:var(--space-3); margin-top:var(--space-4); }
.btn-row .btn{ width:auto; flex:1; }
.btn-ghost{
  background:transparent; border:none; color:var(--text-dim);
  font-weight:600; padding:var(--space-2) var(--space-0); cursor:pointer; font-family:inherit; font-size:var(--text-sm);
}
.btn-ghost:hover{ color:var(--text); }
/* Sentrert variant - brukes til "Fortsett ..."-knappen under den primaere knappen. */
.btn-ghost-center{ display:block; width:100%; text-align:center; }
/* Utility for enkeltstaaende avstand foran/etter en knapp (erstatter inline style=""). */
.mt-space-3{ margin-top:var(--space-3); }

/* ---------- spilleroppsett (bygges av game.js) ---------- */
.ps-add{ display:flex; gap:var(--space-2); margin-bottom:var(--space-4); }
.ps-input{
  flex:1; padding:var(--space-3) var(--space-4); background:var(--bg); color:var(--text);
  border:var(--border-w) solid var(--line); border-radius:var(--radius-md); font-family:inherit; font-size:var(--text-base);
}
.ps-addbtn{ width:auto; white-space:nowrap; padding:var(--space-3) var(--space-4); }
.ps-list{ list-style:none; margin:0 0 var(--space-3); padding:0; display:flex; flex-direction:column; gap:var(--space-2); }
.ps-list li{
  display:flex; align-items:center; justify-content:space-between;
  background:var(--card); border:var(--border-w) solid var(--line);
  border-radius:var(--radius-md); padding:var(--space-2) var(--space-2) var(--space-2) var(--space-4); font-weight:600;
}
.ps-remove{
  background:transparent; border:none; color:var(--text-dim);
  font-size:var(--text-xl); line-height:1; cursor:pointer; padding:var(--space-0) var(--space-3);
}
.ps-remove:hover{ color:var(--rod); }
.ps-hint{ font-size:var(--text-xs); color:var(--text-dim); margin:0 0 var(--space-4); min-height:1.1em; }

/* ---------- poengteller (Billeker.scorekeeper) ---------- */
.tally-hint{ color:var(--text-dim); font-size:var(--text-base); margin:var(--space-1) 0 var(--space-4); }
.tally{ display:flex; flex-direction:column; gap:var(--space-2); margin-bottom:var(--space-4); }
.tally-row{
  width:100%; display:flex; align-items:center; justify-content:space-between; gap:var(--space-4);
  background:var(--card); border:var(--border-w) solid var(--line); border-radius:var(--radius-lg);
  padding:var(--space-4); cursor:pointer; color:var(--text); font-family:inherit;
  transition:transform var(--dur-fast) var(--ease), background var(--dur-base) var(--ease);
}
.tally-row:active{ transform:scale(0.98); background:var(--card-hover); }
.tally-row .nm{ font-weight:700; font-size:var(--text-body); }
.tally-row .sc{
  font-family:var(--font-display); font-weight:800; font-size:var(--text-2xl);
  min-width:1.5em; text-align:right;
}

/* ---------- resultatskjerm (Billeker.renderResult) ---------- */
.bk-result-crown{ text-align:center; font-size:var(--text-4xl); }
.bk-result-head{
  text-align:center; font-family:var(--font-display); font-weight:800;
  font-size:var(--text-2xl); margin:var(--space-1) 0 var(--space-0);
}
.bk-result-sub{ text-align:center; color:var(--text-dim); margin-bottom:var(--space-6); }
.bk-rank{ list-style:none; margin:0 0 var(--space-6); padding:0; display:flex; flex-direction:column; gap:var(--space-2); }
.bk-rank li{
  display:flex; align-items:center; gap:var(--space-4);
  background:var(--card); border:var(--border-w) solid var(--line); border-radius:var(--radius-md); padding:var(--space-3) var(--space-4);
}
.bk-rank .pos{ font-family:var(--font-display); font-weight:800; color:var(--text-dim); width:1.4em; }
.bk-rank .nm{ flex:1; font-weight:600; }
.bk-rank .sc{ font-family:var(--font-display); font-weight:800; }
.bk-rank li.first{ border-color:var(--gul); }
.bk-rank li.first .pos{ color:var(--gul); }

/* Kortvarig tallfremhevning etter poenggivning - egen, lengre varighet enn
   standard bevegelse-tokens (dette er en "belønning", ikke UI-tilbakemelding). */
@keyframes bk-flash{ from{ color:var(--gul); transform:scale(1.12); } to{ color:inherit; transform:none; } }

/* ---------- ja/nei-boks (Billeker.confirm) ---------- */
.bk-modal{
  position:fixed; inset:0; z-index:100;
  display:flex; align-items:center; justify-content:center;
  padding:var(--space-6);
  padding-top: calc(var(--space-6) + env(safe-area-inset-top));
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  background:rgba(12,14,19,0.72);
  -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px);
  animation-name:bk-fade; animation-duration:var(--dur-slow); animation-timing-function:var(--ease);
}
@keyframes bk-fade{ from{ opacity:0; } to{ opacity:1; } }
.bk-modal-card{
  background:var(--card); border:var(--border-w) solid var(--line);
  border-radius:var(--radius-xl); padding:var(--space-6) var(--space-5);
  width:100%; max-width:360px;
  box-shadow:var(--shadow-lg);
  animation-name:bk-pop; animation-duration:var(--dur-slow); animation-timing-function:var(--ease);
}
@keyframes bk-pop{ from{ transform:translateY(8px) scale(0.97); opacity:0; } to{ transform:none; opacity:1; } }
.bk-modal-card h2{ font-size:var(--text-md); margin-bottom:var(--space-2); }
.bk-modal-card p{ color:var(--text-dim); margin:0 0 var(--space-5); font-size:var(--text-base); }
.bk-modal-actions{ display:flex; gap:var(--space-2); }
.bk-modal-actions .btn{ flex:1; padding:var(--space-3) var(--space-4); }

@media (max-width:420px){
  .game-title{ font-size:var(--text-xl); }
  .game-name{ font-size:var(--text-body); }
}
