:root { font-family: system-ui, Arial, sans-serif; }

body {
  margin: 0;
  min-height: 100vh;
  background: #f6f7fb;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.wrap {
  width: min(1220px, 96vw);
  padding: 16px 0 24px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.status { font-weight: 900; font-size: 18px; }
.sub { font-size: 12px; opacity: .75; max-width: 980px; margin-top: 4px; }

button {
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  background: #111827;
  color: #fff;
}

.panel {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 26px rgba(0,0,0,.08);
  padding: 12px;
  transform-origin: center;
}

.panel.flipLose {
  animation: flipLose 900ms ease-in-out forwards;
}

@keyframes flipLose {
  0%   { transform: rotateY(0deg) rotateZ(0deg); }
  35%  { transform: rotateY(110deg) rotateZ(1deg) scale(1.02); }
  70%  { transform: rotateY(200deg) rotateZ(-1deg) scale(1.02); }
  100% { transform: rotateY(360deg) rotateZ(0deg); }
}

.meta {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.tile {
  background: #fff;
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 10px 22px rgba(0,0,0,.08);
  border: 3px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform 90ms ease, border-color 120ms ease, opacity 120ms ease;
  overflow: hidden;
}

.tile:hover { border-color: rgba(17,24,39,.25); transform: translateY(-1px); }
.tile.selected { border-color: #111827; }

.tile.disabled {
  opacity: .35;
  cursor: not-allowed;
  transform: none;
}
.tile.disabled:hover { border-color: transparent; }

.mini {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: #1f3a8a;
  padding: 8px;
  border-radius: 14px;
  user-select: none;
}

.miniCell {
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  background: #e5e7eb;
  display: grid;
  place-items: center;
}

.miniDisc {
  width: 84%;
  height: 84%;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 6px 10px rgba(255,255,255,.25), inset 0 -10px 16px rgba(0,0,0,.18);
}

.disc.p1, .miniDisc.p1, .metaDisc.p1 { background-color: #ef4444; }
.disc.p2, .miniDisc.p2, .metaDisc.p2 { background-color: #facc15; }

.metaDiscWrap {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  pointer-events: none;
}

.tile.owned .metaDiscWrap { display: grid; }

.metaDisc {
  width: 70%;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  box-shadow:
    inset 0 10px 16px rgba(255,255,255,.28),
    inset 0 -14px 20px rgba(0,0,0,.2),
    0 12px 26px rgba(0,0,0,.18);
  transform: translateY(-2px);
}

.tile.owned .mini { opacity: .28; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.55);
  display: none;
  place-items: center;
  z-index: 50;
  padding: 18px;
}

.overlay.open { display: grid; }

.modal {
  width: min(820px, 96vw);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  padding: 14px;
}

.modalTop {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  align-items: baseline;
}

.modalTitle { font-weight: 900; }
.modalSub { font-size: 12px; opacity: .75; }

.bigBoard {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  background: #1f3a8a;
  padding: 16px;
  border-radius: 18px;
  user-select: none;
}

.bigCell {
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  background: #e5e7eb;
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
}

.disc {
  width: 86%;
  height: 86%;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 6px 10px rgba(255,255,255,.25), inset 0 -10px 16px rgba(0,0,0,.18);
}

.footerHelp {
  margin-top: 10px;
  font-size: 12px;
  opacity: .75;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

#fxCanvas {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  display: none;
}

#fxCanvas.show { display: block; }

.resultBanner {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  display: none;
  place-items: center;
}

.resultBanner.show { display: grid; }

.resultText {
  font-weight: 1000;
  letter-spacing: 4px;
  font-size: clamp(44px, 7vw, 96px);
  color: #ffffff;
  text-shadow:
    0 10px 30px rgba(0,0,0,.35),
    0 2px 0 rgba(0,0,0,.15);
  transform: translateY(-8px);
  animation: resultPulse 900ms ease-in-out infinite;
}

@keyframes resultPulse {
  0%   { transform: translateY(-8px) scale(1); opacity: 1; }
  50%  { transform: translateY(-8px) scale(1.04); opacity: .95; }
  100% { transform: translateY(-8px) scale(1); opacity: 1; }
}
