:root {
  --cream: #fbe6c2;
  --cream-2: #f6d9a8;
  --wood-1: #c06a32;
  --wood-2: #9c4e22;
  --wood-3: #6e3112;
  --wood-dark: #451a08;
  --ink: #3a1d0c;
  --paper: #fdf4e3;
  --paper-2: #f3e3c4;
  --accent: #f0972f;
  --green-btn: #3aa75a;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --slot: clamp(40px, min(13.5vw, 8.4vh), 84px);
}

/* Háttér témák (posztó) */
#app { --felt-a: #12754c; --felt-b: #0d4f3b; --felt-c: #102a2b; --felt-glow: rgba(60, 200, 130, .25); }
#app[data-theme="blue"] { --felt-a: #2b7fc0; --felt-b: #1a5a92; --felt-c: #0e3560; --felt-glow: rgba(120, 190, 255, .28); }
#app[data-theme="purple"] { --felt-a: #7b5bb5; --felt-b: #553d8a; --felt-c: #33245a; --felt-glow: rgba(200, 170, 255, .25); }
#app[data-theme="red"] { --felt-a: #b5473a; --felt-b: #8a2e25; --felt-c: #561a15; --felt-glow: rgba(255, 170, 140, .25); }
#app[data-theme="wood"] { --felt-a: #a8743f; --felt-b: #7b5129; --felt-c: #4e3218; --felt-glow: rgba(255, 220, 160, .22); }

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b4a3b;
  font-family: 'Fredoka', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--cream);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
svg { display: block; }

#app {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(90% 60% at 18% 12%, var(--felt-glow), transparent 60%),
    radial-gradient(70% 50% at 85% 95%, rgba(0, 0, 0, .25), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Cpath d='M0 0h1v1H0zM3 3h1v1H3z' fill='%23000' fill-opacity='.06'/%3E%3C/svg%3E"),
    linear-gradient(165deg, var(--felt-a) 0%, var(--felt-b) 45%, var(--felt-c) 100%);
}
/* halvány bambuszlevelek a háttérben */
#app::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .05;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cg fill='%23000'%3E%3Cpath d='M10 60c40-30 90-30 120-10-40 0-80 5-120 10z'/%3E%3Cpath d='M20 100c35-35 80-45 115-35-35 8-75 20-115 35z'/%3E%3Cpath d='M0 140c30-25 70-35 105-30-30 8-65 18-105 30z'/%3E%3Cpath d='M60 20 66 190' stroke='%23000' stroke-width='3' fill='none'/%3E%3C/g%3E%3C/svg%3E") no-repeat -40px 120px / 260px 260px,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cg fill='%23000'%3E%3Cpath d='M190 50c-40-30-90-30-120-10 40 0 80 5 120 10z'/%3E%3Cpath d='M180 95c-35-35-80-45-115-35 35 8 75 20 115 35z'/%3E%3C/g%3E%3C/svg%3E") no-repeat right -30px bottom 80px / 240px 240px;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: stretch;
}
.screen.active { display: flex; }

/* ---------- fa fejléc ---------- */
.wood-banner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(var(--safe-t) + 12px) 14px 14px;
  min-height: calc(var(--safe-t) + 84px);
  background:
    repeating-linear-gradient(176deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(183deg, rgba(0, 0, 0, .07) 0 3px, transparent 3px 14px),
    linear-gradient(180deg, #c8743a 0%, #a85424 60%, #8e4319 100%);
  border-bottom: 4px solid #6e3112;
  box-shadow: 0 3px 0 #c98a4f inset, 0 6px 16px rgba(0, 0, 0, .35);
}
.wood-banner h1 {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: clamp(30px, 8.5vw, 44px);
  font-weight: 700;
  color: var(--cream);
  letter-spacing: .5px;
  text-shadow: 0 3px 0 #6e3112, 0 5px 8px rgba(0, 0, 0, .35);
}

/* ---------- kerek fa gombok ---------- */
.wbtn {
  position: relative;
  width: 68px;
  height: 68px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fbe0b6;
  background: radial-gradient(circle at 50% 38%, #8c4621 0%, #6a2e12 55%, #521f0a 100%);
  box-shadow:
    0 0 0 4px #b8692f,
    0 0 0 6px #6e3112,
    0 5px 0 6px #3f1706,
    0 9px 14px 6px rgba(0, 0, 0, .35);
  transition: transform .08s;
}
.wbtn svg { width: 46%; height: 46%; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)); }
.wbtn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wbtn:active { transform: translateY(3px) scale(.97); }
.wbtn.sm {
  width: 46px;
  height: 46px;
  box-shadow: 0 0 0 3px #b8692f, 0 0 0 5px #6e3112, 0 4px 0 5px #3f1706, 0 6px 10px 5px rgba(0, 0, 0, .3);
}
.wbtn:disabled { opacity: .45; }
.wbtn.pulse { animation: wpulse 1s ease-in-out 3; }
@keyframes wpulse { 50% { transform: scale(1.14); box-shadow: 0 0 0 4px #ffd34d, 0 0 0 6px #6e3112, 0 0 22px 10px rgba(255, 210, 80, .7); } }
.wbtn-spacer { width: 46px; flex: none; }

/* ---------- általános gombok ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 20px;
  padding: 14px 26px;
  font-weight: 700;
  font-size: 22px;
  color: #fff8ec;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .25);
  transition: transform .08s, filter .15s;
}
.btn:active { transform: translateY(3px); }
.btn-orange {
  background: linear-gradient(180deg, #ffb655 0%, #f28a2a 55%, #e06d16 100%);
  box-shadow: 0 2px 0 rgba(255, 255, 255, .5) inset, 0 6px 0 #a5450d, 0 10px 16px rgba(0, 0, 0, .3);
}
.btn-green {
  background: linear-gradient(180deg, #6fd389 0%, #3db15e 55%, #2a9449 100%);
  box-shadow: 0 2px 0 rgba(255, 255, 255, .45) inset, 0 6px 0 #1b6a33, 0 10px 16px rgba(0, 0, 0, .3);
}
.btn-wood {
  background: linear-gradient(180deg, #c8743a, #9c4e22);
  box-shadow: 0 2px 0 rgba(255, 255, 255, .3) inset, 0 6px 0 #5a250c, 0 10px 16px rgba(0, 0, 0, .3);
}
.btn-gray {
  color: var(--ink);
  text-shadow: none;
  background: linear-gradient(180deg, #fff, #e9dcc4);
  box-shadow: 0 6px 0 #bca57f, 0 10px 14px rgba(0, 0, 0, .2);
}
.btn-big { width: 100%; font-size: 26px; padding: 16px 20px; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 19px;
  font-weight: 600;
  color: var(--cream);
  opacity: .9;
}
.link-btn svg { width: 22px; height: 22px; }

/* ---------- üdvözlő & főmenü ---------- */
.welcome-body, .home-body, .daily-body {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 22px calc(var(--safe-b) + 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  overflow-y: auto;
}
.deco-tiles { display: flex; justify-content: center; gap: 0; height: clamp(96px, min(22vh, 30vw), 170px); margin-bottom: 6px; }
.deco-tile {
  position: relative;
  height: 100%;
  aspect-ratio: 1 / 1.29;
  margin: 0 -6px;
}
.deco-tile .face { position: absolute; }
.deco-tile:nth-child(1) { transform: rotate(-10deg) translateY(10px); }
.deco-tile:nth-child(2) { transform: translateY(-6px); z-index: 2; }
.deco-tile:nth-child(3) { transform: rotate(10deg) translateY(10px); }

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 34vw;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  background: rgba(60, 20, 5, .45);
  box-shadow: inset 0 0 0 2px rgba(255, 220, 170, .35);
  font-size: 17px;
  font-weight: 600;
}
.avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  background: linear-gradient(180deg, #57c27a, #2a8a48);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2);
}
.pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
#screen-home .wood-banner h1 { font-size: clamp(26px, 7vw, 40px); }

.btn-play {
  flex-direction: column;
  gap: 0;
  width: min(100%, 360px);
  padding: 16px 20px 18px;
  border-radius: 26px;
}
.play-label { font-size: 40px; line-height: 1.1; }
.play-level { font-size: 21px; opacity: .95; }
.btn-daily { width: min(100%, 360px); justify-content: flex-start; padding: 14px 22px; text-align: left; }
.btn-daily > svg { width: 40px; height: 40px; flex: none; }
.btn-daily > span { display: flex; flex-direction: column; }
.daily-label { font-size: 24px; }
.daily-date { font-size: 16px; font-weight: 600; opacity: .95; }

.card {
  width: 100%;
  padding: 22px 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  box-shadow: 0 8px 0 #c9a46e, 0 14px 26px rgba(0, 0, 0, .35);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}
.card-title { font-size: 26px; font-weight: 700; text-align: center; }
.text-input {
  width: 100%;
  font: inherit;
  font-size: 24px;
  font-weight: 600;
  padding: 14px 16px;
  border-radius: 16px;
  border: 3px solid #d9b98a;
  background: #fff;
  color: var(--ink);
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.text-input:focus { border-color: var(--accent); }

/* ---------- játék képernyő ---------- */
.g-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--safe-t) + 14px) 16px 4px;
  position: relative;
  z-index: 7000;
}

/* sötétbarna kerek gombok világosbarna gyűrűvel (mint az eredetiben) */
.rbtn {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #f7d49a;
  background: radial-gradient(circle at 50% 35%, #6a2c12 0%, #4a1a08 70%, #3a1205 100%);
  box-shadow: 0 0 0 3px #a8642f, 0 0 0 4.5px #5a240c, 0 5px 10px 3px rgba(0, 0, 0, .35);
  transition: transform .1s, filter .15s;
}
.rbtn svg { width: 52%; height: 52%; filter: drop-shadow(0 1.5px 0 rgba(0, 0, 0, .4)); }
.rbtn.big { width: 64px; height: 64px; }
.rbtn:active { transform: scale(.9); }
.rbtn.bump { animation: bump .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bump { 40% { transform: scale(1.18); } }
.rbtn.empty { filter: saturate(.5) brightness(.8); }
.rbtn.pulse { animation: rpulse 1s ease-in-out 3; }
@keyframes rpulse { 50% { transform: scale(1.14); box-shadow: 0 0 0 3px #ffd34d, 0 0 0 4.5px #5a240c, 0 0 22px 10px rgba(255, 210, 80, .7); } }
.badge {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #e04a35, #b8281a);
  box-shadow: 0 0 0 2px #5a1a08, 0 2px 4px rgba(0, 0, 0, .35);
  font-style: normal;
}
.badge.bump { animation: bump .4s cubic-bezier(.3, 1.6, .5, 1); }

/* pontcsík csillaghatárokkal */
.scorebar { flex: 1; max-width: 290px; padding: 2px 22px 0 6px; }
.sb-labels { position: relative; height: 26px; }
.sb-labels span {
  position: absolute;
  bottom: 2px;
  transform: translateX(-50%);
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: color .3s, transform .3s;
}
.sb-labels span.got { color: #ffd23f; transform: translateX(-50%) scale(1.12); }
#sb-l3 { transform: translateX(-80%); }
#sb-l3.got { transform: translateX(-80%) scale(1.12); }
#sb-l3 svg { width: 24px; height: 24px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .4)); }
#sb-l3 b { font-weight: 600; }
.sb-track {
  position: relative;
  height: 9px;
  border-radius: 999px;
  background: #3a1206;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .5), 0 0 0 1.5px rgba(0, 0, 0, .25);
}
.sb-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #ffc35a, #f5891c);
  box-shadow: 0 0 8px rgba(255, 170, 60, .6);
  transition: width .5s cubic-bezier(.3, 1.2, .5, 1);
}
.sb-mark {
  position: absolute;
  top: -7px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 7px solid #f5a64a;
  transform: translateX(-50%);
}
.sb-mark.got { border-bottom-color: #ffd23f; }

.g-info {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, .7);
  margin-top: 6px;
  position: relative;
  z-index: 7000;
}
.dotsep { margin: 0 6px; opacity: .6; }

/* tálca: arany-narancs belső, szivárványos keret, csillogás */
.tray {
  align-self: center;
  margin-top: 10px;
  padding: 3px;
  border-radius: 11px;
  background: linear-gradient(100deg, #ff6f8e 0%, #ffa04a 30%, #ffe066 55%, #6fe0c4 78%, #3fc8ff 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .45), 0 0 14px rgba(255, 190, 90, .35);
  position: relative;
  z-index: 1;
  transition: box-shadow .3s;
}
.tray-inner {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, #c8650a 0%, #e3880f 45%, #f6a823 100%);
  box-shadow: inset 0 3px 8px rgba(80, 30, 0, .55), inset 0 -2px 6px rgba(255, 230, 150, .5);
}
.tray-slots {
  display: grid;
  grid-template-columns: repeat(4, var(--slot));
  padding: 3px;
}
.tray-slots i {
  display: block;
  height: calc(var(--slot) * 1.29);
  border-left: 1.5px solid rgba(110, 45, 0, .35);
}
.tray-slots i:first-child { border-left: 0; }
.tw {
  position: absolute;
  left: var(--x);
  bottom: 12%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff6c2;
  box-shadow: 0 0 6px 2px rgba(255, 240, 160, .9);
  opacity: 0;
  animation: twinkle 2.4s ease-in-out var(--d) infinite;
  pointer-events: none;
}
@keyframes twinkle {
  0% { opacity: 0; transform: translateY(0) scale(.5); }
  30% { opacity: 1; transform: translateY(-10px) scale(1); }
  100% { opacity: 0; transform: translateY(-34px) scale(.4); }
}
.tray.warn { animation: trayWarn .9s ease-in-out infinite; }
@keyframes trayWarn {
  50% { box-shadow: 0 6px 14px rgba(0, 0, 0, .45), 0 0 0 3px rgba(255, 70, 50, .9), 0 0 26px 8px rgba(255, 60, 40, .6); }
}
.tray.full { animation: trayShake .5s; }
@keyframes trayShake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.board-area {
  flex: 1;
  margin: 10px 12px 8px;
  min-height: 0;
  position: relative;
}
.g-bottom {
  display: flex;
  justify-content: center;
  gap: clamp(18px, 6.5vw, 44px);
  padding: 12px 0 calc(var(--safe-b) + 22px);
  position: relative;
  z-index: 7000;
}

#tile-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  --cw: 50px;
  --ch: 60px;
}
.tile {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--ch);
  transform-origin: 0 0;
  transition: transform .28s cubic-bezier(.3, .75, .3, 1.08);
  pointer-events: auto;
  cursor: pointer;
}
#tile-layer.instant .tile { transition: none; }
.tile.in-tray, .tile.gone { pointer-events: none; }
.tile.gone { visibility: hidden; }

/* Lap: csontszínű, finoman texturált előlap éles peremmel + folyamatos oldallap (elefántcsont réteg, terrakotta hátlap) */
.face {
  --u: calc(var(--cw) / 100);
  position: absolute;
  left: 0;
  top: 0;
  width: calc(100% - var(--u) * 4.5);
  height: calc(100% - var(--u) * 15);
  border-radius: calc(var(--u) * 9);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .34 0 0 0 0 .26 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(130% 80% at 30% 0%, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(172deg, #f5eee4 0%, #eee5d8 50%, #e5d9c8 100%);
  box-shadow:
    inset 0 0 0 calc(var(--u) * .7) rgba(110, 85, 60, .28),
    inset calc(var(--u) * 1.1) calc(var(--u) * 1.5) 0 rgba(255, 255, 255, .85),
    inset calc(var(--u) * -1.4) calc(var(--u) * -2) calc(var(--u) * 2) rgba(105, 80, 55, .2),
    calc(var(--u) * 0.32) calc(var(--u) * 1.07) 0 #e8decf,
    calc(var(--u) * 0.64) calc(var(--u) * 2.14) 0 #e4d9c9,
    calc(var(--u) * 0.96) calc(var(--u) * 3.21) 0 #e0d4c2,
    calc(var(--u) * 1.29) calc(var(--u) * 4.29) 0 #dbcebb,
    calc(var(--u) * 1.61) calc(var(--u) * 5.36) 0 #d7c9b5,
    calc(var(--u) * 1.93) calc(var(--u) * 6.43) 0 #d3c4ae,
    calc(var(--u) * 2.25) calc(var(--u) * 7.5) 0 #6e4a3a,
    calc(var(--u) * 2.57) calc(var(--u) * 8.57) 0 #c16752,
    calc(var(--u) * 2.89) calc(var(--u) * 9.64) 0 #ba604c,
    calc(var(--u) * 3.21) calc(var(--u) * 10.71) 0 #b25a46,
    calc(var(--u) * 3.54) calc(var(--u) * 11.79) 0 #ab5341,
    calc(var(--u) * 3.86) calc(var(--u) * 12.86) 0 #a34d3b,
    calc(var(--u) * 4.18) calc(var(--u) * 13.93) 0 #9c4635,
    calc(var(--u) * 4.5) calc(var(--u) * 15.0) 0 #94402f,
    calc(var(--u) * 5) calc(var(--u) * 16.5) calc(var(--u) * 2.5) rgba(5, 12, 10, .55),
    calc(var(--u) * 9) calc(var(--u) * 24) calc(var(--u) * 15) rgba(5, 12, 10, .38);
}
.face.red {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .34 0 0 0 0 .26 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(130% 80% at 30% 0%, rgba(255, 190, 170, .35) 0%, rgba(255, 190, 170, 0) 60%),
    linear-gradient(172deg, #c9473a 0%, #b53628 55%, #9e2b1f 100%);
  box-shadow:
    inset 0 0 0 calc(var(--u) * .7) rgba(70, 10, 0, .35),
    inset calc(var(--u) * 1.1) calc(var(--u) * 1.5) 0 rgba(255, 190, 170, .45),
    inset calc(var(--u) * -1.4) calc(var(--u) * -2) calc(var(--u) * 2) rgba(60, 5, 0, .3),
    calc(var(--u) * 0.32) calc(var(--u) * 1.07) 0 #e8decf,
    calc(var(--u) * 0.64) calc(var(--u) * 2.14) 0 #e4d9c9,
    calc(var(--u) * 0.96) calc(var(--u) * 3.21) 0 #e0d4c2,
    calc(var(--u) * 1.29) calc(var(--u) * 4.29) 0 #dbcebb,
    calc(var(--u) * 1.61) calc(var(--u) * 5.36) 0 #d7c9b5,
    calc(var(--u) * 1.93) calc(var(--u) * 6.43) 0 #d3c4ae,
    calc(var(--u) * 2.25) calc(var(--u) * 7.5) 0 #6e4a3a,
    calc(var(--u) * 2.57) calc(var(--u) * 8.57) 0 #c16752,
    calc(var(--u) * 2.89) calc(var(--u) * 9.64) 0 #ba604c,
    calc(var(--u) * 3.21) calc(var(--u) * 10.71) 0 #b25a46,
    calc(var(--u) * 3.54) calc(var(--u) * 11.79) 0 #ab5341,
    calc(var(--u) * 3.86) calc(var(--u) * 12.86) 0 #a34d3b,
    calc(var(--u) * 4.18) calc(var(--u) * 13.93) 0 #9c4635,
    calc(var(--u) * 4.5) calc(var(--u) * 15.0) 0 #94402f,
    calc(var(--u) * 5) calc(var(--u) * 16.5) calc(var(--u) * 2.5) rgba(5, 12, 10, .55),
    calc(var(--u) * 9) calc(var(--u) * 24) calc(var(--u) * 15) rgba(5, 12, 10, .38);
}
/* finom fényvisszaverődés a lap felső részén */
.face::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 28%);
  pointer-events: none;
}
.face svg { position: absolute; left: 7%; top: 6%; width: 86%; height: 88%; shape-rendering: geometricPrecision; }
/* takart lap: nem szürke, csak egy árnyalattal sötétebb */
.tile.blocked .face { filter: brightness(.84) saturate(.9); }
.lbl {
  position: absolute;
  left: 7%;
  top: 2%;
  font-size: calc(var(--cw) * .2);
  font-weight: 700;
  color: #222;
  line-height: 1;
}
.face.red .lbl { color: #fff; }
.deco-tile .lbl { display: none; }

/* ---------- lap-animációk ---------- */
/* kezdéskor: felülről beesnek, kis ugrással */
.tile.dealing .face { animation: deal .5s cubic-bezier(.25, 1.4, .45, 1) var(--deal-delay, 0ms) backwards; }
@keyframes deal {
  0% { transform: translateY(-140%) scale(.6) rotate(-8deg); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: none; opacity: 1; }
}
/* felkapás: megemelkedik, majd a tálcába repül */
.tile.lift .face { animation: lift .3s ease-out; }
@keyframes lift {
  0% { transform: scale(1); }
  35% { transform: scale(1.22) rotate(-4deg); filter: brightness(1.08); }
  100% { transform: scale(1); }
}
.tile.land .face { animation: land .26s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes land {
  0% { transform: scale(1.12, .86); }
  100% { transform: none; }
}
.tile.back .face { animation: back .3s ease-out; }
@keyframes back {
  40% { transform: scale(1.15) rotate(8deg); }
  100% { transform: none; }
}
/* párosítás: felfúvódik, felvillan, szétdurran (a darabokat a vászon rajzolja) */
.tile.pop .face { animation: pop .26s cubic-bezier(.5, 0, .9, .4) forwards; }
@keyframes pop {
  0% { transform: scale(1); filter: brightness(1); }
  45% { transform: scale(1.28) rotate(3deg); filter: brightness(1.35); opacity: 1; }
  100% { transform: scale(.15) rotate(-12deg); filter: brightness(2); opacity: 0; }
}
.tile.shake .face { animation: shake .34s; }
@keyframes shake {
  20% { transform: translateX(-6%) rotate(-3deg); }
  40% { transform: translateX(6%) rotate(3deg); }
  60% { transform: translateX(-4%) rotate(-2deg); }
  80% { transform: translateX(3%); }
}
/* a takaró lap felvillan, hogy látszódjon, mi van rajta */
.tile.blocker .face { animation: blocker .5s ease-out; }
@keyframes blocker {
  30% { transform: translateY(-6%) scale(1.06); filter: brightness(1.12); }
}
/* keverés: gyors pörgés, közben arcot vált */
.tile.shuffling .face { animation: spin .55s ease-in-out var(--sh-delay, 0ms) both; }
@keyframes spin {
  0% { transform: none; }
  45% { transform: scale(.35) rotate(200deg); opacity: .6; }
  55% { transform: scale(.35) rotate(220deg); opacity: .6; }
  100% { transform: rotate(360deg); }
}
.tile.magnetized .face { animation: magnet .5s ease-out; }
@keyframes magnet {
  0% { filter: brightness(1.6) drop-shadow(0 0 10px #7fd8ff); }
  100% { filter: none; }
}
.tile.hint .face::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 4px solid #ffd23f;
  box-shadow: 0 0 16px 4px rgba(255, 210, 63, .85);
  animation: glow .6s ease-in-out infinite alternate;
}
.tile.hint .face { animation: hintBob 1.2s ease-in-out infinite; }
@keyframes hintBob { 50% { transform: translateY(-5%); } }
@keyframes glow { from { opacity: .35; } to { opacity: 1; } }

/* lebegő feliratok */
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 8500; }
#fx-text { position: absolute; inset: 0; pointer-events: none; z-index: 8600; overflow: hidden; }
.fx-score {
  position: fixed;
  transform: translate(-50%, -50%);
  font-size: 30px;
  font-weight: 700;
  color: #ffe066;
  text-shadow: 0 2px 0 #9a4a00, 0 0 10px rgba(255, 200, 60, .8);
  animation: floatUp 1s ease-out forwards;
  white-space: nowrap;
}
@keyframes floatUp {
  0% { transform: translate(-50%, -20%) scale(.5); opacity: 0; }
  20% { transform: translate(-50%, -60%) scale(1.25); opacity: 1; }
  100% { transform: translate(-50%, -220%) scale(1); opacity: 0; }
}
.fx-combo {
  position: fixed;
  transform: translate(-50%, -50%);
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #ffe066, #ff9a2e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 #8a3a00) drop-shadow(0 0 12px rgba(255, 160, 40, .7));
  animation: comboPop 1.2s cubic-bezier(.3, 1.5, .5, 1) forwards;
  white-space: nowrap;
}
@keyframes comboPop {
  0% { transform: translate(-50%, -50%) scale(.2) rotate(-10deg); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.25) rotate(3deg); opacity: 1; }
  45% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -110%) scale(1); opacity: 0; }
}
.fx-star {
  position: fixed;
  transform: translate(-50%, -50%);
  font-size: 26px;
  font-weight: 700;
  color: #ffd23f;
  text-shadow: 0 2px 0 #7a4a00;
  animation: comboPop 1.3s cubic-bezier(.3, 1.5, .5, 1) forwards;
  white-space: nowrap;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-b) + 120px);
  transform: translate(-50%, 20px);
  z-index: 8000;
  padding: 12px 20px;
  border-radius: 16px;
  background: rgba(40, 14, 4, .88);
  color: var(--cream);
  font-size: 19px;
  font-weight: 600;
  text-align: center;
  max-width: 88vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- napi kihívás ---------- */
.daily-body { justify-content: flex-start; gap: 14px; }
.trophy { width: 96px; height: 96px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35)); }
.month-nav { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 0 6px; }
.month-title { text-align: center; }
#month-name { font-size: 26px; font-weight: 700; }
.muted { opacity: .85; font-size: 16px; font-weight: 600; }
.cal-head, .cal-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: center;
}
.cal-head span { font-size: 15px; font-weight: 700; opacity: .8; }
.cal-day {
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: clamp(16px, 4.6vw, 21px);
  font-weight: 700;
  color: var(--cream);
  background: rgba(0, 0, 0, .18);
  position: relative;
}
.cal-day.empty { background: none; }
.cal-day.future { opacity: .35; }
.cal-day.done { background: radial-gradient(circle at 50% 35%, #ffe17a, #f2b51c 70%, #c98a0c); color: #6b3a05; box-shadow: 0 3px 0 #a26a07; }
.cal-day.done::after {
  content: '';
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  background: #2a9449 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4 8-9' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
  box-shadow: 0 0 0 2px #fff6dc;
}
.cal-day.today { box-shadow: inset 0 0 0 3px var(--cream); }
.cal-day.sel { background: linear-gradient(180deg, #ffb655, #e06d16); color: #fff; box-shadow: 0 3px 0 #a5450d; }
.cal-day.sel.done { background: radial-gradient(circle at 50% 35%, #ffe17a, #f2b51c 70%, #c98a0c); box-shadow: 0 0 0 4px #fff, 0 3px 0 4px #a26a07; }
#daily-play { max-width: 360px; margin-top: 8px; }

/* ---------- felugró ablak ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 4, 0, .58);
  animation: fadein .18s;
}
.modal[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } }
.modal-card {
  width: min(100%, 420px);
  max-height: calc(100% - 20px);
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink);
  box-shadow: 0 0 0 4px #b8692f, 0 0 0 7px #6e3112, 0 18px 40px rgba(0, 0, 0, .5);
  animation: popin .25s cubic-bezier(.3, 1.4, .5, 1);
}
@keyframes popin { from { transform: scale(.85); opacity: 0; } }
.modal-head {
  padding: 16px 18px 14px;
  background:
    repeating-linear-gradient(176deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #c8743a, #9c4e22);
  border-bottom: 3px solid #6e3112;
}
.modal-head h2 { margin: 0; text-align: center; font-size: 28px; color: var(--cream); text-shadow: 0 2px 0 #6e3112; }
.modal-body { padding: 20px 20px 22px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.modal-body p { margin: 0; text-align: center; font-size: 20px; font-weight: 500; }
.modal-body .btn { width: 100%; }
.big-stat { text-align: center; font-size: 20px; font-weight: 600; }
.big-stat b { display: block; font-size: 40px; color: #b5561c; }
.stars { display: flex; justify-content: center; gap: 6px; margin: -4px 0 2px; }
.stars svg { width: 64px; height: 64px; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .25)); animation: starpop .45s cubic-bezier(.3, 1.6, .5, 1) backwards; }
.stars svg:nth-child(2) { width: 80px; height: 80px; margin-top: -12px; animation-delay: .15s; }
.stars svg:nth-child(3) { animation-delay: .3s; }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); } }
.stars svg.off { filter: none; opacity: .7; }
.win-stats { display: flex; justify-content: center; gap: 34px; }
.rewards { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.rewards:empty { display: none; }
.reward {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: #4a1a08;
  color: #f7d49a;
  font-size: 19px;
  font-weight: 700;
  box-shadow: 0 0 0 2px #a8642f;
  animation: starpop .45s cubic-bezier(.3, 1.6, .5, 1) calc(.6s + var(--i) * .12s) backwards;
}
.reward svg { width: 22px; height: 22px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  font-size: 20px;
  font-weight: 600;
  border-bottom: 2px solid rgba(110, 49, 18, .12);
}
.row:last-of-type { border-bottom: 0; }
.switch {
  position: relative;
  width: 62px;
  height: 36px;
  flex: none;
  border-radius: 999px;
  background: #c9b9a0;
  transition: background .2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
  transition: transform .2s;
}
.switch[aria-checked="true"] { background: var(--green-btn); }
.switch[aria-checked="true"]::after { transform: translateX(26px); }
.swatches { display: flex; gap: 10px; }
.vol-row { padding-top: 0; }
.vol {
  -webkit-appearance: none;
  appearance: none;
  width: 52%;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #3aa75a, #f0972f);
  outline: none;
}
.vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #b8692f;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
}
.vol::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #b8692f;
}
.swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .15);
}
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--accent); }

.plist { display: flex; flex-direction: column; gap: 10px; }
.pitem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 3px 0 #d9c29a;
  font-size: 21px;
  font-weight: 600;
  text-align: left;
}
.pitem.cur { box-shadow: 0 0 0 3px var(--accent), 0 3px 0 #d9c29a; }
.pitem .pmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pitem .pmeta small { font-size: 15px; opacity: .65; font-weight: 600; }
.pitem .pdel { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #b23b2a; font-size: 26px; flex: none; }
.add-row { display: flex; gap: 10px; }
.add-row .text-input { font-size: 20px; padding: 10px 14px; }
.add-row .btn { width: auto; padding: 10px 18px; font-size: 20px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: #fff;
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
  box-shadow: 0 3px 0 #d9c29a;
  font-size: 15px;
  font-weight: 600;
}
.stat b { display: block; font-size: 28px; color: #b5561c; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9500; }

/* asztali nézet: kicsit nagyobb gombok, kényelmesebb térközök */
@media (min-width: 900px) and (min-height: 600px) {
  .g-bottom { gap: 60px; }
  .board-area { margin: 18px 40px 12px; }
}
@media (hover: hover) {
  .tile:not(.blocked):not(.in-tray):hover .face { filter: brightness(1.06) drop-shadow(0 0 3px rgba(255, 214, 120, .9)); }
  .btn:hover { filter: brightness(1.06); }
}
