/* ============================================
   nullscapes GAME CORNER
   luigi's picture poker × newgrounds
   dark mode only. no windows here.
   font: MS PGothic (inherited)
   ============================================ */

:root {
  /* -- felt table greens -- */
  --felt:          #1a3d2b;
  --felt-mid:      #1f4a33;
  --felt-light:    #25573c;

  /* -- gold trim -- */
  --gold:          #c9922a;
  --gold-bright:   #f0c040;
  --gold-dim:      #7a5518;

  /* -- newgrounds orange pop -- */
  --ng-orange:     #e8601c;
  --ng-orange-dim: #7a3310;

  /* -- neutrals -- */
  --cream:         #f5e9c8;
  --text:          #f0ddb0;
  --text-dim:      #a08858;
  --border:        #8a6520;
  --shadow:        rgba(0, 0, 0, 0.7);

  /* -- surfaces -- */
  --bg:            #0e1f16;
  --panel:         #152b1e;
  --panel-top:     #1c3828;
  --panel-bottom:  #0e1f16;
  --inset:         #0a1710;

  /* -- glow -- */
  --glow-gold:     rgba(201, 146, 42, 0.35);
  --glow-orange:   rgba(232, 96, 28, 0.3);
  --glow-green:    rgba(37, 87, 60, 0.5);

  --bg-pan-speed: 18s;
}

/* ============================================
   BODY — scrolling felt pattern
   ============================================ */
body {
  margin: 0;
  padding: 10px;
  font-family: 'MS PGothic', sans-serif;
  color: var(--text);
  background-color: var(--bg);

  /* felt weave pattern */
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.015) 0px,
      rgba(255,255,255,0.015) 1px,
      transparent 1px,
      transparent 6px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255,255,255,0.015) 0px,
      rgba(255,255,255,0.015) 1px,
      transparent 1px,
      transparent 6px
    ),
    linear-gradient(160deg, #0e1f16 0%, #0a1a10 50%, #0e1f16 100%);

  animation: felt-shimmer 6s ease-in-out infinite alternate;
}

@keyframes felt-shimmer {
  from { background-position: 0 0, 0 0, 0 0; }
  to   { background-position: 6px 6px, -6px 6px, 0 0; }
}

/* ============================================
   CONTAINER — casino table surface
   ============================================ */
.container {
  max-width: 80rem;
  margin: 5vw auto 12px auto;
  border: 4px solid var(--gold-dim);
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 14px;
  display: flex;
  flex-wrap: wrap;
  padding: 8px;
  gap: 8px;
  background-color: var(--panel);
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.012) 0px,
      rgba(255,255,255,0.012) 1px,
      transparent 1px,
      transparent 8px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255,255,255,0.012) 0px,
      rgba(255,255,255,0.012) 1px,
      transparent 1px,
      transparent 8px
    );
  box-shadow:
    0 0 0 1px var(--gold-dim),
    0 0 30px var(--glow-green),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

/* ============================================
   HEADER — marquee banner with neon glow
   ============================================ */
header {
  background: linear-gradient(135deg, #1a3d2b 0%, #0e2318 50%, #152b1e 100%);
  background-size: cover;
  background-position: center;
  width: 100%;
  min-height: 400px;
  border: 3px solid var(--gold-dim);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 0 60px rgba(0,0,0,0.6),
    0 0 20px var(--glow-gold);
}

/* top strip decorative border */
header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--gold) 0px,
    var(--gold) 8px,
    transparent 8px,
    transparent 14px
  );
  opacity: 0.7;
}

/* ambient light blob */
header::after {
  content: '';
  position: absolute;
  inset: -20%;
  background: radial-gradient(
    ellipse at 40% 30%,
    rgba(201, 146, 42, 0.12),
    transparent 60%
  );
  pointer-events: none;
  animation: bg-pan var(--bg-pan-speed) linear infinite;
}

header span {
  font-size: clamp(1.2rem, 4vw, 2rem);
  position: absolute;
  bottom: 0;
  right: 10px;
  margin: 10px;
  font-weight: bold;
  text-align: right;
  color: var(--gold-bright);
  text-shadow:
    0 0 8px var(--gold),
    0 0 20px var(--glow-gold),
    1px 1px 0 #000,
    -1px -1px 0 #000;
}

/* ============================================
   NAV + SECTION — panel cards
   ============================================ */
nav,
section {
  border: 2px solid var(--gold-dim);
  border-radius: 6px;
  padding: 8px;
  background: linear-gradient(160deg, var(--panel-top), var(--panel-bottom));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 2px 12px rgba(0,0,0,0.4);
  position: relative;
}

/* corner pip decoration */
nav::before,
section::before {
  content: '♦';
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.6rem;
  color: var(--gold-dim);
  opacity: 0.6;
  pointer-events: none;
}

nav div {
  text-align: center;
  font-size: 1.25rem;
  margin: 5px 5px 10px 5px;
  color: var(--gold-bright);
  text-shadow: 0 0 10px var(--glow-gold);
}

/* ============================================
   BUTTONS + NAV LINKS
   ============================================ */
nav a,
button {
  display: block;
  margin: 5px;
  background: linear-gradient(
    160deg,
    var(--felt-light) 0%,
    var(--felt) 60%,
    var(--inset) 100%
  );
  border-radius: 5px;
  padding: 8px 10px;
  text-decoration: none;
  border: 2px solid var(--gold-dim);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
  overflow: hidden;
}

/* chip stripe accent */
nav a::after,
button::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold-dim);
  opacity: 0.5;
  transition: opacity 0.18s;
}

nav a:link,
nav a:visited {
  color: var(--text);
}

nav a:hover,
nav a:focus,
button:hover,
button:focus {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  box-shadow:
    0 0 10px var(--glow-gold),
    inset 0 1px 0 rgba(255,255,255,0.08);
  outline: none;
}

nav a:hover::after,
button:hover::after {
  opacity: 1;
  background: var(--gold-bright);
}

/* primary action button — newgrounds orange */
button.primary {
  background: linear-gradient(160deg, #c04810, #7a2e08);
  border-color: var(--ng-orange);
  color: var(--cream);
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

button.primary::after {
  background: var(--ng-orange);
  opacity: 0.7;
}

button.primary:hover,
button.primary:focus {
  border-color: #ff8040;
  color: #fff;
  box-shadow: 0 0 14px var(--glow-orange), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6, p {
  margin: 5px;
  line-height: 1.3;
}

h1 {
  font-size: 1.4rem;
  letter-spacing: 2px;
  font-weight: normal;
  text-align: center;
  border-bottom: 2px solid var(--gold-dim);
  padding-bottom: 5px;
  color: var(--gold-bright);
  text-shadow: 0 0 12px var(--glow-gold);
}

h2 {
  font-size: 1.25rem;
  font-weight: normal;
  text-align: center;
  color: var(--text);
}

h4 {
  font-size: 1rem;
  color: var(--gold);
  padding-left: 12px;
}

a:hover,
a:focus {
  font-style: italic;
  color: var(--gold-bright);
}

a:visited {
  color: var(--gold-dim);
}

a:link {
  color: var(--gold);
}

/* ============================================
   ANIMATED BG PANELS
   ============================================ */
.animated-bg {
  --bg-image: linear-gradient(135deg, var(--felt-light), var(--felt));
  --tint-color: rgba(201, 146, 42, 0.18);
  --tint-color-hover: rgba(201, 146, 42, 0);
  --tint-strength: 1;
  --tint-strength-hover: 0.2;
  --tint-fade-in: 0.5s;
  --tint-fade-out: 0.3s;
  position: relative;
  overflow: hidden;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.animated-bg > * {
  position: relative;
  z-index: 1;
}

.animated-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--tint-strength);
  background:
    linear-gradient(var(--tint-color), var(--tint-color)),
    repeating-linear-gradient(
      120deg,
      rgba(255,255,255,0.03) 0 14px,
      rgba(255,255,255,0.008) 14px 28px
    );
  transition: opacity var(--tint-fade-in) ease, background var(--tint-fade-in) ease;
}

.animated-bg:hover::before,
.animated-bg:focus-within::before {
  opacity: var(--tint-strength-hover);
  background:
    linear-gradient(var(--tint-color-hover), var(--tint-color-hover)),
    repeating-linear-gradient(
      120deg,
      rgba(255,255,255,0.015) 0 14px,
      rgba(255,255,255,0) 14px 28px
    );
  transition-duration: var(--tint-fade-out), var(--tint-fade-out);
}

.animated-bg::after {
  content: '';
  position: absolute;
  inset: -10%;
  pointer-events: none;
  background: radial-gradient(
    circle at 30% 20%,
    rgba(201, 146, 42, 0.08),
    transparent 40%
  );
  mix-blend-mode: screen;
  animation: bg-pan var(--bg-pan-speed) linear infinite;
}

/* ============================================
   LAYOUT HELPERS
   ============================================ */
* { box-sizing: border-box; }

.small  { flex: 1 1 12rem; }
.large  { flex: 3 1 30rem; }
.full   { flex: 1 1 100%; }
.half   { flex: 1 1 24rem; }

/* ============================================
   CONTROLS + INPUTS
   ============================================ */
.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text-dim);
}

input {
  width: 100%;
  border: 2px solid var(--gold-dim);
  border-radius: 5px;
  padding: 8px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--inset);
  transition: border-color 0.18s;
}

input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 8px var(--glow-gold);
}

/* ============================================
   TILES — card face style
   ============================================ */
.tile {
  border: 2px solid var(--gold-dim);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 4px;
  font-size: 0.85rem;
  background: var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 2px 6px rgba(0,0,0,0.4);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tile:hover {
  border-color: var(--gold);
  box-shadow: 0 0 10px var(--glow-gold), inset 0 1px 0 rgba(255,255,255,0.06);
}

.tile .index {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.tile .value {
  font-size: 1rem;
  font-weight: bold;
  color: var(--gold-bright);
}

/* tile category colors — dark casino palette */
.air        { background: linear-gradient(160deg, #1c2e35, #111e24); }
.parsnips   { background: linear-gradient(160deg, #1c3022, #111e17); }
.cranberries{ background: linear-gradient(160deg, #351820, #220e15); }
.grapes     { background: linear-gradient(160deg, #221c40, #15112a); }
.corn       { background: linear-gradient(160deg, #3a3010, #251f08); }

/* ============================================
   META + LEGEND
   ============================================ */
.meta {
  font-size: 0.9rem;
  margin-top: 10px;
  color: var(--text-dim);
}

.grid-wrap {
  margin-top: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.grid-label.cols,
.grid {
  min-width: 560px;
  display: grid;
  grid-template-columns: repeat(6, minmax(80px, 1fr));
  gap: 10px;
}

.grid-label.cols { margin-bottom: 6px; }

.grid {
  grid-template-rows: repeat(3, minmax(84px, auto));
  margin-top: 4px;
}

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 10px;
  font-size: 0.88rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 2px solid var(--gold-dim);
  border-radius: 6px;
  background: var(--inset);
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(201, 146, 42, 0.3);
}

/* ============================================
   MODE CHOOSER MODAL
   ============================================ */
.mode-chooser {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 10px;
  backdrop-filter: blur(2px);
}

.mode-chooser[hidden] { display: none; }

.mode-chooser-card {
  width: min(420px, 100%);
  border: 3px solid var(--gold);
  border-radius: 12px;
  background: linear-gradient(160deg, var(--panel-top), var(--inset));
  padding: 16px;
  text-align: center;
  box-shadow:
    0 0 40px var(--glow-gold),
    0 0 80px rgba(0,0,0,0.8);
}

.mode-chooser-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-chooser-actions button { margin: 0; }

/* ============================================
   COMPACT LAYOUT OVERRIDES
   ============================================ */
body.compact-layout #predictor .grid-wrap { overflow-x: visible; }

body.compact-layout #predictor .grid-label.cols,
body.compact-layout #predictor .grid {
  min-width: 0;
  width: 100%;
  gap: 4px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

body.compact-layout #predictor .grid {
  grid-template-rows: repeat(3, minmax(58px, auto));
}

body.compact-layout #predictor .tile {
  padding: 4px 3px;
  min-height: 58px;
  gap: 2px;
  font-size: 0.68rem;
}

body.compact-layout #predictor .tile .index { font-size: 0.6rem; }
body.compact-layout #predictor .tile .value { font-size: 0.86rem; }
body.compact-layout #predictor h1 { letter-spacing: 1px; }

/* ============================================
   FOOTER
   ============================================ */
footer {
  text-align: center;
  margin-bottom: 5vw;
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--gold-dim);
  padding-top: 8px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--inset); }
::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

@media (max-width: 900px) {
  .sidebar { flex: 1 1 100%; order: 1; }
  .large, .half, .small { flex: 1 1 100%; }
  .controls { grid-template-columns: 1fr; }
  button { width: 100%; margin: 5px 0; }
}

@media (max-width: 600px) {
  body { padding: 6px; }

  .container {
    margin-top: 8px;
    border-width: 3px;
    outline-width: 1px;
    padding: 4px;
  }

  header { min-height: 100px; }

  header span {
    right: 4px;
    margin: 6px;
  }

  nav, section { padding: 6px; }

  .grid-label.cols,
  .grid {
    min-width: 480px;
    gap: 8px;
    grid-template-columns: repeat(6, minmax(70px, 1fr));
  }

  body.compact-layout #predictor .grid-label.cols,
  body.compact-layout #predictor .grid {
    min-width: 0;
    gap: 3px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .mode-chooser-actions { grid-template-columns: 1fr; }
}

@keyframes bg-pan {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(12%, -12%, 0); }
}

@keyframes felt-shimmer {
  from { background-position: 0 0, 0 0, 0 0; }
  to   { background-position: 6px 6px, -6px 6px, 0 0; }
}