@import url("./design-system/colors_and_type.css");

/* ============ SPACE BET — site styles ============ */
:root {
  color-scheme: light;
  --tb-bg: #ffffff;
  --tb-bg-alt: #f7f7f8;
  --tb-bg-card: #ffffff;
  --tb-line: rgba(112, 115, 124, 0.22);
  --tb-line-soft: rgba(112, 115, 124, 0.12);
  --tb-text: #1b1c1e;
  --tb-text-soft: rgba(46, 47, 51, 0.72);
  --tb-text-mute: rgba(55, 56, 60, 0.51);
  --tb-text-disable: rgba(55, 56, 60, 0.28);
  --tb-fill-soft: rgba(112, 115, 124, 0.06);
  --tb-fill: rgba(112, 115, 124, 0.10);
  --tb-fill-strong: rgba(112, 115, 124, 0.16);
  --tb-primary: #0066ff;
  --tb-primary-strong: #005eeb;
  --tb-primary-tint: #eaf2fe;
  --tb-positive: #00872f;
  --tb-positive-tint: #e0fcec;
  --tb-negative: #e53030;
  --tb-negative-tint: #ffe7e7;
  --tb-caution: #ed5b00;
  --tb-caution-tint: #fff1e6;
  --tb-shadow-card: 0 1px 3px 0 rgba(23, 23, 23, 0.06), 0 0 0 1px rgba(112, 115, 124, 0.10);
  --tb-shadow-strong: 0 6px 16px 0 rgba(0, 0, 0, 0.10), 0 0 1px 0 rgba(0, 0, 0, 0.08);
  --tb-shadow-emphasize: 0 1px 4px 0 rgba(0, 0, 0, 0.08), 0 0 4px 0 rgba(0, 0, 0, 0.04);
  --tb-glow-primary: none;
}

/* ============ Crypto Casino Dashboard — dark (default) ============
   Deep-navy canvas, electric-blue accent, blue-grey secondary text.
   Premium iGaming look: glass panels, soft inner light, restrained neon glow. */
[data-theme="dark"] {
  color-scheme: dark;
  --tb-bg: #070C1E;          /* deepest navy — header / sidebar / footer base */
  --tb-bg-alt: #0A1030;      /* page canvas */
  --tb-bg-card: #111A38;     /* glass panel base */
  --tb-line: rgba(96, 138, 230, 0.16);
  --tb-line-soft: rgba(96, 138, 230, 0.09);
  --tb-text: #EAF1FF;
  --tb-text-soft: rgba(185, 201, 235, 0.80);
  --tb-text-mute: rgba(143, 164, 208, 0.62);
  --tb-text-disable: rgba(143, 164, 208, 0.32);
  --tb-fill-soft: rgba(96, 138, 230, 0.06);
  --tb-fill: rgba(96, 138, 230, 0.11);
  --tb-fill-strong: rgba(96, 138, 230, 0.20);
  --tb-primary: #2E80FF;     /* electric blue */
  --tb-primary-strong: #1C6BFF;
  --tb-primary-tint: rgba(46, 128, 255, 0.16);
  --tb-positive: #2FD27C;
  --tb-positive-tint: rgba(47, 210, 124, 0.15);
  --tb-negative: #FF5C6C;
  --tb-negative-tint: rgba(255, 92, 108, 0.15);
  --tb-caution: #FF9A3D;
  --tb-caution-tint: rgba(255, 154, 61, 0.15);
  --tb-shadow-card: 0 10px 30px 0 rgba(2, 6, 22, 0.55), inset 0 1px 0 0 rgba(255, 255, 255, 0.05), 0 0 0 1px rgba(96, 138, 230, 0.08);
  --tb-shadow-strong: 0 16px 44px 0 rgba(2, 6, 22, 0.62), inset 0 1px 0 0 rgba(255, 255, 255, 0.06), 0 0 0 1px rgba(96, 138, 230, 0.12);
  --tb-shadow-emphasize: 0 4px 16px 0 rgba(2, 6, 22, 0.45), inset 0 1px 0 0 rgba(255, 255, 255, 0.04);
  --tb-glow-primary: 0 0 0 1px rgba(46, 128, 255, 0.35), 0 8px 22px rgba(46, 128, 255, 0.40);
}

/* Deep-navy canvas with a soft electric aura up top — sets the premium mood. */
[data-theme="dark"] body {
  background-color: var(--tb-bg-alt);
  background-image:
    radial-gradient(110% 70% at 50% -12%, rgba(46, 128, 255, 0.12), transparent 60%),
    radial-gradient(90% 60% at 100% 0%, rgba(46, 128, 255, 0.06), transparent 55%);
  background-attachment: fixed;
}

/* Glass panels: navy base + faint top inner-light + soft drop & rim glow.
   Excludes the hero cards, which carry their own gradient. */
[data-theme="dark"] .tb-card:not(.tb-hero-blue):not(.tb-hero-dark) {
  background:
    linear-gradient(180deg, rgba(120, 165, 255, 0.07), rgba(120, 165, 255, 0) 42%),
    var(--tb-bg-card) !important;
  border-color: var(--tb-line-soft) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 30px rgba(2, 6, 22, 0.45);
}
[data-theme="dark"] .tb-card.tb-hoverable:not(.tb-hero-blue):not(.tb-hero-dark):hover {
  border-color: rgba(46, 128, 255, 0.45) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 38px rgba(2, 6, 22, 0.55),
    0 0 24px rgba(46, 128, 255, 0.26);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--w-font-sans);
  background: var(--tb-bg-alt);
  color: var(--tb-text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" on;
  transition: background-color .2s cubic-bezier(.2,0,0,1), color .2s cubic-bezier(.2,0,0,1);
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* utility */
.tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" on; }

/* Dark mode: monochrome (currentColor) icons render black via <img>, so flip
   them to white. Icons with an inline `filter` (brand tints, already-white
   icons on colored fills) override this and keep their intended color. */
[data-theme="dark"] .tb-icon { filter: brightness(0) invert(1); }
/* Quick-games shortcut icons: override their brand-tint inline filter so they go white in dark mode. */
[data-theme="dark"] .qg-icon { filter: brightness(0) invert(1) !important; }

/* Hero CTA button box — visible in both themes.
   Light: #70737c @ 6% on the light card · Dark: #ffffff @ 8% on the dark card.
   (Arrow follows the icon's theme color: dark on the light box, white on the dark box.) */
.tb-hero-cta {
  background: rgba(112, 115, 124, 0.06);
  color: var(--tb-primary);
}
[data-theme="dark"] .tb-hero-cta {
  background: rgba(255, 255, 255, 0.08);
}

/* Hero slide indicator dots — theme-aware so they show on the card in both modes. */
.tb-hero-dot { background: rgba(112, 115, 124, 0.32); }
.tb-hero-dot.active { background: rgba(112, 115, 124, 0.85); }
[data-theme="dark"] .tb-hero-dot { background: rgba(255, 255, 255, 0.4); }
[data-theme="dark"] .tb-hero-dot.active { background: #ffffff; }

/* Header nav hover submenu — vertical roll-down reveal (panel + staggered items). */
@keyframes tb-nav-roll-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tb-nav-roll {
  transform-origin: top center;
  animation: tb-nav-roll-in .18s cubic-bezier(.2,0,0,1) both;
}
.tb-nav-roll-item {
  opacity: 0;
  animation: tb-nav-roll-in .3s cubic-bezier(.2,0,0,1) both;
  transition: background .12s;
}

/* Active header-nav item — blue bar + downward neon glow */
@keyframes tb-nav-bar-in {
  from { opacity: 0; transform: translateX(-50%) scaleX(0.5); }
  to   { opacity: 1; transform: translateX(-50%) scaleX(1); }
}
.tb-nav-active-bar {
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: calc(100% - 14px);
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #2E80FF 0%, #5BA3FE 100%);
  box-shadow:
    0 1px 8px 1px rgba(46,128,255,0.95),
    0 4px 16px 2px rgba(46,128,255,0.6),
    0 8px 26px 4px rgba(46,128,255,0.35);
  pointer-events: none;
  transform: translateX(-50%);
  transform-origin: bottom center;
}
@media (prefers-reduced-motion: no-preference) {
  .tb-nav-active-bar { animation: tb-nav-bar-in .22s cubic-bezier(.2,0,0,1) both; }
}

/* Dark mode: design-system h1–h5 rules hardcode a light-theme label color that
   the dark theme doesn't remap. Force headings to the theme text color. */
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3, [data-theme="dark"] h4, [data-theme="dark"] h5 { color: var(--tb-text); }
.elev-card { box-shadow: var(--tb-shadow-card); }
.elev-strong { box-shadow: var(--tb-shadow-strong); }

/* scrollbar (subtle) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--tb-fill-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* keyframes */
@keyframes tb-fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes tb-shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }
@keyframes tb-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes tb-pulse-dot { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: 0.6; } }
@keyframes tb-flash { 0% { background: var(--tb-primary-tint); } 100% { background: transparent; } }

.tb-fade-up { animation: tb-fade-up .22s cubic-bezier(.2,0,0,1) both; }
.tb-flash { animation: tb-flash .8s cubic-bezier(.2,0,0,1); }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--tb-negative); animation: tb-pulse-dot 1.4s ease-in-out infinite; }

/* hero gradient (electric navy, premium iGaming — restrained glow, no slop).
   !important so it beats the Card primitive's inline background. */
.tb-hero-blue {
  background:
    radial-gradient(120% 140% at 88% 8%, rgba(140,185,255,0.30), transparent 55%),
    linear-gradient(135deg, #2E80FF 0%, #0B3CC0 100%) !important;
}
[data-theme="dark"] .tb-hero-blue {
  background:
    radial-gradient(120% 140% at 88% 8%, rgba(96,165,255,0.32), transparent 55%),
    linear-gradient(135deg, #1E63E6 0%, #0A2C86 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 0 0 1px rgba(80,140,255,0.28), 0 16px 44px rgba(8,28,90,0.55);
}
.tb-hero-dark {
  background:
    radial-gradient(120% 140% at 90% 10%, rgba(51,133,255,0.28), transparent 55%),
    linear-gradient(135deg, #1b1c1e 0%, #000 100%);
}
[data-theme="dark"] .tb-hero-dark {
  background:
    radial-gradient(120% 140% at 88% 8%, rgba(46,128,255,0.36), transparent 55%),
    linear-gradient(140deg, #0E1C42 0%, #060B1C 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 0 0 1px rgba(70,130,255,0.18), 0 16px 44px rgba(2,6,22,0.6);
}
[data-theme="dark"] .tb-hero-cta:hover { background: rgba(255,255,255,0.16); }

/* ============ Micro-interactions ============
   Decorative hover/press polish. Gated on prefers-reduced-motion so users who
   opt out of motion get the plain, unanimated UI. */
@media (prefers-reduced-motion: no-preference) {
  /* Hoverable cards — gentle lift + elevated shadow */
  .tb-card.tb-hoverable { transition: transform .2s cubic-bezier(.2,0,0,1), box-shadow .2s cubic-bezier(.2,0,0,1), border-color .2s; }
  .tb-card.tb-hoverable:hover { transform: translateY(-3px); box-shadow: var(--tb-shadow-strong); }
  .tb-card.tb-hoverable:active { transform: translateY(-1px); transition-duration: .08s; }

  /* Quick-game shortcuts — each game lights up in its own brand tint */
  .qg-card { position: relative; overflow: hidden; }
  .qg-card::before {
    content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0;
    background: radial-gradient(125% 120% at 100% 0%, var(--qg-tint, var(--tb-primary)), transparent 58%);
    transition: opacity .3s cubic-bezier(.2,0,0,1);
  }
  .qg-card:hover::before { opacity: .10; }
  .qg-card.tb-hoverable:hover { border-color: color-mix(in srgb, var(--qg-tint, var(--tb-primary)) 40%, var(--tb-line-soft)); }
  .qg-icon-wrap { transition: transform .32s cubic-bezier(.34,1.56,.64,1), filter .3s cubic-bezier(.2,0,0,1); will-change: transform; }
  .qg-card:hover .qg-icon-wrap {
    transform: scale(1.12) rotate(-5deg);
    filter: drop-shadow(0 8px 16px color-mix(in srgb, var(--qg-tint, var(--tb-primary)) 50%, transparent));
  }
  .qg-label { transition: color .2s; }
  .qg-card:hover .qg-label { color: var(--qg-tint, var(--tb-primary)); }

  /* "전체보기 →" style links — arrow nudges, text firms up */
  .tb-link { transition: color .15s; }
  .tb-link:hover { color: var(--tb-text); }
  .tb-link .tb-icon, .tb-link-arrow .tb-icon { transition: transform .2s cubic-bezier(.2,0,0,1); }
  .tb-link:hover .tb-icon, .tb-link-arrow:hover .tb-icon { transform: translateX(3px); }

  /* List rows (notices etc.) — soft highlight on hover */
  .tb-row { transition: background .14s; border-radius: 8px; }
  .tb-row:hover { background: var(--tb-fill-soft); }

  /* Promo tiles — lean toward the pointer */
  .tb-promo { transition: transform .16s cubic-bezier(.2,0,0,1); cursor: pointer; }
  .tb-promo:hover { transform: translateX(3px); }

  /* Buttons — tactile press + faint brighten */
  .tb-btn:hover { filter: brightness(1.04); }
  .tb-btn:active { transform: scale(.97); }

  /* Odds buttons — quick press */
  .tb-odds:active { transform: scale(.96); }

  /* Casino tiles — slow image push-in beneath the card lift */
  .tb-casino-media { transition: transform .45s cubic-bezier(.2,0,0,1); will-change: transform; }
  .tb-card.tb-hoverable:hover .tb-casino-media { transform: scale(1.06); }

  /* Hero CTA — arrow nudge + press */
  .tb-hero-cta { transition: background .15s, transform .12s; }
  .tb-hero-cta:hover { background: rgba(112,115,124,0.12); }
  .tb-hero-cta:active { transform: scale(.97); }
}
[data-theme="dark"] .tb-hero-cta:hover { background: rgba(255,255,255,0.14); }

/* ============ Buttons — from "버튼.fig" Set1 ============
   기본: #053CF8→#1C2FFF gradient + gradient border (#1589FE→#0111B3)
         + 3px hard bottom edge + 20px blue glow.
   호버: cyan neon glow fades in on top & bottom edges + subtle lift. */
.tb-btn--primary {
  position: relative;
  isolation: isolate;
  color: #fff;
  border: 1px solid transparent;
  background-image:
    linear-gradient(180deg, #053CF8 0%, #1C2FFF 100%),
    linear-gradient(180deg, #1589FE 0%, #0111B3 100%);
  background-origin: padding-box, border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 3px 0 0 rgba(0,0,0,0.5), 0 0 20px 0 rgba(15,54,251,0.5);
}
/* cyan neon-edge layer — fades in on hover */
.tb-btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background-image:
    radial-gradient(45px 16px at 50% 0%, rgb(0,220,255) 0%, rgba(0,220,255,0) 100%),
    radial-gradient(45px 16.5px at 50% 100%, rgb(0,220,255) 0%, rgba(0,220,255,0) 100%);
  opacity: 0;
}
.tb-btn--navy {
  background: linear-gradient(180deg, #1E2540 0%, #1F367B 100%);
  color: #fff;
  border: 1px solid rgba(92,119,214,0.4);
  box-shadow: 0 6px 16px rgba(4,10,40,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
}
@media (prefers-reduced-motion: no-preference) {
  .tb-btn--primary { transition: box-shadow .22s ease, transform .15s cubic-bezier(.2,0,0,1); }
  .tb-btn--primary::before { transition: opacity .25s ease; }
  .tb-btn--navy { transition: box-shadow .18s ease, border-color .18s ease, transform .15s cubic-bezier(.2,0,0,1); }
}
.tb-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 0 rgba(0,0,0,0.5), 0 0 28px 2px rgba(15,54,251,0.7);
}
.tb-btn--primary:hover::before { opacity: 1; }
.tb-btn--primary:active { transform: translateY(1px); box-shadow: 0 1px 0 0 rgba(0,0,0,0.5), 0 0 18px 0 rgba(15,54,251,0.55); }
.tb-btn--navy:hover {
  border-color: rgba(120,150,235,0.75);
  box-shadow:
    0 -6px 18px rgba(70,120,255,0.45),
    0 8px 22px rgba(70,120,255,0.45),
    0 6px 16px rgba(4,10,40,0.55),
    inset 0 1px 0 rgba(255,255,255,0.12);
}
.tb-btn--navy:active { transform: translateY(1px); }

/* ============ Left sidebar menu — from the .fig "Set4" component ============ */
.tb-sb-item {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 8px;
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 600; letter-spacing: -0.012em;
  color: var(--tb-text); background: transparent;
  transition: background .14s;
}
.tb-sb-item:hover { background: rgba(96,138,230,0.10); }
.tb-sb-item.active { background: rgba(46,128,255,0.14); }
.tb-sb-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  background: #6478B0;
  transition: background .16s;
}
.tb-sb-item:hover .tb-sb-icon,
.tb-sb-item.active .tb-sb-icon {
  background: linear-gradient(180deg, #455DF1 0%, #5BA3FE 100%);
}
.tb-sb-chev {
  width: 13px; height: 13px; flex-shrink: 0;
  background: rgba(156,178,255,0.5);
  transition: transform .16s;
}
.tb-sb-item:hover .tb-sb-chev { transform: translateX(2px); }
