:root {
  --bg: #211918;
  --ink: #fff7ee;
  --muted: #cbb9aa;
  --line: rgba(255, 247, 238, 0.16);
  --panel: rgba(53, 40, 37, 0.74);
  --panel-strong: #fff7ee;
  --rose: #d85772;
  --rose-soft: #ff8aa0;
  --blue: #67a7d8;
  --red: #d85772;
  --gold: #e0a94b;
  --dark: #241817;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
  --version: "v1.2.0";
}

html.theme-light {
  --bg: #efe2ca;
  --ink: #34251c;
  --muted: #806b57;
  --line: rgba(84, 58, 36, 0.16);
  --panel: rgba(255, 245, 226, 0.62);
  --panel-strong: #3a2a1f;
  --rose: #bd6d65;
  --rose-soft: #a87a4b;
  --blue: #8aa9a3;
  --red: #bd6d65;
  --gold: #d1a84f;
  --dark: #fff1d5;
  --shadow: 0 24px 80px rgba(125, 85, 38, 0.24);
}

* { box-sizing: border-box; }

/* ── Estä double-tap zoom mobiililla ── */
* { touch-action: manipulation; }

html {
  height: 100%;
  background-color: var(--bg);
}

/* ── Yhtenäinen tausta: fixed pseudo-elementti kattaa koko näytön ── */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 12%, rgba(216, 87, 114, 0.26), transparent 30%),
    radial-gradient(circle at 82% 18%, rgba(103, 167, 216, 0.2), transparent 34%),
    radial-gradient(circle at 50% 88%, rgba(224, 169, 75, 0.16), transparent 35%),
    linear-gradient(180deg, #3a2926 0%, #211918 54%, #181312 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

html.theme-light::before {
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 216, 132, 0.44), transparent 30%),
    radial-gradient(circle at 86% 18%, rgba(177, 199, 187, 0.42), transparent 34%),
    radial-gradient(circle at 48% 68%, rgba(216, 142, 112, 0.22), transparent 38%),
    radial-gradient(circle at 50% 105%, rgba(191, 140, 58, 0.28), transparent 42%),
    linear-gradient(180deg, #f7ead2 0%, #efe2ca 48%, #dfc79f 100%);
  filter: saturate(1.04);
  background-size: 100% 100%;
}

html.theme-light::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 245, 222, 0.18), rgba(126, 83, 34, 0.08));
  backdrop-filter: blur(12px);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background-color: transparent; /* käytetään html::before taustaa */
  position: relative;
  overflow-x: hidden;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.appShell {
  width: min(100% - 28px, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 28px 0;
}

.screen {
  width: 100%;
  display: grid;
  gap: 22px;
}

.is-hidden {
  display: none !important;
}

.screen-menu {
  grid-template-columns: minmax(0, 0.95fr) minmax(340px, 1.05fr);
  gap: 60px;
  align-items: end;
}

.screen-menu .modeGrid {
  grid-column: 2;
  grid-row: 1 / span 3;
}

.screen-game {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  align-items: stretch;
}

.screen-game .gameHeader,
.screen-game .statusPanel,
.screen-game .actionRow {
  grid-column: 1;
}

.screen-game .cardStage {
  grid-column: 2;
  grid-row: 1 / span 3;
}

.screen-setup {
  width: min(100%, 920px);
  margin: 0 auto;
}

.topBar,
.gameHeader,
.screenHeader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.screenHeader,
.gameHeader {
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rose-soft);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(52px, 10vw, 104px);
}

h2 {
  font-size: clamp(30px, 5.8vw, 54px);
}

#gameTitle {
  font-size: clamp(20px, 3.2vw, 36px);
  max-width: 220px;
}

.intro {
  max-width: 610px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1.45;
}

.menuControls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.compactSwitch {
  display: flex;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 247, 238, 0.06);
  padding: 3px;
}

.compactBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  transition: background 140ms ease, color 140ms ease;
}

.compactBtn svg {
  display: block;
}

.compactBtn.is-active,
.compactBtn:hover {
  background: rgba(255, 247, 238, 0.18);
  color: var(--ink);
}

/* ── Hampurilaisvalikko ── */
.hamburgerBtn {
  width: 36px;
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 247, 238, 0.06);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 140ms;
}
.hamburgerBtn:hover { background: rgba(255, 247, 238, 0.14); }
.hamburgerBtn span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

.sideMenu {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100%;
  z-index: 310;
  background: var(--bg);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 0;
  transition: right 260ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.3);
}
.sideMenu.is-open { right: 0; }

.sideMenuOverlay {
  position: fixed;
  inset: 0;
  z-index: 309;
  background: rgba(0,0,0,0.44);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms;
}
.sideMenuOverlay.is-open { opacity: 1; pointer-events: auto; }

.sideMenuHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.sideMenuHeader .sideMenuTitle {
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sideMenuClose {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--muted);
  font-size: 20px; cursor: pointer;
}

.sideMenuNav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  overflow-y: auto;
}
.sideMenuLink {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background 120ms;
  text-decoration: none;
}
.sideMenuLink:hover { background: rgba(255,247,238,0.08); }
.sideMenuLink svg { opacity: 0.55; flex-shrink: 0; }

.sideMenuDivider {
  height: 1px;
  background: var(--line);
  margin: 6px 16px;
}

/* Feedback dropdown in sidemenu */
.sideMenuDropdown { position: relative; }
.sideMenuDropdownToggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  padding: 13px 20px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms;
}
.sideMenuDropdownToggle:hover { background: rgba(255,247,238,0.08); }
.sideMenuDropdownToggle .dropArrow {
  font-size: 11px;
  color: var(--muted);
  transition: transform 160ms;
}
.sideMenuDropdown.is-open .dropArrow { transform: rotate(180deg); }
.sideMenuDropdownPanel {
  display: none;
  flex-direction: column;
  background: rgba(255,247,238,0.04);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.sideMenuDropdown.is-open .sideMenuDropdownPanel { display: flex; }
.dropdownItem {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px 11px 36px;
  border: 0; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 700;
  cursor: pointer; text-align: left; transition: background 120ms, color 120ms;
}
.dropdownItem:hover { background: rgba(255,247,238,0.06); color: var(--ink); }

.sideMenuFooter {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

/* ── UKK ja Meistä sivut ── */
.pageMask {
  position: fixed;
  inset: 0;
  z-index: 180;
  background: var(--bg);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
}
.pageMask::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: inherit;
}
html::before { z-index: -2; }
.pageMask.is-open { transform: translateX(0); }

.pageInner {
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}
.pageBack {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 700; cursor: pointer;
  margin-bottom: 28px; padding: 0;
}
.pageBack:hover { color: var(--ink); }
.pageTitle {
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 900;
  margin: 0 0 24px;
  color: var(--ink);
}
.pageSection {
  margin-bottom: 32px;
}
.pageSection h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--rose-soft);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pageSection p, .pageSection li {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 8px;
}
.pageSection ul { padding-left: 20px; }
.pageSection a { color: var(--blue); text-decoration: underline; }

.faqItem { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 18px; }
.faqQuestion {
  font-size: 16px; font-weight: 800; color: var(--ink); margin: 0 0 6px;
}
.faqAnswer { font-size: 15px; color: var(--muted); line-height: 1.6; margin: 0; }

.pageBtn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border: 0; border-radius: 8px;
  background: var(--rose); color: #fff;
  font-size: 14px; font-weight: 900; cursor: pointer;
  margin-top: 8px;
}
.pageBtn:hover { opacity: 0.85; }

.coinGameScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  text-align: center;

  gap: 22px;
  padding: 20px 0;
}

/* ── Copyright ── */
.copyrightBar {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
}

/* ── Modebutton telepathy + coin ── */
.modeGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.modeButton {
  min-height: 250px;
  display: grid;
  align-content: end;
  gap: 10px;
  border: 1px solid rgba(255, 247, 238, 0.16);
  border-radius: 8px;
  padding: 22px;
  position: relative;
  text-align: left;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(22, 16, 15, 0.1), rgba(22, 16, 15, 0.72)),
    linear-gradient(135deg, #386fa4, #b9425d);
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.modeButton:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 247, 238, 0.34);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
}

.modeButton-spicy {
  background:
    linear-gradient(160deg, rgba(22, 16, 15, 0.08), rgba(22, 16, 15, 0.78)),
    linear-gradient(135deg, #e0a94b, #d85772 58%, #842c41);
}

.modeButton-either {
  background:
    linear-gradient(160deg, rgba(22, 16, 15, 0.08), rgba(22, 16, 15, 0.74)),
    linear-gradient(135deg, #67a7d8, #e0a94b 48%, #d85772);
}

.modeButton-light {
  color: #2a211c;
  background:
    linear-gradient(160deg, rgba(255, 250, 236, 0.28), rgba(255, 235, 194, 0.68)),
    linear-gradient(135deg, #f7d47b, #c3d4c6 48%, #e8ad8e);
  border-color: rgba(84, 58, 36, 0.14);
}

.modeButton-light .modeCopy {
  color: rgba(42, 33, 28, 0.74);
}

.modeButton-telepathy {
  background:
    linear-gradient(160deg, rgba(255, 250, 236, 0.26), rgba(220, 236, 219, 0.7)),
    linear-gradient(135deg, #d8edcf, #b9d7dc 48%, #f2d9b1);
}

.modeButton-coin {
  color: #2a1c10;
  background:
    linear-gradient(160deg, rgba(255,248,230,0.3), rgba(255,238,198,0.72)),
    linear-gradient(135deg, #f7c84b, #e89060 48%, #d85772);
  border-color: rgba(120, 70, 20, 0.16);
}
.modeButton-coin .modeCopy { color: rgba(42,28,16,0.72); }

.modeKicker {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.modeTitle {
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
}

.modeCopy {
  max-width: 300px;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.35;
}

.helperText {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.scrollHint {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 247, 238, 0.18);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--ink);
  background: rgba(255, 247, 238, 0.1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  font-weight: 850;
}

.scrollHint::after {
  content: "↓";
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #201615;
  background: var(--panel-strong);
  line-height: 1;
  animation: hintBounce 900ms ease-in-out infinite alternate;
}

.itemGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  max-height: min(55vh, 520px);
  overflow-y: auto;
  padding-right: 4px;
}

.itemChoice {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
  font-weight: 750;
}

.itemChoice input {
  width: 18px;
  height: 18px;
  accent-color: var(--rose);
}

.iconButton {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 247, 238, 0.08);
  font-size: 26px;
  font-weight: 800;
}

.statusPanel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.turnRow,
.progressMeta,
.actionRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.turnPill {
  min-width: 0;
  flex: 1;
  border: 1px solid rgba(103, 167, 216, 0.34);
  border-radius: 999px;
  padding: 9px 12px;
  color: #d6efff;
  background: rgba(103, 167, 216, 0.12);
  text-align: center;
  font-size: 14px;
  font-weight: 850;
  opacity: 0.55;
}

html.theme-light .turnPill,
html.theme-light .turnPill-red {
  color: #201615;
}

.turnPill-red {
  border-color: rgba(216, 87, 114, 0.38);
  color: #ffdbe2;
  background: rgba(216, 87, 114, 0.13);
}

.turnPill.is-active {
  opacity: 1;
  box-shadow: 0 0 0 4px rgba(255, 247, 238, 0.08);
}

.progressMeta {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.progressTrack {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 247, 238, 0.12);
}

.progressFill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--rose), var(--gold));
  transition: width 220ms ease;
}

.cardStage {
  min-height: clamp(360px, 64vh, 660px);
  display: grid;
}

.emptyCard,
.playCard {
  min-height: clamp(360px, 64vh, 660px);
  display: grid;
  align-content: center;
  gap: 18px;
  border-radius: 8px;
  padding: clamp(18px, 5vw, 38px);
  background: rgba(255, 247, 238, 0.08);
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
}

html.theme-light .emptyCard {
  background: rgba(255, 245, 226, 0.34);
  backdrop-filter: blur(16px);
}

.playCard {
  color: #fff;
  background:
    linear-gradient(160deg, rgba(34, 27, 24, 0.04), rgba(34, 27, 24, 0.35)),
    linear-gradient(135deg, #386fa4, #b9425d);
}

.playCard.level-medium {
  background:
    linear-gradient(160deg, rgba(34, 27, 24, 0.04), rgba(34, 27, 24, 0.42)),
    linear-gradient(135deg, #d89d37, #b9425d);
}

.playCard.level-wild,
.playCard.level-joker {
  background:
    linear-gradient(160deg, rgba(34, 27, 24, 0.04), rgba(34, 27, 24, 0.48)),
    linear-gradient(135deg, #842c41, #b9425d, #d89d37);
}

html.theme-light .playCard {
  color: #2a211c;
  background:
    linear-gradient(160deg, rgba(255, 250, 236, 0.38), rgba(255, 238, 202, 0.68)),
    linear-gradient(135deg, #f8dc94, #cad8c8 52%, #e7b091);
  border: 1px solid rgba(84, 58, 36, 0.12);
  backdrop-filter: blur(18px);
}

html.theme-light .playCard.level-medium {
  background:
    linear-gradient(160deg, rgba(255, 249, 232, 0.34), rgba(255, 232, 190, 0.7)),
    linear-gradient(135deg, #e7bf66, #c9d5c4);
}

html.theme-light .playCard.level-wild {
  background:
    linear-gradient(160deg, rgba(255, 245, 220, 0.28), rgba(255, 228, 185, 0.68)),
    linear-gradient(135deg, #c9953e, #e3a988, #b4c9be);
}

.cardStack {
  position: relative;
  display: grid;
  min-height: clamp(440px, 70vh, 660px);
  isolation: isolate;
}

.cardStack .playCard {
  position: relative;
  z-index: 2;
}

.cardStack.has-joker {
  position: relative;
}

.cardStack.has-joker .playCard {
  transform: translateY(0);
}

.cardStack.joker-peeking .jokerCard {
  animation: jokerPeek 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.cardStack.joker-revealed .playCard {
  z-index: 1;
  animation: cardPop 500ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.cardStack.joker-revealed .jokerCard {
  z-index: 2;
  animation: jokerPop 500ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.jokerCard {
  position: absolute;
  top: 0;
  left: clamp(14px, 4vw, 38px);
  right: clamp(14px, 4vw, 38px);
  bottom: 0;
  z-index: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 218, 135, 0.34);
  border-radius: 8px;
  padding: 22px;
  color: #fff7ee;
  text-align: center;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 222, 128, 0.32), transparent 30%),
    linear-gradient(135deg, #3a1719, #8b2f3e 54%, #d58a32);
  box-shadow: 0 22px 55px rgba(216, 87, 114, 0.24);
  transform: translateY(0) scale(1) rotateX(0deg) rotateZ(0deg);
  transform-origin: center bottom;
  opacity: 1;
  overflow: hidden;
  height: auto;
  min-height: 100%;
}

.jokerCard strong {
  font-size: clamp(16px, 3vw, 28px);
  line-height: 1.13;
  font-weight: 900;
}

.jokerCard span {
  font-size: clamp(16px, 3vw, 28px);
  line-height: 1.2;
  font-weight: 850;
}

.jokerCard-hidden {
  clip-path: inset(calc(100% - 32px) 0 0 0);
  animation: none;
}

.flameMark {
  width: 30px;
  height: 42px;
  border-radius: 55%;
  background:
    radial-gradient(circle at 50% 72%, #fff1a6 0 18%, transparent 19%),
    radial-gradient(circle at 48% 64%, #ffb13d 0 38%, transparent 39%),
    linear-gradient(160deg, #ff4e64 20%, #ff9e35 74%);
  transform: rotate(8deg);
  filter: drop-shadow(0 0 18px rgba(255, 160, 53, 0.72));
  animation: flamePulse 820ms ease-in-out infinite alternate;
}

@keyframes jokerPeek {
  from {
    clip-path: inset(calc(100% - 32px) 0 0 0);
    transform: rotateZ(-15deg);
    transform-origin: right bottom;
  }
  to {
    clip-path: inset(calc(100% - 120px) 0 0 0);
    transform: rotateZ(-8deg);
    transform-origin: right bottom;
  }
}

@keyframes jokerPop {
  from {
    clip-path: inset(calc(100% - 120px) 0 0 0);
    transform: rotateZ(-8deg) translateY(40px) scale(0.95);
    transform-origin: center bottom;
  }
  to {
    clip-path: inset(0 0 0 0);
    transform: rotateZ(0deg) translateY(0) scale(1);
    transform-origin: center center;
  }
}

@keyframes cardPop {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(-20px) scale(1.02);
  }
}

@keyframes flamePulse {
  from { transform: rotate(5deg) scale(0.94); }
  to { transform: rotate(-5deg) scale(1.08); }
}

@keyframes hintBounce {
  from { transform: translateY(-1px); }
  to { transform: translateY(2px); }
}

.cardLevel {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.cardId {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(0,0,0,0.18);
  user-select: none;
  pointer-events: none;
}

.cardText {
  margin: 0;
  font-size: clamp(24px, 4.2vw, 42px);
  font-weight: 850;
  line-height: 1.13;
}

.eitherStage {
  display: grid;
  gap: 14px;
}

.eitherPrompt,
.scoreNotice,
.winnerText {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
  font-weight: 800;
}

.choiceGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.choiceCard {
  min-height: clamp(320px, 52vh, 560px);
  display: grid;
  align-content: center;
  gap: 18px;
  border: 1px solid rgba(255, 247, 238, 0.18);
  border-radius: 8px;
  padding: clamp(16px, 3vw, 28px);
  color: #fff;
  background:
    linear-gradient(160deg, rgba(34, 27, 24, 0.04), rgba(34, 27, 24, 0.35)),
    linear-gradient(135deg, #386fa4, #b9425d);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.choiceCard:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 247, 238, 0.36);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
}

.choiceCard.level-medium {
  background:
    linear-gradient(160deg, rgba(34, 27, 24, 0.04), rgba(34, 27, 24, 0.42)),
    linear-gradient(135deg, #d89d37, #b9425d);
}

.choiceCard.level-wild {
  background:
    linear-gradient(160deg, rgba(34, 27, 24, 0.04), rgba(34, 27, 24, 0.48)),
    linear-gradient(135deg, #842c41, #b9425d, #d89d37);
}

.choiceText {
  font-size: clamp(20px, 3.4vw, 34px);
  font-weight: 850;
  line-height: 1.14;
}

.choiceAction {
  width: fit-content;
  border-radius: 999px;
  padding: 9px 12px;
  color: #201615;
  background: #fff7ee;
  font-size: 13px;
  font-weight: 900;
}

.telepathyStage {
  gap: 16px;
}

.telepathyCard {
  gap: 14px;
}

.telepathyLabel {
  font-weight: 800;
}

.telepathyInput {
  width: 100%;
  border: 1px solid rgba(255, 247, 238, 0.36);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.2);
  font: inherit;
  resize: vertical;
}

.telepathyRevealRow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.telepathyAnswer {
  font-weight: 800;
  text-align: center;
  opacity: 0;
  min-height: 1.4em;
}

.telepathyAnswer.is-visible {
  opacity: 1;
}

.telepathyActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.telepathyRevealRow .smallButton {
  min-width: 180px;
}

.telepathyFinalCard {
  text-align: center;
  justify-items: center;
}

.telepathyFinalCard .cardText {
  font-size: clamp(26px, 4.5vw, 40px);
}

.telepathyFeedbackCard {
  text-align: center;
  justify-items: center;
  transition: background 180ms ease, transform 180ms ease;
}

.telepathyFeedbackCard .cardText {
  font-size: clamp(30px, 6vw, 44px);
}

.telepathyFeedbackAnswer {
  max-width: min(620px, 100%);
  font-size: clamp(18px, 3.2vw, 24px);
}

.telepathyFeedbackCard .smallButton {
  min-width: 160px;
}

.telepathyFeedbackCard-correct {
  color: #eaf9ef;
  background:
    linear-gradient(160deg, rgba(16, 74, 33, 0.22), rgba(14, 48, 23, 0.44)),
    linear-gradient(135deg, #45b66d, #2e8f54);
}

.telepathyFeedbackCard-wrong {
  color: #fff0f0;
  background:
    linear-gradient(160deg, rgba(104, 22, 22, 0.24), rgba(66, 16, 16, 0.46)),
    linear-gradient(135deg, #d45858, #a63838);
}

html.theme-light .telepathyFeedbackCard-correct {
  color: #1d3f2b;
  background:
    linear-gradient(160deg, rgba(221, 243, 225, 0.88), rgba(186, 227, 198, 0.95)),
    linear-gradient(135deg, #cdeecf, #a9dfb7);
}

html.theme-light .telepathyFeedbackCard-wrong {
  color: #4b1f1f;
  background:
    linear-gradient(160deg, rgba(248, 223, 223, 0.9), rgba(243, 197, 197, 0.96)),
    linear-gradient(135deg, #f1d1d1, #e7b1b1);
}

.timerBox {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.12);
}

.timerDisplay {
  font-size: 32px;
  font-weight: 900;
}

.primaryButton,
.secondaryButton,
.smallButton {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 900;
}

.primaryButton {
  color: #fff;
  background: var(--rose);
}

html.theme-light .primaryButton {
  color: #fffaf2;
}

.secondaryButton,
.smallButton {
  color: #201615;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 247, 238, 0.28);
}

html.theme-light .secondaryButton,
html.theme-light .smallButton {
  color: #fffaf2;
}

.smallButton {
  min-height: 42px;
}

.actionRow .primaryButton,
.actionRow .secondaryButton {
  flex: 1;
}

.rulesDialog {
  width: min(100% - 28px, 560px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  color: #201615;
  background: #fff7ee;
  box-shadow: var(--shadow);
}

.rulesDialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.dialogClose {
  float: right;
  color: #201615;
  background: rgba(32, 22, 21, 0.08);
}

.rulesDialog li {
  margin: 0 0 10px;
  line-height: 1.5;
}

/* ── Feedback FAB ── */
.feedbackFab {
  position: fixed;
  right: 18px;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 40px);
  display: flex;
  flex-direction: row;
  gap: 8px;
  z-index: 40;
}

.feedbackButton {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 999px;
  background: #fffce3;
  color: #000000;
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  font-weight: 900;
}

html.theme-light .feedbackButton {
  background: #fffce3;
  color: #201615;
}

.feedbackChoiceDialog {
  width: min(100% - 28px, 360px);
}

.feedbackChoiceActions {
  display: grid;
  gap: 10px;
}

/* ── Suostumusdialogi ── */
.consentBox {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255,247,238,0.06);
  margin: 12px 0 8px;
  font-size: 13px;
  color: #4a3830;
  line-height: 1.55;
}
.consentBox a { color: #b05565; text-decoration: underline; }
.consentCheckRow {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 8px;
}
.consentCheckRow input[type="checkbox"] {
  width: 16px; height: 16px; margin-top: 2px; accent-color: var(--rose); flex-shrink: 0;
}
.consentCheckRow label { font-size: 13px; color: #4a3830; line-height: 1.4; }

@media (max-width: 780px) {
  .appShell {
    width: min(100% - 24px, 1120px);
    align-items: start;
    min-height: 100svh;
    padding: 16px 0 22px;
  }

  .screen-menu,
  .screen-game {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .screen-game {
    display: flex;
    flex-direction: column;
    min-height: calc(100svh - 38px);
  }

  .screen-menu .topBar,
  .screen-menu .intro,
  .screen-menu .modeGrid,
  .screen-game .gameHeader,
  .screen-game .statusPanel,
  .screen-game .actionRow,
  .screen-game .cardStage {
    grid-column: auto;
    grid-row: auto;
  }

  .topBar,
  .modeGrid,
  .actionRow {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topBar {
    gap: 14px;
    align-items: stretch;
  }

  .gameHeader,
  .screenHeader {
    gap: 12px;
  }

  .intro {
    font-size: 17px;
    line-height: 1.45;
  }

  .modeButton {
    min-height: 132px;
    padding: 16px;
  }

  .modeTitle {
    font-size: 30px;
  }

  .modeCopy {
    max-width: none;
  }

  .helperText {
    font-size: 15px;
  }

  .menuControls {
    gap: 6px;
  }

  .screen-setup {
    gap: 14px;
  }

  .itemGrid {
    grid-template-columns: 1fr;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .itemChoice {
    min-height: 48px;
    padding: 11px 12px;
  }

  .cardStage {
    min-height: auto;
    display: block;
    flex: 0 0 auto;
  }

  .screen-game .cardStage {
    flex: 1;
    min-height: clamp(240px, 46svh, 390px);
  }

  .emptyCard,
  .playCard {
    min-height: clamp(240px, 46svh, 390px);
    padding: 18px;
  }

  .cardStack,
  .cardStack.has-joker {
    width: 100%;
    min-height: clamp(240px, 46svh, 390px);
    padding-bottom: 0;
  }

  .cardText,
  .choiceText,
  .jokerCard strong,
  .jokerCard span {
    font-size: clamp(22px, 6.2vw, 34px);
  }

  .choiceGrid {
    grid-template-columns: 1fr;
  }

  .choiceCard {
    min-height: 210px;
  }

  .actionRow {
    gap: 10px;
    grid-template-columns: 1fr 1fr;
    position: sticky;
    bottom: 0;
    z-index: 30;
    margin: 0 -12px;
    padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  }

  .actionRow .primaryButton {
    order: -1;
  }

  .telepathyActions {
    grid-template-columns: 1fr;
  }

  .telepathyRevealRow .smallButton {
    width: 100%;
    max-width: 260px;
  }

  .scrollHint {
    position: sticky;
    top: 8px;
    z-index: 20;
    max-width: 100%;
    margin: -2px 0 0;
    backdrop-filter: blur(12px);
  }

  .primaryButton,
  .secondaryButton,
  .smallButton {
    min-height: 48px;
  }

  .rulesDialog {
    width: min(100% - 24px, 560px);
    max-height: calc(100svh - 24px);
    padding: 22px;
  }

  .sideMenu { width: 280px; }
}

@media (max-width: 430px) {
  .appShell {
    width: min(100% - 20px, 1120px);
    padding: 12px 0 18px;
  }

  .screen {
    gap: 12px;
  }

  .turnRow {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .statusPanel {
    gap: 10px;
    padding: 12px;
  }

  .progressMeta {
    align-items: flex-start;
    font-size: 13px;
  }

  .cardText,
  .choiceText,
  .jokerCard strong,
  .jokerCard span {
    font-size: clamp(20px, 6.6vw, 28px);
  }

  .choiceCard {
    min-height: 190px;
    gap: 14px;
  }

  .emptyCard,
  .playCard,
  .cardStack,
  .cardStack.has-joker {
    min-height: clamp(220px, 42svh, 330px);
  }

  .emptyCard,
  .playCard {
    gap: 14px;
    padding: 16px;
  }

  .timerBox {
    padding: 12px;
  }

  .timerDisplay {
    font-size: 28px;
  }

  .actionRow {
    margin: 0 -10px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .modeButton {
    min-height: 118px;
  }

  h1 {
    font-size: clamp(34px, 12vw, 52px);
  }

  h2 {
    font-size: clamp(24px, 7.4vw, 34px);
    line-height: 1.05;
  }
}

@media (max-width: 360px) {
  .turnPill {
    padding-inline: 8px;
    font-size: 13px;
  }

  .iconButton {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .modeTitle {
    font-size: 27px;
  }
}

/* Desktop */
@media (min-width: 768px) {
  .menuControls {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 10px;
  }
}

/* ═══════════════════════════════
   TOTUUS TAI TEHTÄVÄ - KOLIKKO
═══════════════════════════════ */

.coinWrap {
  perspective: 1200px;
  cursor: pointer;
  width: 220px;
  height: 220px;
  margin: 0 auto;

  display: flex;
  align-items: center;
  justify-content: center;
}

.coin {
  width: 220px;
  height: 220px;
  display: block;
  position: relative;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(.2,.8,.2,1);
  will-change: transform;
}

.coinFace {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;

  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;

  user-select: none;
}

.coinFace-truth {
  background:
    radial-gradient(circle at top, #ffe27a, #d4a017);
  color: #2a1b00;

  transform: rotateY(0deg);
}

.coinFace-dare {
  background:
    radial-gradient(circle at top, #ff9fa8, #d14a5c);
  color: white;

  transform: rotateY(180deg);
}

.truth-result {
  color: var(--gold);
}

.dare-result {
  color: var(--rose-soft);
}

.newBadge {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #ff3d6b;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  box-shadow: 0 4px 16px rgba(255, 61, 107, 0.45);
  animation: badgePulse 1.8s ease-in-out infinite;

}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(255, 61, 107, 0.45); }
  50% { box-shadow: 0 2px 20px rgba(255, 61, 107, 0.9), 0 0 30px rgba(255, 61, 107, 0.4); }
} 

@media (max-width: 780px) {
  .screen-menu {
    padding-bottom: 80px;
  }
}

html.theme-light img[src="couplesdeck_logo_dark.png"] {
  content: url("couplesdeck_logo.svg");  /* sama tiedosto! */
}

#menuTitle {
  color: #ffffff;
}

html.theme-light #menuTitle {
  color: #000000;
}

html {
  min-height: 100%;
  background: var(--bg);
}

.logoWrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  transform: translateX(-10px);
}

.logoImg {
  height: 300px;
  width: auto;
  margin-top: -70px;
  margin-bottom: -70px;
  pointer-events: none;
  transition: transform 0.2s ease;
}

@media (min-width: 781px) {
  .logoImg {
    height: 640px;
    margin-right: 0px;
    margin-bottom: 0px;
  }
}

.logoImg:hover {
  transform: translateY(-70px) scale(1.02);
}

@media (max-width: 768px) {
  .screen-menu {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .screen-menu .modeGrid {
    grid-column: auto;
    grid-row: auto;
  }
}