/* ===== Base ===== */
*{ box-sizing: border-box; }
html, body{ height:100%; overflow:hidden; }
:root{
  --bg: radial-gradient(1200px 800px at 10% 10%, #1f2937 0%, #0b1020 60%);
  --glass: rgba(255,255,255,.08);
  --glass-border: rgba(255,255,255,.18);
  --text: #E5E7EB;
  --muted:#94A3B8;
  --accent:#F59E0B;
  --accent-2:#FBBF24;
  --gold-1:#efcc68;
  --gold-2:#c38824;
  --neon-gold: #ffd96a;
  --neon-gold-glow: rgba(255,217,106,.45);
  --neon-pink: #ff5da6;
  --neon-pink-glow: rgba(255,110,199,.5);
  --neon-cyan: #49abf1;
  --neon-cyan-glow: rgba(0,212,255,.5);
  --neon-blue: #60a5fa;
  --neon-blue-glow: rgba(96,165,250,.4);
  --metal-highlight: rgba(255,255,255,.15);
  --metal-shadow: rgba(0,0,0,.4);
}

body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--text);
  background: url('img/background.jpg') center center / cover no-repeat fixed;
}

/* ===== Layout ===== */
.app{
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(16px, 3vw, 32px);
  padding: clamp(16px, 3vw, 32px);
}

.stage, .scoreboard{
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  backdrop-filter: blur(12px);
  box-shadow: 0 30px 60px rgba(0,0,0,.45);
}

/* Left side */
.stage{
  display: grid;
  grid-template-rows: 1fr auto;
  padding: clamp(16px, 2vw, 24px);
}

.coin-wrap{
  display:grid;
  place-items:center;
  width:100%;
  height:100%;
  position: relative;
}

/* Three.js canvas fills the coin-wrap container */
.coin-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border-radius: 12px;
  outline: none;
}

/* Button */
.btn{
  background-image: linear-gradient(45deg, var(--gold-1), var(--gold-2));
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .2s ease-in-out, opacity .2s ease-in-out;
  font-size: clamp(18px, 2.4vw, 24px);
  margin-top: 1em;
}
.btn:hover{ transform: scale(1.05); }
.btn:disabled{ opacity:.6; cursor: not-allowed; }

.racing-sans-one-regular {
  font-family: "Racing Sans One", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.gold{ color: var(--gold-2); }

/* ===== Right side: scoreboard (neon & metal vibe) ===== */
.scoreboard{
  display: grid;
  grid-template-rows: auto auto 1fr;
  padding: clamp(16px, 2vw, 24px);
  border: 1px solid rgba(255,217,106,.18);
  box-shadow:
    0 30px 60px rgba(0,0,0,.45),
    inset 0 1px 0 var(--metal-highlight),
    0 0 30px rgba(255,217,106,.06);
}
.brand .title{
  margin: 0 0 6px 0;
  font-family: "Racing Sans One", sans-serif;
  font-weight: 400;
  font-size: clamp(28px, 4.5vw, 48px);
}
.brand .accent{ color: var(--accent-2); }
.brand .badge{
  display:inline-block;
  font-size:.6em;
  padding:.25em .5em;
  border-radius:999px;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  color:white;
  vertical-align:middle;
  margin-left:.25em;
}

/* ---- Current result panel ---- */
.current{
  margin-top: clamp(8px, 1.5vw, 12px);
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255,217,106,.22);
  background:
    linear-gradient(
      135deg,
      rgba(255,217,106,.08) 0%,
      rgba(195,136,36,.06) 50%,
      rgba(255,217,106,.04) 100%
    );
  height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 0 18px rgba(255,217,106,.08);
}
/* Subtle metallic sheen sweep */
.current::before{
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,.06),
    transparent
  );
  transform: skewX(-20deg);
  animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen{
  0%, 100%{ left: -60%; }
  50%{ left: 120%; }
}

.label{
  font-family: "Racing Sans One", sans-serif;
  font-size: .85rem;
  color: var(--neon-gold);
  text-transform: uppercase;
  letter-spacing: .18em;
  margin-bottom: 6px;
  text-shadow: 0 0 8px var(--neon-gold-glow);
}
.result{
  margin: 10px 0 0 0;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: .04em;
  transition: opacity 0.5s ease-in-out;
  opacity: 0; /* fade-in stays */
  text-transform: uppercase;
  text-align: center;
  color: var(--neon-gold);
  paint-order: fill stroke;
  text-shadow:
    0 0 10px var(--neon-gold-glow),
    0 0 30px rgba(255,217,106,.2),
    0 2px 4px rgba(0,0,0,.5);
}
.result.heads{
  color: var(--neon-pink);
  text-shadow:
    0 0 10px var(--neon-pink-glow),
    0 0 30px rgba(255,110,199,.25),
    0 2px 4px rgba(0,0,0,.5);
}
.result.tails{
  color: var(--neon-cyan);
  text-shadow:
    0 0 10px var(--neon-cyan-glow),
    0 0 30px rgba(0,212,255,.25),
    0 2px 4px rgba(0,0,0,.5);
}

/* ---- History section ---- */
.history{
  margin-top: clamp(12px, 2.5vw, 18px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* ---- History strip (flex wrap dot layout) ---- */
.history-strip{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px;
  overflow: hidden;
  flex: 1;
  border-radius: 14px;
  border: 1px solid rgba(255,217,106,.12);
  background:
    linear-gradient(180deg,
      rgba(255,217,106,.03) 0%,
      rgba(0,0,0,.12) 100%);
}

/* Each item = one toss result dot */
.history-item{
  width: 28px;
  height: 28px;
  border-radius: 50%;
  animation: dot-in .3s ease-out both;
}

/* Heads = neon pink */
.history-item.heads{
  background-color: var(--neon-pink);
  box-shadow:
    0 0 10px var(--neon-pink-glow),
    0 0 30px rgba(255,110,199,.2);
}

/* Tails = neon cyan */
.history-item.tails{
  background-color: var(--neon-cyan);
  box-shadow:
    0 0 10px var(--neon-cyan-glow),
    0 0 30px rgba(0,212,255,.2);
}

@keyframes dot-in{
  from{ opacity:0; transform: scale(0); }
  to{ opacity:1; transform: scale(1); }
}

/* Responsive */
@media (max-width: 980px){
  .app{ grid-template-columns: 1fr; }
  .coin{ width: min(48vh, 80vw); }
}

.brand .logo{
  display:block;
  margin: 0 auto 8px auto;
  width: clamp(180px, 50vw, 320px);
  height: auto;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,.35));
  user-select: none;
  pointer-events: none;
}

.site-footer{
  text-align:center;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 10px 8px 0;
}

.controls{ display: none; }

#toss-button{ display:none; }

/* Fullscreen toggle button */
.fs-toggle{
  position: fixed;
  right: clamp(12px, 2.5vw, 20px);
  bottom: clamp(12px, 2.5vw, 20px);
  z-index: 9999;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(15, 23, 42, .45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .15s ease, opacity .2s ease, background .2s ease;
  color: var(--text);
}
.fs-toggle:hover{ transform: translateY(-1px); background: rgba(15, 23, 42, .55); }
.fs-toggle:active{ transform: translateY(0); }
.fs-toggle .icon{ width: 22px; height: 22px; fill: currentColor; display: none; }
.fs-toggle .icon.enter{ display: block; }
.fs-toggle[data-state="exit"] .icon.enter{ display: none; }
.fs-toggle[data-state="exit"] .icon.exit{ display: block; }
