:root {
  --table-top: #2fa866;
  --table-bottom: #0b5c36;
  --deep: #073a22;
  --orange: #ff8a1e;
  --orange-deep: #d9610a;
  --green: #3cc47c;
  --green-deep: #117a49;
  --cream: #fff9ec;
  --cream-shade: #f4e8cf;
  --ink: #163a2b;
  --sun: #ffd84d;
  --red: #e03a32;
  --black: #1d2230;
  --back-light: #ffa02e;
  --back-dark: #e8650c;
}
body[data-table="blue"] { --table-top: #3a8df5; --table-bottom: #1638a8; --deep: #10266e; }
body[data-table="red"] { --table-top: #c2414b; --table-bottom: #6a1024; --deep: #3d0613; }
body[data-table="night"] { --table-top: #3d4a63; --table-bottom: #151b2b; --deep: #0b0f1a; }
body[data-back="blue"] { --back-light: #4f9bff; --back-dark: #1d4dbf; }
body[data-back="red"] { --back-light: #f0605c; --back-dark: #b32535; }
body[data-back="green"] { --back-light: #3cc47c; --back-dark: #117a49; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, var(--table-top), var(--table-bottom)) fixed;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

#app { position: relative; height: 100%; max-width: 1100px; margin: 0 auto; }
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: max(10px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
.grow { flex: 1; }
.bar { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 46px; padding: 0 4px; }

.round {
  width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--deep) 45%, transparent); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.18);
  color: #fff; text-decoration: none; font-size: 20px;
}
.round svg { width: 22px; height: 22px; fill: #fff; }


.wordmark { width: min(78%, 340px); height: auto; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25)); }
.tagline { margin: 10px 0 8px; font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase; text-align: center; opacity: 0.92; text-shadow: 0 2px 0 rgba(7, 58, 34, 0.5); }
.beads { display: flex; gap: 12px; align-items: center; background: linear-gradient(#ffe08a, #f5a623) center / calc(100% - 13px) 3px no-repeat; }
.beads i { width: 13px; height: 13px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14), inset 2px 2px 3px rgba(255, 255, 255, 0.7); }
.beads i:nth-child(1) { background: #35d07f; }
.beads i:nth-child(2) { background: #ffd23f; }
.beads i:nth-child(3) { background: #ff5fa2; }

.menu { display: flex; flex-direction: column; gap: 14px; width: min(100%, 330px); }
.chunky {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 14px; border-radius: 16px;
  background: var(--green); box-shadow: 0 5px 0 var(--green-deep), inset 0 0 0 1.5px rgba(255, 255, 255, 0.3); font-size: 17px; color: #fff;
  transition: transform 0.08s, box-shadow 0.08s; white-space: nowrap;
}
.chunky:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--green-deep), inset 0 0 0 1.5px rgba(255, 255, 255, 0.3); }
.chunky.play { background: var(--orange); box-shadow: 0 5px 0 var(--orange-deep), inset 0 0 0 1.5px rgba(255, 255, 255, 0.35); }
.chunky.play:active { box-shadow: 0 1px 0 var(--orange-deep); }
.chunky.pale { background: #fff; color: var(--ink); box-shadow: 0 5px 0 #a9cdb8; }
.chunky.danger { background: #f0524f; box-shadow: 0 5px 0 #b32535; }
.chunky:disabled { opacity: 0.55; }
.menu .play { min-height: 64px; font-size: 24px; border-radius: 22px; }
.menu .sun { color: var(--sun); }
.pair { display: flex; gap: 10px; width: 100%; }
.pair > * { flex: 1; min-width: 0; }

.figures { display: flex; gap: 6px; padding: 4px 12px; border-radius: 99px; background: color-mix(in srgb, var(--deep) 40%, transparent); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.14); }
.figures div { display: flex; flex-direction: column; align-items: center; min-width: 58px; }
.figures small { font-size: 10px; opacity: 0.7; }
.figures b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* the cards are stacked by z-index; kept to the board, so a sheet over the table covers them */
#board { position: relative; z-index: 0; isolation: isolate; flex: 1; width: 100%; margin: 6px 0; touch-action: none; }
.slot { position: absolute; border-radius: 12%/8.500%; background: rgba(0, 0, 0, 0.14); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.26); display: grid; place-items: center; color: rgba(255, 255, 255, 0.32); }
.slot.column { opacity: 0.55; }
.slot.hint, .card.hint .face { box-shadow: 0 0 0 3px var(--sun), 0 0 12px var(--sun); animation: pulse 0.5s ease-in-out infinite alternate; }
@keyframes pulse { from { filter: brightness(1); } to { filter: brightness(1.12); } }

.card { position: absolute; left: 0; top: 0; transition: transform 0.26s cubic-bezier(0.3, 1.2, 0.5, 1); will-change: transform; perspective: 600px; }
.card.dragging { transition: none; }
.card.shake { animation: shake 0.4s linear; }
@keyframes shake { 20% { margin-left: -6px; } 40% { margin-left: 6px; } 60% { margin-left: -5px; } 80% { margin-left: 4px; } }
.card .face, .card .back { position: absolute; inset: 0; border-radius: 12%/8.500%; backface-visibility: hidden; transition: transform 0.28s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22), inset 0 0 0 1px rgba(29, 34, 48, 0.2); }
.card .face { background: linear-gradient(#fff, #f7f2e6); transform: rotateY(180deg); color: var(--black); }
.card .back { background: linear-gradient(var(--back-light), var(--back-dark)); border: 0.07em solid var(--cream); font-size: inherit; }
/* a fine lattice, six diamonds across, and a thin frame inside the rim */
.card .back::before { content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.24) 0 0.012em, transparent 0.012em 0.101em), repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.24) 0 0.012em, transparent 0.012em 0.101em);
  outline: 0.018em solid rgba(255, 248, 232, 0.9); outline-offset: -0.07em; }
.card.up .face { transform: rotateY(0); }
.card.up .back { transform: rotateY(-180deg); }
.card.red .face { color: var(--red); }
.card .rank { position: absolute; left: 8%; top: 1%; font-size: 0.42em; font-weight: 700; line-height: 1.15; letter-spacing: -0.04em; }
/* the ten is the one index of two figures: drawn a little narrower, it stays whole in the fan */
.card.ten .rank { transform: scaleX(0.92); transform-origin: left center; }
.card .pip { position: absolute; right: 8%; top: 6%; width: 27%; aspect-ratio: 1; fill: currentColor; }
.card .big { position: absolute; left: 25%; bottom: 13%; width: 50%; aspect-ratio: 1; fill: currentColor; }
.card.ace .big { left: 19%; bottom: 9%; width: 62%; }
.card.court .big { left: 5%; bottom: 3%; width: 90%; height: 66%; aspect-ratio: auto; object-fit: contain; object-position: center bottom; pointer-events: none; }
.card.lifted .face { box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35); }

.notices { position: absolute; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 12; padding: 0 20px; }
.notices > * { pointer-events: auto; }
.toast { margin: 0; padding: 9px 16px; border-radius: 99px; background: rgba(0, 0, 0, 0.6); font-size: 14px; }
#finishBtn { min-height: 52px; padding: 0 28px; font-size: 18px; }
.stuck { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(100%, 360px); padding: 14px; border-radius: 22px; background: var(--cream); color: var(--ink); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3); text-align: center; }
.stuck p { margin: 0; font-size: 13px; font-weight: 600; opacity: 0.7; }
.stuck .chunky { min-height: 44px; font-size: 15px; }

.tools { display: flex; gap: 10px; width: min(100%, 520px); padding: 0 6px 5px; }
.tools .chunky { flex: 1; min-width: 0; min-height: 46px; font-size: 15px; }

.veil { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 20; }
.sheet {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 21;
  width: min(calc(100% - 40px), 420px); max-height: calc(100% - 40px); overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px;
  border-radius: 30px; background: var(--cream); color: var(--ink); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35), inset 0 0 0 7px var(--cream), inset 0 0 0 10px var(--cream-shade);
  text-align: center;
}
.sheet h2 { margin: 0; font-size: 24px; }
.sheet p { margin: 0; font-size: 15px; font-weight: 600; opacity: 0.75; }
.sheet .close { position: absolute; right: 16px; top: 14px; width: 40px; height: 40px; font-size: 22px; color: #f0524f; }
.sheet .chunky { width: 100%; }
.sheet .rows { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.row { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 14px; border-radius: 14px; background: #fff; text-align: left; font-size: 16px; width: 100%; color: var(--ink); text-decoration: none; }
.row b { flex: 1; font-weight: 700; }
.row em { font-style: normal; font-size: 19px; font-variant-numeric: tabular-nums; }
.row .tag { padding: 3px 8px; border-radius: 99px; background: #ff5fa2; color: #fff; font-size: 11px; }
.switch { width: 52px; height: 30px; border-radius: 99px; background: #c3cbdd; position: relative; flex: none; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.switch.on { background: #35c46a; }
.switch.on::after { transform: translateX(22px); }
.swatches { display: flex; gap: 8px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 3px #fff, 0 1px 2px rgba(0, 0, 0, 0.2); }
.swatches button.on { box-shadow: inset 0 0 0 3px var(--orange), 0 1px 2px rgba(0, 0, 0, 0.2); }
.note { font-size: 12px !important; }
.step { display: flex; gap: 12px; padding: 12px; border-radius: 16px; background: #fff; text-align: left; width: 100%; }
.step i { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-style: normal; }
.step b { display: block; font-size: 16px; }
.step span { font-size: 14px; font-weight: 600; opacity: 0.72; }
.languages { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.languages button { min-height: 44px; padding: 6px 10px; border-radius: 14px; background: #fff; font-size: 15px; color: var(--ink); }
.languages button.on { box-shadow: inset 0 0 0 3px var(--orange); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.tile { padding: 12px 8px; border-radius: 18px; background: #fff; }
.tile em { display: block; font-style: normal; font-size: 26px; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; font-weight: 700; opacity: 0.65; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; width: 100%; }
.calendar small { font-size: 11px; opacity: 0.5; }
.calendar button { aspect-ratio: 1; border-radius: 50%; background: #fff; font-size: 14px; color: var(--ink); display: grid; place-items: center; }
.calendar button:disabled { opacity: 0.3; cursor: default; }
.calendar button.won { background: var(--sun); }
.calendar button.won svg { width: 60%; fill: var(--orange-deep); }
.calendar button.on { box-shadow: inset 0 0 0 3px var(--orange); }
.month { display: flex; align-items: center; justify-content: space-between; width: 100%; font-size: 19px; }
.month button { width: 38px; height: 38px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.month button svg { width: 18px; fill: var(--ink); }
.month button:disabled { opacity: 0.25; }
.trophy { width: 64px; fill: var(--orange); filter: drop-shadow(0 3px 0 var(--orange-deep)); }
.bonus { color: var(--orange-deep); font-size: 13px !important; opacity: 1 !important; font-weight: 800 !important; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 19; overflow: hidden; }
#confetti i { position: absolute; top: -20px; width: 10px; height: 6px; border-radius: 1.500px; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* little height, as on a phone held on its side */
@media (max-height: 480px) {
  .bar { min-height: 36px; }
  .round { width: 36px; height: 36px; }
  .figures b { font-size: 14px; }
  .tools .chunky { min-height: 36px; font-size: 13px; }
  .notices { bottom: 56px; }
  #home { flex-direction: row; flex-wrap: wrap; align-content: center; justify-content: center; gap: 0 24px; }
  #home .bar { position: absolute; top: 8px; }
  #home .bar { left: 0; padding: 0 12px; }
  #home .grow, #home .tagline, #home .beads { display: none; }
  #home .wordmark { width: min(40%, 300px); }
  .menu { gap: 9px; width: min(46%, 320px); }
  .menu .play { min-height: 50px; font-size: 20px; }
  .menu .chunky { min-height: 40px; }
}
