/* Extreme Demon Gacha - shared stylesheet */
:root {
  --bg: #0a0810;
  --bg-2: #120d1c;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f2eefb;
  --muted: #a79fbd;
  --accent: #f0b866;
  --accent-2: #7dd3fc;

  --tier-common: #9aa4b2;
  --tier-rare: #4f9dff;
  --tier-epic: #a86bff;
  --tier-legendary: #ffb020;
  --tier-mythic: #ff4d6d;

  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* author styles must never beat the [hidden] attribute (display:grid on .modal-backdrop used to do exactly that) */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--ui);
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(168, 107, 255, 0.16), transparent 60%),
    radial-gradient(900px 560px at 92% 4%, rgba(240, 184, 102, 0.12), transparent 62%),
    linear-gradient(180deg, #0a0810 0%, #120d1c 55%, #0a0810 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: 0.2px; margin: 0; }

.wrap { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(10, 8, 16, 0.78);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 19px; letter-spacing: 0.3px; }
.brand img { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line-strong); background: #0f0c16; }
.brand small { display: block; font-family: var(--ui); font-size: 11px; color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; }
.main-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.main-nav a {
  padding: 7px 13px; border-radius: 999px; font-size: 14px; color: var(--muted);
  border: 1px solid transparent; transition: 0.18s ease;
}
.main-nav a:hover { color: var(--text); background: var(--surface); }
.main-nav a[aria-current="page"] { color: #1a1206; background: linear-gradient(135deg, #ffd08a, var(--accent)); border-color: transparent; font-weight: 600; }
.header-packs {
  display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 13px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); white-space: nowrap;
}
.header-packs b { font-size: 15px; }
.pip { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* ---------- hero / pack panel ---------- */
.hero { padding: 58px 0 30px; display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 42px; align-items: start; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px; font-size: 12px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--accent); margin: 0 0 14px;
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: linear-gradient(90deg, transparent, var(--accent)); }
.hero h1 { font-size: clamp(38px, 6.4vw, 68px); line-height: 1.02; margin-bottom: 16px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero h1 span { display: block; }
.lede { color: var(--muted); font-size: 17px; max-width: 54ch; margin: 0 0 22px; }
.hero-facts { display: flex; gap: 10px; flex-wrap: wrap; }
.fact {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; color: var(--muted);
}
.fact b { color: var(--text); }

.panel {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: var(--shadow);
}
.pack-panel { position: sticky; top: 84px; }
.pack-count-label { font-size: 12px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); }
.pack-count { font-family: var(--display); font-size: 62px; line-height: 1; margin: 4px 0 2px; }
.pack-count small { font-size: 20px; color: var(--muted); }
.pack-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }

.timer { background: rgba(0, 0, 0, 0.32); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; }
.timer-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.timer-value { font-variant-numeric: tabular-nums; font-family: var(--display); font-size: 24px; letter-spacing: 1px; }
.timer-bar { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 9px; }
.timer-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 1s linear; }
.timer.full .timer-value { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 15px 22px; border-radius: 12px; border: 1px solid transparent;
  font-size: 16px; font-weight: 650; cursor: pointer; transition: 0.18s ease;
}
.btn-primary { background: linear-gradient(135deg, #ffd08a, var(--accent) 55%, #e09a3c); color: #1d1204; box-shadow: 0 10px 30px rgba(240, 184, 102, 0.25); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(240, 184, 102, 0.35); }
.btn-primary:disabled { opacity: 0.42; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { width: auto; padding: 8px 15px; font-size: 13px; border-radius: 9px; }
.hint { font-size: 12px; color: var(--muted); text-align: center; margin: 12px 0 0; }

/* ---------- reveal ---------- */
.reveal-area { margin-top: 26px; }
.reveal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.reveal-head h2 { font-size: 24px; }
.reveal-note { font-size: 13px; color: var(--muted); }
.slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.slot { aspect-ratio: 3 / 4.2; perspective: 1200px; }
.flip { width: 100%; height: 100%; position: relative; }
.flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.62s cubic-bezier(0.22, 0.9, 0.24, 1); transform: rotateY(180deg); }
.flip.revealed .flip-inner { transform: rotateY(0deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--radius); overflow: hidden; }
.flip-back {
  transform: rotateY(180deg);
  border: 1px solid var(--line-strong);
  background:
    repeating-linear-gradient(45deg, rgba(240, 184, 102, 0.12) 0 10px, transparent 10px 20px),
    linear-gradient(160deg, #241a33, #140f1e);
  display: grid; place-items: center;
  font-family: var(--display); font-size: 13px; letter-spacing: 4px; color: rgba(240, 184, 102, 0.85);
}
.flip-front { transform: rotateY(0deg); display: flex; flex-direction: column; }
.flip-front .card-media { flex: 0 0 auto; }
.flip-front .card-body { flex: 1 1 auto; height: auto; min-height: 0; overflow: hidden; }
.flip-front::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 45%);
}
.card-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #0d0a14; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-tier {
  position: absolute; left: 8px; top: 8px; font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(4px);
  border: 1px solid currentColor; font-weight: 700;
}
.card-body { padding: 11px 12px 13px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)); height: calc(100% - 62.5%); display: flex; flex-direction: column; }
.card-body h3 { font-size: 16px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-creator { font-size: 11.5px; color: var(--muted); margin: 2px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-desc {
  font-size: 11.5px; line-height: 1.45; color: var(--muted); margin: 0 0 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-score { font-size: 12px; color: var(--muted); }
.card-score b { color: var(--accent); font-size: 15px; }
.badge-new { font-size: 10px; letter-spacing: 1px; font-weight: 800; color: #06210f; background: #63e6a0; padding: 2px 7px; border-radius: 999px; }
.badge-dup { font-size: 10px; letter-spacing: 1px; color: var(--muted); border: 1px solid var(--line); padding: 2px 7px; border-radius: 999px; }

.tier-common .card-tier { color: var(--tier-common); }
.tier-rare .card-tier { color: var(--tier-rare); }
.tier-epic .card-tier { color: var(--tier-epic); }
.tier-legendary .card-tier { color: var(--tier-legendary); }
.tier-mythic .card-tier { color: var(--tier-mythic); }
.tier-common .flip-front, .tier-common .card { border-color: rgba(154, 164, 178, 0.45); }
.tier-rare .flip-front, .tier-rare .card { border-color: rgba(79, 157, 255, 0.55); }
.tier-epic .flip-front, .tier-epic .card { border-color: rgba(168, 107, 255, 0.6); }
.tier-legendary .flip-front, .tier-legendary .card { border-color: rgba(255, 176, 32, 0.75); }
.tier-mythic .flip-front, .tier-mythic .card { border-color: rgba(255, 77, 109, 0.85); }
.tier-legendary .flip-front, .tier-mythic .flip-front { box-shadow: 0 0 34px rgba(255, 176, 32, 0.28); }
.tier-mythic .flip-front { box-shadow: 0 0 40px rgba(255, 77, 109, 0.34); animation: mythicPulse 2.4s ease-in-out infinite; }
@keyframes mythicPulse { 0%, 100% { box-shadow: 0 0 34px rgba(255, 77, 109, 0.3); } 50% { box-shadow: 0 0 54px rgba(255, 77, 109, 0.5); } }

/* ---------- sections ---------- */
.section { padding: 54px 0; border-top: 1px solid var(--line); }
.section-head { margin-bottom: 22px; }
.section-head h2 { font-size: 28px; margin-bottom: 6px; }
.section-head p { color: var(--muted); margin: 0; font-size: 15px; max-width: 70ch; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* ---------- collection ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); }
select, input[type="search"], input[type="number"] {
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; min-width: 150px; outline: none;
}
select:focus, input:focus { border-color: var(--accent); }
.collection-stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.collection-stats b { color: var(--text); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.card {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card .card-media { aspect-ratio: 16 / 9; }
.card .card-body { height: auto; }
.card.locked .card-media img { filter: grayscale(1) brightness(0.22) contrast(0.6); }
.card.locked .card-body { color: var(--muted); }
.card.locked .card-tier { opacity: 0.5; }
.lock-mark {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-family: var(--display); font-size: 30px; color: rgba(255, 255, 255, 0.4);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}
.card-count {
  position: absolute; right: 8px; top: 8px; font-size: 11px; font-weight: 700;
  background: rgba(0, 0, 0, 0.7); border: 1px solid var(--line-strong); border-radius: 999px; padding: 2px 8px;
}
.rarity-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 13px;
  font-size: 13px; cursor: pointer; color: var(--muted); transition: 0.16s ease;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { color: #1a1206; background: linear-gradient(135deg, #ffd08a, var(--accent)); border-color: transparent; font-weight: 650; }

/* ---------- simulator ---------- */
.sim-controls { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 20px; }
.sim-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sim-table th, .sim-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.sim-table th { font-size: 11px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sim-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rate-bar { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; min-width: 90px; }
.rate-bar i { display: block; height: 100%; border-radius: 99px; }
.tier-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.sim-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 14px 16px; }
.stat span { display: block; font-size: 11px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); }
.stat b { font-family: var(--display); font-size: 26px; }

/* ---------- trade ---------- */
.trade-side { display: flex; flex-direction: column; }
.trade-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.trade-head h3 { font-size: 19px; }
.trade-total { font-family: var(--display); font-size: 30px; }
.trade-total small { font-size: 12px; color: var(--muted); font-family: var(--ui); }
.trade-picker { max-height: 330px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: rgba(0, 0, 0, 0.22); }
.trade-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; cursor: pointer; transition: 0.14s; }
.trade-row:hover { background: var(--surface); }
.trade-row img { width: 54px; height: 32px; object-fit: cover; border-radius: 6px; flex: none; }
.trade-row .nm { font-size: 13.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-row .sc { font-size: 12px; color: var(--accent); font-variant-numeric: tabular-nums; }
.trade-row .qty { font-size: 11px; color: var(--muted); }
.trade-row.picked { background: rgba(240, 184, 102, 0.1); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; min-height: 30px; }
.trade-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
}
.trade-chip button { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; padding: 0; }
.trade-chip button:hover { color: #ff7a90; }
.verdict { margin-top: 18px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: center; }
.verdict b { font-family: var(--display); font-size: 20px; display: block; margin-bottom: 4px; }
.verdict span { font-size: 13px; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 34px 0 44px; color: var(--muted); font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: center; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a:hover { color: var(--text); }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(4, 3, 8, 0.78); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; z-index: 60; }
.modal { width: min(430px, 100%); border: 1px solid var(--line-strong); border-radius: 18px; background: linear-gradient(160deg, #1a1426, #100c19); padding: 22px; box-shadow: var(--shadow); }
.modal h3 { font-size: 22px; margin-bottom: 10px; }
.modal p { font-size: 14px; color: var(--muted); margin: 0 0 16px; }
.modal-art { border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.modal-art img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.modal-art img.locked { filter: grayscale(1) brightness(0.22) contrast(0.6); }
.modal-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.modal-meta span { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: rgba(16, 12, 24, 0.96); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 12px 18px; font-size: 14px; opacity: 0; pointer-events: none; transition: 0.25s ease; z-index: 80;
  box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.empty { color: var(--muted); font-size: 14px; padding: 30px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 940px) {
  .hero { grid-template-columns: 1fr; gap: 26px; padding-top: 38px; }
  .pack-panel { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
  .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .wrap { width: min(1180px, calc(100% - 28px)); }
  .header-inner { height: 56px; gap: 10px; }
  .brand span { display: none; }
  .main-nav a { padding: 6px 10px; font-size: 13px; }
  .header-packs { font-size: 12px; padding: 5px 10px; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pack-count { font-size: 48px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
}
