/* ============================================================
   MINEX — Mines USDT | Neo-Brutalist UI (emerald + gold)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0f0d;
  --surface: #f3efe2;
  --ink: #07120d;
  --muted: #5f6b63;

  --emerald: #2fd98c;
  --emerald-deep: #16a36a;
  --gold: #ffc24b;
  --red: #ff4d4d;

  --border: 3px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 4px 4px 0 var(--ink);
  --shadow-emerald: 6px 6px 0 var(--emerald-deep);
  --shadow-gold: 6px 6px 0 var(--gold);

  --font-display: 'Syne', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --max: 1080px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--surface);
  font-family: var(--font-mono);
  overflow-x: hidden;
  position: relative;
}

a { color: inherit; text-decoration: none; }

/* ---------- Background layers ---------- */
.grain {
  pointer-events: none; position: fixed; inset: 0; z-index: 0; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
}
.grid-bg {
  pointer-events: none; position: fixed; inset: 0; z-index: 0; opacity: .05;
  background-image:
    linear-gradient(rgba(243,239,226,.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(243,239,226,.5) 1px, transparent 1px);
  background-size: 48px 48px;
}
body::before {
  content: ''; position: fixed; top: -20vh; right: -10vw; width: 55vw; height: 55vw;
  background: var(--emerald); opacity: .14; filter: blur(120px); pointer-events: none; z-index: 0;
}
body::after {
  content: ''; position: fixed; bottom: -15vh; left: -8vw; width: 42vw; height: 42vw;
  background: var(--gold); opacity: .08; filter: blur(110px); pointer-events: none; z-index: 0;
}

.top, main, .foot { position: relative; z-index: 1; }

/* ---------- Header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.5rem; max-width: var(--max); margin: 0 auto; width: 100%;
}
.logo-text {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(1.45rem, 2.8vw, 1.8rem);
  letter-spacing: -.02em; text-transform: uppercase; line-height: 1;
}
.logo-mine { color: var(--surface); }
.logo-x { color: var(--emerald); }
.foot-brand .logo-mine, .foot-brand .logo-x { font-family: var(--font-display); font-weight: 800; }

.top-right { display: flex; align-items: center; gap: .75rem; }

.header-cta {
  font-family: var(--font-mono); font-size: .65rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; padding: .55rem .9rem; background: var(--emerald); color: var(--ink);
  border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.header-cta:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--gold); }
.header-cta:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- Hero (centered vertical stack) ---------- */
.hero {
  display: flex; flex-direction: column; align-items: center; gap: 2rem;
  max-width: var(--max); margin: 0 auto; padding: 2rem 1rem 3.5rem; width: 100%; min-width: 0;
  scroll-margin-top: 80px;
}
.hero-side { display: contents; }
.hero-copy, .game-wrap { min-width: 0; max-width: 100%; }
.hero-copy { order: 1; text-align: center; }
.game-wrap { order: 2; width: min(900px, 100%); max-width: 100%; }

.hero-copy { animation: fadeUp .6s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.eyebrow {
  font-size: .68rem; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
  color: var(--emerald); margin-bottom: .75rem;
}
h1 {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(2.75rem, 8vw, 4.5rem);
  line-height: .92; letter-spacing: -.04em; text-transform: uppercase; margin-bottom: 1rem;
  white-space: nowrap;
}
.slash { color: var(--gold); }
.lead {
  font-size: .85rem; line-height: 1.55; color: rgba(243,239,226,.55);
  max-width: 24em; margin: 0 auto; text-wrap: balance;
}

/* ---------- Game card ---------- */
.game-wrap { animation: fadeUp .6s .1s ease both; }
.game-card {
  background: var(--surface); color: var(--ink); border: var(--border); box-shadow: var(--shadow);
  padding: 1.35rem; position: relative;
}
.game-card::before {
  content: ''; position: absolute; inset: -8px -8px 8px 8px;
  border: 2px dashed rgba(47,217,140,.4); pointer-events: none; z-index: -1;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.card-label { font-family: var(--font-display); font-weight: 800; font-size: .9rem; text-transform: uppercase; letter-spacing: .06em; }

/* Card body layout: stacked on mobile, side-by-side on desktop */
.card-body { display: flex; flex-direction: column; gap: 1.1rem; }
.panel-col { display: flex; flex-direction: column; }
.board-col { display: flex; flex-direction: column; min-width: 0; }
@media (min-width: 760px) {
  .card-body { flex-direction: row; align-items: stretch; gap: 1.75rem; }
  .panel-col { flex: 1 1 0; min-width: 0; justify-content: center; }
  .board-col { flex: 1.3 1 0; min-width: 0; justify-content: center; }
  .board-stage { width: 100%; max-width: 480px; margin: 0 auto; }
}

/* ---------- Controls ---------- */
.controls { margin-bottom: 1.1rem; }
.field-label {
  display: block; font-size: .62rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .45rem;
}

.bet-row { display: flex; gap: .5rem; margin-bottom: .65rem; }
.step-btn {
  width: 44px; flex-shrink: 0; background: var(--ink); color: var(--surface);
  border: 2px solid var(--ink); box-shadow: var(--shadow-sm); font-size: 1.3rem; font-weight: 700;
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.step-btn:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--emerald-deep); }
.step-btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.step-btn:disabled { opacity: .35; cursor: not-allowed; box-shadow: var(--shadow-sm); transform: none; }

.bet-field {
  flex: 1; display: flex; align-items: center; gap: .5rem; padding: 0 .85rem;
  background: #fff; border: 2px solid var(--ink); box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}
.bet-field:focus-within { box-shadow: 4px 4px 0 var(--emerald-deep); }
.bet-field input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; color: var(--ink); padding: .6rem 0;
  -moz-appearance: textfield;
}
.bet-field input::-webkit-outer-spin-button, .bet-field input::-webkit-inner-spin-button { -webkit-appearance: none; }
.bet-suffix { font-size: .7rem; font-weight: 600; color: var(--muted); }

.mines-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1.1rem; }
.mine-opt {
  position: relative; padding: .7rem 0; font-family: var(--font-mono); font-size: 1rem; font-weight: 600;
  cursor: pointer; background: #fff; color: var(--ink); border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .1s, box-shadow .12s;
}
.mine-opt::after { content: '✺'; position: absolute; top: 3px; right: 6px; font-size: .55rem; color: var(--red); opacity: .7; }
.mine-opt:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--red); }
.mine-opt.active { background: var(--ink); color: var(--gold); }
.mine-opt.active::after { color: var(--gold); }
.mine-opt:disabled { opacity: .45; cursor: not-allowed; box-shadow: var(--shadow-sm); transform: none; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.stat-box { background: #fff; border: 2px solid var(--ink); padding: .55rem .6rem; }
.stat-cap { display: block; font-size: .55rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.stat-val { display: block; font-family: var(--font-mono); font-size: 1.05rem; font-weight: 700; color: var(--ink); margin-top: 2px; }
.stat-val.gold { color: var(--emerald-deep); }
.stat-val.emerald { color: var(--emerald-deep); }
.stat-val.bump { animation: bump .35s cubic-bezier(.2,1.5,.4,1); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.28); color: var(--red); } 100% { transform: scale(1); } }

/* ---------- Board ---------- */
.board-stage { position: relative; }
.board {
  display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-rows: 1fr; gap: .5rem; aspect-ratio: 5 / 4;
}
.cell {
  position: relative; cursor: pointer; background: #fff; border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm); display: grid; place-items: center;
  font-size: clamp(18px, 4vw, 28px); transition: transform .1s, box-shadow .12s, background .2s;
  user-select: none;
}
.cell:not(.revealed):hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--emerald-deep); }
.cell:not(.revealed):active { transform: translate(1px,1px); box-shadow: 2px 2px 0 var(--ink); }
.cell.idle { background: #efe9da; }

.cell.revealed { cursor: default; box-shadow: none; }
.cell.gem {
  background: #e9fff4; border-color: var(--emerald-deep);
  box-shadow: inset 0 0 0 2px var(--emerald); animation: pop .3s cubic-bezier(.2,1.5,.4,1);
}
.cell .face { display: grid; place-items: center; width: 100%; height: 100%; }
.cell .face img { width: 60%; height: 60%; object-fit: contain; display: block; pointer-events: none; filter: drop-shadow(0 1px 2px rgba(7,18,13,.25)); }
.cell .face svg { width: 58%; height: 58%; display: block; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(7,18,13,.35)); }
.cell.mine {
  background: var(--red); border-color: var(--ink); animation: explode .4s cubic-bezier(.2,1.5,.4,1);
}
.cell.mine.exploded { animation: shake .45s; }
.cell.revealed.dimmed { opacity: .4; }
@keyframes pop { 0% { transform: scale(.5); } 100% { transform: scale(1); } }
@keyframes explode { 0% { transform: scale(.4) rotate(-10deg); } 60% { transform: scale(1.15) rotate(5deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

.cell-value {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%) translateY(4px);
  font-family: var(--font-mono); font-size: .62rem; font-weight: 700; letter-spacing: .02em;
  color: #fff; background: var(--ink); padding: 1px 6px; border: 1.5px solid var(--emerald);
  white-space: nowrap; opacity: 0; animation: fadeUp2 .3s .12s forwards;
}
@keyframes fadeUp2 { to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ---------- Result overlay ---------- */
.result-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(7,12,9,.55); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 5;
}
.result-overlay.show { opacity: 1; pointer-events: auto; }
.result-card {
  text-align: center; padding: 1.6rem 1.8rem; background: var(--surface); color: var(--ink);
  border: var(--border); box-shadow: var(--shadow); transform: translate(6px,6px) scale(.9);
  transition: transform .3s cubic-bezier(.2,1.4,.4,1);
}
.result-overlay.show .result-card { transform: translate(0,0) scale(1); }
.result-card.win { box-shadow: var(--shadow-emerald); }
.result-card.lose { box-shadow: 6px 6px 0 var(--red); }
.result-icon { font-size: 2.6rem; line-height: 1; margin-bottom: .35rem; }
.result-title { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; text-transform: uppercase; }
.result-amount { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; margin: .25rem 0 1rem; }
.result-card.win .result-amount { color: var(--emerald-deep); }
.result-card.lose .result-amount { color: var(--red); }
.btn-again {
  width: 100%; padding: .7rem 1rem; font-family: var(--font-display); font-weight: 800; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .06em; background: var(--ink); color: var(--surface);
  border: 2px solid var(--ink); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.btn-again:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--emerald-deep); }
.btn-again:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }

/* ---------- CTAs ---------- */
.cta-paid {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1px;
  margin: 1.2rem 0 .65rem; padding: .7rem 1rem; background: var(--emerald); color: var(--ink);
  border: var(--border); box-shadow: var(--shadow); cursor: pointer; font-family: var(--font-mono);
  transition: transform .12s, box-shadow .12s;
}
.cta-paid:hover { transform: translate(-1px,-1px); box-shadow: 7px 7px 0 var(--gold); }
.cta-paid:active { transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--ink); }
.cta-paid-top { font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; opacity: .75; }
.cta-paid-amount { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; }

.cta-dual { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.cta-demo, .cta-cashout {
  padding: .7rem; font-family: var(--font-display); font-weight: 800; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .06em; border: var(--border); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.cta-demo { background: var(--ink); color: var(--surface); }
.cta-demo:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--emerald-deep); }
.cta-demo:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.cta-cashout { background: var(--gold); color: var(--ink); }
.cta-cashout:not(:disabled):hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--ink); }
.cta-cashout:not(:disabled):active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.cta-cashout:disabled { opacity: .4; cursor: not-allowed; box-shadow: var(--shadow-sm); }
.cta-demo:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Rules ---------- */
.rules {
  order: 3; width: min(900px, 100%); max-width: 100%; margin-top: 1rem;
  animation: fadeUp .6s .15s ease both;
}
.rules-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.rules-kicker {
  font-size: .6rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink); background: var(--emerald); padding: .25rem .55rem; border: 2px solid var(--ink);
}
.rules-title { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; text-transform: uppercase; letter-spacing: -.01em; }

.rules-list { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: .85rem; }
.rule {
  display: flex; align-items: flex-start; gap: .9rem; padding: 1.1rem;
  background: rgba(243,239,226,.03); border: 2px solid rgba(243,239,226,.12);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.rule:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--emerald-deep); border-color: var(--emerald); }
.rule-n {
  flex-shrink: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; line-height: 1;
  color: var(--ink); background: var(--gold); border: 2px solid var(--ink); padding: .3rem .5rem; box-shadow: 3px 3px 0 var(--ink);
}
.rule-body h3 { font-family: var(--font-display); font-weight: 800; font-size: .9rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .35rem; }
.rule-body p { font-size: .72rem; line-height: 1.6; color: rgba(243,239,226,.5); }

/* ---------- Footer ---------- */
.foot {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 1.75rem 1.5rem 2.25rem; border-top: 2px solid rgba(243,239,226,.08); background: rgba(7,12,9,.4);
}
@media (min-width: 640px) {
  .foot { flex-direction: row; justify-content: space-between; max-width: var(--max); margin: 0 auto; width: 100%; }
}
.foot-brand { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.foot-links { display: flex; gap: 1.25rem; }
.foot-links a { font-size: .62rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: rgba(243,239,226,.35); transition: color .15s; }
.foot-links a:hover { color: var(--emerald); }
.foot-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; font-size: .6rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: rgba(243,239,226,.3); }
.foot-sep { opacity: .4; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(5,9,7,.78); backdrop-filter: blur(4px); }
.modal-box {
  position: relative; z-index: 1; width: 100%; max-width: 480px; max-height: min(85dvh, 580px);
  display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border: var(--border); box-shadow: var(--shadow); animation: modalPop .25s cubic-bezier(.2,1.4,.4,1);
}
@keyframes modalPop { from { transform: translate(6px,6px) scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.25rem; border-bottom: 3px solid var(--ink); flex-shrink: 0;
}
.modal-title { font-family: var(--font-display); font-weight: 800; font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; }
.modal-close {
  display: flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  font-size: 1.4rem; line-height: 1; background: var(--emerald); color: var(--ink);
  border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); cursor: pointer; flex-shrink: 0;
}
.modal-close:hover { background: var(--gold); }
.modal-close:active { box-shadow: none; transform: translate(2px,2px); }
.modal-body { padding: 1.25rem; overflow-y: auto; font-size: .78rem; line-height: 1.7; color: var(--muted); }
.modal-body h3 {
  font-family: var(--font-display); font-weight: 800; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink); margin: 1.1rem 0 .4rem;
}
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { margin-bottom: .65rem; }
.modal-body p:last-child { margin-bottom: 0; }
body.modal-open { overflow: hidden; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 1.5rem);
  padding: .7rem 1.1rem; font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  background: var(--surface); color: var(--ink); border: 2px solid var(--ink); box-shadow: var(--shadow-sm);
  opacity: 0; pointer-events: none; transition: .25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; }
.toast.ok { background: var(--emerald); }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .top { flex-direction: column; gap: .75rem; padding: .85rem 1rem; }
  .top-right { width: 100%; flex-direction: column; }
  .header-cta { width: 100%; justify-content: center; }
  h1 { font-size: clamp(1.15rem, 7vw, 3rem); letter-spacing: -.03em; }
  .game-card { padding: 1rem; border-width: 2px; box-shadow: 4px 4px 0 var(--ink); }
  .game-card::before { display: none; }
  .stat-row { grid-template-columns: 1fr; }
  .board { gap: .35rem; }
  .rules-list { grid-template-columns: 1fr; }
  .foot-links { flex-wrap: wrap; justify-content: center; }
  .foot-meta { justify-content: center; text-align: center; }
}
