/* Layout: full-bleed 2D canvas; square board centered, dice tray to the right (landscape) or below (portrait). Single deliberate dark night-table look. */
:root {
  --table: #0c0a22;
  --ink: #f6f3ff;
  --ink-dim: #bcb3ea;
  --panel: rgba(26, 20, 72, 0.72);
  --red: #ff4b5c;
  --green: #1fcb7b;
  --yellow: #ffc23a;
  --blue: #3a8dff;
  --font-display: "Fredoka", system-ui, sans-serif;
  --font-body: "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
html,
body {
  height: 100%;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--table);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  touch-action: manipulation;
}
.space-parallax {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1;
  pointer-events: none;
  opacity: .65;
  will-change: transform;
}
.space-parallax svg { display: block; width: 100%; height: 100%; }
.space-parallax .sparkle { fill: #fff4bf; animation: starlight 4s ease-in-out infinite alternate; }
.space-parallax .s2 { animation-delay: -1.3s; }
.space-parallax .s3 { animation-delay: -2.7s; }
.space-parallax .s4 { animation-delay: -.7s; }
@keyframes starlight { from { opacity: .25; } to { opacity: .9; } }
@media (prefers-reduced-motion: reduce) {
  .space-parallax .sparkle { animation: none; opacity: .5; }
}
.app {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  box-sizing: border-box;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 8px 12px;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 50px;
  flex: none;
}
.logo {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0.5px;
  text-shadow:
    0 3px 0 #0b0628,
    0 0 24px rgba(120, 90, 255, 0.45);
  display: flex;
  align-items: center;
  gap: 6px;
}
.logo span {
  display: inline-block;
  color: #2a1600;
  background: var(--yellow);
  padding: 3px 8px 2px;
  border-radius: 10px;
  font-size: 18px;
  transform: rotate(-6deg);
  box-shadow: 0 3px 0 #9c6400;
  text-shadow: none;
}
.actions {
  display: flex;
  gap: 8px;
}
.icon-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 0;
  background: rgba(255, 255, 255, 0.09);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  font: 800 15px/1 var(--font-body);
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition:
    transform 0.12s,
    background 0.2s;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}
.icon-btn:active {
  transform: translateY(2px) scale(0.95);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}
:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.stage.wide {
  flex-direction: row;
  gap: 24px;
}
.slot {
  flex: none;
}
.tray {
  pointer-events: auto;
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px 6px 6px;
  border-radius: 26px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-sizing: border-box;
  max-width: 100%;
}
.stage.wide .tray {
  flex-direction: column;
  width: 236px;
  padding: 20px 16px 22px;
  text-align: center;
}
.tray.bump {
  animation: bump 0.28s ease-out;
}
@keyframes bump {
  0% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(4px) scale(1.01, 0.98);
  }
  60% {
    transform: translateY(-2px);
  }
  100% {
    transform: none;
  }
}
.info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.stage.wide .info {
  align-items: center;
  width: 100%;
}
.turn {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.05;
}
.turn .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--pc, #fff);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.14),
    0 0 16px var(--pc, #fff);
  flex: none;
}
.hint {
  color: var(--ink-dim);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
  min-height: 1.25em;
}
.score {
  position: relative;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 3px;
}
.tutorial-pair-example { display: none; }
.show-tutorial-pair > .chip { visibility: hidden; }
.show-tutorial-pair .tutorial-pair-example {
  position: absolute; inset: -4px 0; display: flex; align-items: center; justify-content: center;
  gap: 5px; border: 2px solid #8bb9dc; border-radius: 12px; background: #e7f4ff;
  color: #344b78; pointer-events: none;
}
.tutorial-pair-example span { font: 700 13px/1.1 var(--font-body); }
.tutorial-pair-tile { display: flex; align-items: center; justify-content: center; }
.tutorial-pair-tile img { width: 42px; height: 42px; object-fit: contain; }
.tutorial-pair-tile svg { width: 22px; height: 26px; filter: drop-shadow(0 1px 1px #466b99); }
.stage.wide .score {
  justify-content: center;
}
.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  font-weight: 800;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  transition:
    box-shadow 0.2s,
    background 0.2s,
    transform 0.2s;
}
.chip i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.6) 0 18%, transparent 40%), var(--cc);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}
.chip.on {
  box-shadow:
    0 0 0 2px var(--cc),
    0 0 14px var(--cc);
  background: rgba(255, 255, 255, 0.13);
  transform: translateY(-1px);
}
.chip.gold {
  background: var(--cc);
  color: #1a1040;
}
@media (max-width: 480px) {
  .score {
    flex-wrap: nowrap;
    gap: 4px;
  }
  .chip {
    padding: 2px 6px 2px 3px;
    font-size: 12px;
    gap: 4px;
  }
}

.dice-btn {
  position: relative;
  width: 110px;
  height: 110px;
  border: 0;
  border-radius: 28px;
  cursor: pointer;
  flex: none;
  padding: 0;
  background: radial-gradient(
    circle at 50% 66%,
    rgba(255, 255, 255, 0.13),
    rgba(255, 255, 255, 0) 66%
  );
}
/* The dice canvas reaches above and beside its slot so high bounces are never clipped. */
.dice-btn canvas {
  position: absolute;
  left: -20%;
  top: -70%;
  width: 140%;
  height: 170%;
  display: block;
  pointer-events: none;
}
.dice-btn[aria-disabled="true"] {
  cursor: default;
}
.dice-btn.ready::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 26px;
  border: 3px solid var(--pc, #fff);
  box-shadow:
    0 0 18px var(--pc, #fff),
    inset 0 0 14px var(--pc, #fff);
  animation: ringPulse 1.1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ringPulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.94);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}
@media (max-width: 480px) {
  .dice-btn {
    width: 96px;
    height: 96px;
  }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  overflow: auto;
  background: radial-gradient(ellipse at center, rgba(12, 8, 48, 0.2), rgba(8, 5, 32, 0.62));
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  box-sizing: border-box;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: calc(16px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-bottom, 0px));
}
.card {
  width: min(100%, 500px);
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(48, 32, 132, 0.93) 0%, rgba(28, 18, 88, 0.95) 100%);
  border-radius: 32px;
  padding: 26px 22px 22px;
  text-align: center;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.07);
  animation: cardIn 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
@keyframes cardIn {
  from {
    transform: translateY(30px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.big-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(64px, 19vw, 104px);
  line-height: 0.88;
  display: flex;
  justify-content: center;
  gap: 2px;
  position: relative;
  margin: 4px 0 0;
}
.big-title span {
  display: inline-block;
  text-shadow:
    0 7px 0 rgba(0, 0, 0, 0.35),
    0 0 30px currentColor;
  animation: letter 2.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.14s);
}
@keyframes letter {
  0%,
  60%,
  100% {
    transform: translateY(0) rotate(0);
  }
  20% {
    transform: translateY(-12px) rotate(-5deg);
  }
  35% {
    transform: translateY(2px) scale(1.06, 0.94);
  }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* End of css/game.css */
