/* Unluck of the Draw: prototype styling (no GUI pack yet). Portrait phone first. */
:root {
  --felt: #155c3e;
  --felt-dark: #0b2f20;
  --ink: #f4f1e6;
  --muted: #b9d2c3;
  --gold: #f3c34a;
  --boom: #ff3b2f;
  --red-suit: #d0021b;
  --black-suit: #111;
  --you: #3d8bfd;
  --red: #e5484d;
  --green: #46c46b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at 50% 40%, var(--felt) 0%, var(--felt-dark) 85%);
  color: var(--ink);
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button { font: inherit; color: inherit; }

#app {
  height: 100dvh; max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom));
}

/* ---- header ---- */
#hud { display: flex; align-items: center; justify-content: space-between; }
.title { margin: 0; font-size: 20px; letter-spacing: .5px; }
.title small, .logo small { font-size: .6em; font-weight: 400; color: var(--muted); }
.chip {
  border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.25);
  border-radius: 999px; width: 32px; height: 32px; cursor: pointer;
}

/* ---- opponents ---- */
.opps { display: flex; flex-direction: column; gap: 6px; }
.opp {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 10px; background: rgba(0,0,0,.2); border: 2px solid transparent;
  min-height: 52px;
}
.opp.active, .me.active { border-color: var(--gold); box-shadow: 0 0 12px rgba(243,195,74,.35); }
.name { font-weight: 700; min-width: 52px; }
.who { display: flex; flex-direction: column; align-items: center; width: 58px; flex: none; }
.who .face { width: 38px; height: 38px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }
.who .name { min-width: 0; font-size: 11px; line-height: 1.1; color: var(--ink); white-space: nowrap; }
.me-head .who { flex-direction: row; gap: 6px; width: auto; }
.me-head .who .name { font-size: 15px; color: var(--you); }
.name.red { color: var(--red); } .name.green { color: var(--green); } .name.you { color: var(--you); }
.run { font-size: 12px; color: var(--muted); white-space: nowrap; }
.run b { color: var(--ink); }
.slots { display: inline-flex; gap: 3px; }
.slots i {
  font-style: normal; font-weight: 700; font-size: 12px; width: 20px; height: 22px;
  display: grid; place-items: center; border-radius: 4px;
  border: 1px dashed rgba(255,255,255,.3); color: rgba(255,255,255,.35);
}
.slots i.have { border: 1px solid var(--gold); background: var(--gold); color: #2a1d00; }
.minis { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.mini {
  background: #fff; border-radius: 5px; padding: 3px 5px; min-width: 30px; text-align: center;
  font-weight: 700; font-size: 14px; line-height: 1.2; color: var(--black-suit);
  border: 2px solid #fff; transition: transform .2s, opacity .5s;
}
.mini.r { color: var(--red-suit); }
.mini.inrun { border-color: var(--gold); }
.mini.fresh { animation: pop .35s ease-out; }
.mini.burning, .card.burning { animation: burn .9s forwards; }
.empty { color: var(--muted); font-size: 12px; font-style: italic; }

/* ---- table ---- */
.table {
  display: flex; align-items: center; justify-content: space-around;
  padding: 8px 0; flex: 1; min-height: 150px;
}
.pile { display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
.pile-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.card {
  width: 78px; aspect-ratio: 500 / 726; border-radius: 7px; border: 0; padding: 0;
  background: #fff center / 100% 100% no-repeat; position: relative;
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
}
.card.back { background: url(assets/backs/back-purple.png) center / cover; }
.card.slot { background-color: rgba(0,0,0,.25); box-shadow: inset 0 0 0 2px rgba(255,255,255,.2); }
.card.face { background-color: #fff; }
.deck { box-shadow: 0 2px 0 #ddd, 0 4px 0 #bbb, 0 6px 8px rgba(0,0,0,.5); }
.deck.go, .slot.go, .card.face.go { cursor: pointer; animation: glow 1.4s ease-in-out infinite; }
.count {
  position: absolute; right: -8px; top: -8px; background: #000; color: #fff;
  border-radius: 999px; font-size: 12px; padding: 2px 7px; font-weight: 700;
}
.count:empty { display: none; }
.danger { font-size: 12px; text-align: center; min-height: 32px; }
.danger .bar { width: 78px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; margin: 2px auto 0; }
.danger .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--boom)); }
.burnt { font-size: 12px; color: var(--muted); min-height: 32px; text-align: center; }

.mine {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 12px; border-radius: 14px; background: rgba(0,0,0,.3);
  border: 2px solid var(--boom); min-width: 92px;
}
.mine-tag { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--boom); font-weight: 800; }
.mine-suit { font-size: 46px; line-height: 1; background: #fff; border-radius: 50%; width: 64px; height: 64px;
  display: grid; place-items: center; color: var(--black-suit); }
.mine-suit.r { color: var(--red-suit); }
.mine-suit.turn { animation: spin .6s ease-out; }
.mine-next { font-size: 12px; color: var(--muted); text-align: center; }
.mine-next b { font-size: 15px; color: var(--ink); }

/* planted mine pile (v0.2) */
.mine-card { box-shadow: inset 0 0 0 2px rgba(255,59,47,.5); }
.mine-card.armed { box-shadow: 0 0 0 3px var(--boom), 0 0 18px rgba(255,59,47,.7); }
.mine-card.planted { animation: plant .45s ease-out; }
.mine-card .count { background: var(--boom); }
.mine-card:not(.armed)::after {
  content: 'no mine'; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12px; color: var(--muted); text-align: center;
}
.mine-label { font-size: 12px; min-height: 32px; text-align: center; }
.mine-label b { color: var(--boom); font-size: 16px; }
.pile-label.mine-tag { color: var(--boom); font-weight: 800; }

/* ---- log ---- */
.log { margin: 0; min-height: 40px; text-align: center; font-size: 14px; color: var(--ink); }
.log .boom { color: var(--boom); font-weight: 800; }

/* ---- my hand ---- */
.me { padding: 6px 8px 10px; border-radius: 12px; background: rgba(0,0,0,.2); border: 2px solid transparent; }
.me-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.hand { display: flex; justify-content: center; min-height: 113px; align-items: flex-end; }
.hand .card { width: 78px; cursor: default; transition: transform .15s; }
.hand .card + .card { margin-left: -12px; }
.hand .card.inrun { box-shadow: 0 0 0 3px var(--gold), 0 2px 6px rgba(0,0,0,.45); }
.hand .card.pick { cursor: pointer; }
.hand .card.locked { filter: brightness(.8); }
.hand .card.sel { transform: translateY(-16px); box-shadow: 0 0 0 3px var(--boom), 0 8px 14px rgba(0,0,0,.5); }
.hand .card.fresh { animation: pop .35s ease-out; }
.hand .empty { align-self: center; }

/* ---- actions ---- */
.actions { display: flex; gap: 10px; justify-content: center; min-height: 48px; }
.btn.mine-btn { background: var(--boom); color: #fff; box-shadow: 0 3px 0 #8f1a12; }
.btn {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 800; font-size: 16px;
  background: var(--gold); color: #2a1d00; cursor: pointer; box-shadow: 0 3px 0 #a67c12;
}
.btn.alt { background: #e9e4d6; color: #222; box-shadow: 0 3px 0 #9d9686; }
.btn:disabled { opacity: .4; cursor: default; }
.hint { align-self: center; color: var(--muted); font-size: 14px; }

/* ---- reveal + flash ---- */
.reveal {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px;
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
.reveal.show { opacity: 1; }
.reveal-card { width: 150px; aspect-ratio: 500 / 726; background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
.reveal.show .reveal-card { animation: flip .35s ease-out; }
.reveal.boom .reveal-card { animation: shake .5s; box-shadow: 0 0 0 5px var(--boom), 0 0 40px var(--boom); }
.reveal-card img { width: 100%; height: 100%; display: block; }
.reveal p { margin: 0; font-weight: 800; font-size: 20px; text-shadow: 0 2px 6px #000; }
.reveal.boom p { color: var(--boom); font-size: 28px; }
.flash { position: fixed; inset: 0; background: var(--boom); opacity: 0; pointer-events: none; }
.flash.go { animation: flash .6s ease-out; }

/* ---- overlays ---- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); padding: 16px; }
.overlay.hidden { display: none; }
.panel {
  max-width: 380px; background: #f6f1e2; color: #222; border-radius: 16px; padding: 20px 22px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); text-align: center;
}
.panel h1 { margin: 0 0 10px; }
.panel p { margin: 8px 0; }
.panel .small { font-size: 13px; color: #555; }
.logo small { color: #6b6b6b; }
.row { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.opp-pick { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; font-weight: 700; }
.opp-pick button {
  width: 44px; height: 44px; border-radius: 10px; border: 2px solid #c9c0a6; background: #fff;
  font-weight: 800; font-size: 18px; cursor: pointer; color: #222;
}
.opp-pick button.on { background: var(--gold); border-color: #a67c12; }
.win-face { display: block; width: 84px; height: 84px; margin: 0 auto 6px; }
.over-run { display: flex; justify-content: center; gap: 4px; margin: 10px 0; }
.over-run .card { width: 60px; }

/* ---- animations ---- */
@keyframes glow { 0%,100% { box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(0,0,0,.45); } 50% { box-shadow: 0 0 0 4px var(--gold), 0 0 18px var(--gold); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes burn { 0% { filter: none; } 30% { filter: sepia(1) saturate(6) hue-rotate(-30deg); transform: scale(1.05); } 100% { filter: brightness(0); transform: scale(.5) rotate(-12deg); opacity: 0; } }
@keyframes flip { from { transform: rotateY(90deg) scale(.7); } to { transform: none; } }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-10px) rotate(-4deg); } 40% { transform: translateX(10px) rotate(4deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
@keyframes flash { 0% { opacity: .55; } 100% { opacity: 0; } }
@keyframes plant { 0% { transform: translateY(40px) scale(.7); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: none; } }
@keyframes spin { from { transform: rotateY(180deg) scale(.6); } to { transform: none; } }

@media (max-height: 700px) {
  .card, .hand .card { width: 66px; }
  .hand { min-height: 96px; }
  .mine-suit { width: 52px; height: 52px; font-size: 36px; }
  .table { min-height: 130px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
