/* Midnight mode ("Modo Meia-Noite"), unlocked in /clube/ and switched on by ach.js (html.midnight).
   The whole site turns into the Clube da Meia Noite: aged parchment and ink, a damask wallpaper,
   old-book type, sepia cards, dried-blood accents and a lantern that follows the pointer.
   Home page rules first, then the shared overlays, then the game pages (look.css layers). */
@import url("https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=IM+Fell+English+SC&family=Pinyon+Script&display=swap");

/* tokens: only the home page takes the palette and type; game pages keep their own fonts and colours
   and get the wallpaper, a sepia tint and the lantern instead (bottom of this file) */
html.midnight:root:has(#gameFrame),
html.midnight:root:has(#gameFrame):not([data-theme="light"]),
html.midnight:root:has(#gameFrame)[data-theme="dark"] {
  --bg: #120e0b;
  --surface: #1d1712;
  --ink: #e6dac1;
  --muted: #a8987d;
  --line: #3a2e23;
  --brand: #4a3826;
  --brand-deep: #1c140e;
  --brand-ink: #e6dac1;
  --accent: #7e2a26;
  --gold: #c9a45c;
  --felt: #2b3a2c;
  --felt-deep: #121a12;
  --brass: #b8955a;
  --nav-bg: rgba(14, 10, 8, .88);
  --display: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --body: "IM Fell English", Georgia, "Times New Roman", serif;
  --rank: "IM Fell English", Georgia, serif;
  --mn-paper: #d9cbad;
  --mn-ink: #1a120c;
  --mn-damask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='240'><g fill='none' stroke='%23c9b28a' stroke-opacity='.06' stroke-width='1.3' stroke-linecap='round'><path d='M90,22 C116,58 126,96 90,138 C54,96 64,58 90,22Z M90,44 C100,70 100,100 90,120 C80,100 80,70 90,44Z M90,138 C70,160 48,152 52,134 C55,122 70,124 68,134 M90,138 C110,160 132,152 128,134 C125,122 110,124 112,134 M90,138 L90,200 M82,88 Q90,81 98,88 Q90,95 82,88Z'/><path d='M0,142 C26,178 36,216 0,258 M180,142 C154,178 144,216 180,258 M0,-98 C26,-62 36,-24 0,18 M180,-98 C154,-62 144,-24 180,18'/></g><circle cx='90' cy='88' r='2' fill='%23c9b28a' fill-opacity='.08'/></svg>");
  color-scheme: dark;
}
html.midnight body {
  background: var(--mn-damask) 0 0 / 180px 240px, radial-gradient(ellipse 90% 70% at 50% 30%, #241b14, #120e0b 70%, #080605) fixed;
  font-size: 18px;
}
html.midnight h2, html.midnight .hero h1, html.midnight .game-body h3 { letter-spacing: .04em; font-weight: 400; }
html.midnight ::selection { background: #7e2a26; color: #f1e6cf; }
html.midnight button:focus-visible, html.midnight a:focus-visible, html.midnight summary:focus-visible, html.midnight [tabindex]:focus-visible { outline-color: #c9a45c; }

/* nav */
html.midnight body::before { background: #0c0907; }
html.midnight .logo-t { font-family: var(--display); }
html.midnight .logo-t small { color: #b5584e; font-family: var(--body); letter-spacing: .5em; }
html.midnight .mark { filter: sepia(.9) saturate(.55) brightness(.85) drop-shadow(0 3px 6px rgba(0,0,0,.6)); }
html.midnight .nav nav a { font-weight: 400; font-size: 1.02rem; }
@media (max-width: 1100px) { html.midnight .nav nav { background: rgba(16, 11, 8, .97); border: 1px solid rgba(201,164,92,.28); } }
html.midnight .lang button { font-family: var(--body); font-weight: 400; }
html.midnight .lang button[aria-pressed="true"] { background: #e6dac1; color: #1a120c; }

/* hero: from cobalt to an ink-dark wallpaper with a candle pool behind the cards */
html.midnight .hero {
  background:
    radial-gradient(ellipse 45% 55% at 76% 45%, rgba(255, 196, 120, .13), transparent 70%),
    var(--mn-damask) 0 0 / 180px 240px,
    radial-gradient(ellipse 120% 90% at 30% 20%, #2a2018, #140f0b 60%, #080605);
}
html.midnight .hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 95% 85% at 50% 45%, transparent 55%, rgba(0, 0, 0, .65));
}
html.midnight .hero .col, html.midnight .leaders { position: relative; z-index: 1; }
html.midnight .hero h1 { font-size: clamp(2.6rem, 6.6vw, 5.4rem); line-height: 1; color: #e2d4b6; text-shadow: 0 2px 0 #000, 0 0 30px rgba(0,0,0,.6); }
html.midnight .hero h1 .ln:last-child { font-family: "Pinyon Script", var(--body); text-transform: none; letter-spacing: 0; color: #c9a45c; font-size: 1.12em; }
html.midnight .hero p { font-style: italic; color: #cdbf9f; }
html.midnight .pk { background: var(--mn-paper); color: var(--mn-ink); border-radius: 6px; box-shadow: 4px 4px 0 #3a0f0d, inset 0 0 0 1px rgba(26,18,12,.35), inset 0 0 22px rgba(90,60,30,.25); }
html.midnight .pk:hover { box-shadow: 6px 7px 0 #3a0f0d, inset 0 0 0 1px rgba(26,18,12,.35), inset 0 0 22px rgba(90,60,30,.25); }
html.midnight .pk b { color: #2a1a10; font-weight: 400; font-family: var(--display); letter-spacing: .03em; }
html.midnight .pk small { color: #5a4a36; font-weight: 400; font-style: italic; }
html.midnight .pk em, html.midnight .pk.feat em { background: #7e2a26; color: #f1e6cf; font-weight: 400; letter-spacing: .06em; }
html.midnight .pk .ic, html.midnight .gic, html.midnight .foot-brand img { filter: sepia(.85) saturate(.5) brightness(.85) contrast(1.05); }
html.midnight .pk.feat { background: linear-gradient(120deg, #1c140e, #2c2117 60%, #3b2c1e); color: #e6dac1; box-shadow: 4px 4px 0 #3a0f0d, inset 0 0 0 1px rgba(201,164,92,.45); }
html.midnight .pk.feat b { color: #e6dac1; }
html.midnight .pk.feat small { color: #b8a684; }
html.midnight .btn { background: var(--mn-paper); color: var(--mn-ink); box-shadow: 5px 5px 0 #3a0f0d; }

/* the hand of cards becomes an old tarot-ish deck */
html.midnight .face { background: linear-gradient(160deg, #eadcbf, #d3c29f); color: #1a120c; box-shadow: 0 20px 44px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(26,18,12,.4), inset 0 0 30px rgba(110,80,40,.28); }
html.midnight .face.red { color: #7e2a26; }
html.midnight .hand.engine .face, html.midnight .hand.engine .back { box-shadow: 0 20px 44px rgba(0, 0, 0, calc(var(--sh, .38) + .2)), inset 0 0 0 1px rgba(26,18,12,.4), inset 0 0 30px rgba(110,80,40,.28); }
html.midnight .back { background: #d3c29f; }
html.midnight .back::before { background: repeating-linear-gradient(45deg, rgba(201,164,92,.18) 0 3px, transparent 3px 9px), radial-gradient(circle at 50% 50%, #3a1512, #1a0908); }
html.midnight .back::after { filter: sepia(1) saturate(.4) brightness(.9); }
html.midnight .table-hint { font-style: italic; font-weight: 400; color: #b8a684; }
html.midnight .table-hint b { background: rgba(201,164,92,.16); font-weight: 400; }

html.midnight .leaders { border-top-color: rgba(201,164,92,.22); background: rgba(0, 0, 0, .35); }
html.midnight .live i { background: #e3a54f; animation: mn-flame 1.6s ease-in-out infinite; box-shadow: 0 0 10px rgba(227,165,79,.7); }
@keyframes mn-flame { 0%, 100% { opacity: 1; transform: scale(1); } 40% { opacity: .65; transform: scale(.85); } 70% { opacity: .9; transform: scale(1.1); } }
html.midnight .leader span, html.midnight .live { font-weight: 400; }

/* sections */
html.midnight section.block { position: relative; }
html.midnight h2 { color: #e2d4b6; }
html.midnight h2::after { content: ""; display: block; width: 180px; max-width: 60%; height: 14px; margin-top: 10px; opacity: .7;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 14'><g fill='none' stroke='%23c9a45c' stroke-width='1.2' stroke-linecap='round'><path d='M2,7 C40,7 60,2 84,7 M96,7 C120,12 140,7 178,7'/></g><path d='M90,2 L95,7 L90,12 L85,7Z' fill='%237e2a26'/></svg>") left center / contain no-repeat; }
html.midnight .contact h2::after { display: none; }
html.midnight .lead { font-style: italic; }
html.midnight .game { border-radius: 8px; border-color: #3a2e23; background: linear-gradient(180deg, #1f1813, #17120e); box-shadow: inset 0 0 0 1px rgba(201,164,92,.12); }
html.midnight .game:hover { box-shadow: 0 26px 60px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(201,164,92,.3); }
html.midnight .game.feat { border-color: rgba(201,164,92,.4); box-shadow: 8px 8px 0 #3a0f0d; }
html.midnight .game-art { filter: sepia(.6) saturate(.55) brightness(.82) contrast(1.08); }
html.midnight .game-art::before { z-index: 1; }
html.midnight .game-body h3 { color: #e2d4b6; }
html.midnight .status { background: rgba(126, 42, 38, .25); color: #d79a8f; font-weight: 400; font-style: italic; }
html.midnight .feats li { font-weight: 400; }
html.midnight .feats li::before { content: "✦"; color: #c9a45c; }
html.midnight .btn-play, html.midnight .rk-btn { background: #2a1f16; color: #e6dac1; font-weight: 400; letter-spacing: .04em; border-radius: 4px; box-shadow: 5px 5px 0 #3a0f0d, inset 0 0 0 1px rgba(201,164,92,.45); }
html.midnight .btn-play:hover { box-shadow: 7px 7px 0 #3a0f0d, inset 0 0 0 1px rgba(201,164,92,.75); }
html.midnight .td-badge { background: #7e2a26; color: #f1e6cf; font-weight: 400; }
html.midnight .wallet { background: linear-gradient(120deg, #120d09, #241a12 60%, #3a2a1b); color: #e6dac1; box-shadow: inset 0 0 0 1px rgba(201,164,92,.25); border-radius: 8px; }
html.midnight .wallet .amt { color: #c9a45c; }
html.midnight .wallet-uses a { font-weight: 400; border-radius: 4px; }
html.midnight .chip-ico, html.midnight .pile .pc { filter: sepia(.75) saturate(.6) brightness(.85); }
html.midnight .fine { font-style: italic; }

html.midnight .ranking { background: rgba(0, 0, 0, .28); }
html.midnight .rk-board, html.midnight .rk-player, html.midnight .policy-wrap, html.midnight .item, html.midnight .ach, html.midnight .rk-stats div { border-radius: 8px; }
html.midnight .rk-tabs button { font-family: var(--body); font-weight: 400; }
html.midnight .rk-tabs button[aria-selected="true"] { background: #4a3826; color: #f1e6cf; box-shadow: inset 0 0 0 1px rgba(201,164,92,.5); }
html.midnight .rk-name, html.midnight .rk-score, html.midnight .rk-pos { font-weight: 400; }
html.midnight .rk-list li:nth-child(1) .rk-pos { background: #c9a45c; }
html.midnight .rk-link, html.midnight .status, html.midnight .item button.inuse { color: #d79a8f; }
html.midnight .values > div { border-top-color: #c9a45c; }
html.midnight .values .suit { color: #7e2a26; }
html.midnight .values > div:nth-child(1) .suit { color: #c9a45c; }
html.midnight .policy-wrap summary { font-weight: 400; }

/* contact becomes a parchment letter; the footer stays in the dark */
html.midnight .contact { background: var(--mn-paper); color: var(--mn-ink); box-shadow: inset 0 0 80px rgba(90, 60, 30, .45); }
html.midnight .contact h2 { color: var(--mn-ink); }
html.midnight .mail { border-color: rgba(26,18,12,.4); font-family: var(--body); font-weight: 400; }
html.midnight .copy { background: #7e2a26; font-family: var(--body); font-weight: 400; color: #f1e6cf; }
html.midnight footer { background: #080605; color: #8d7f68; }
html.midnight footer .col { border-top-color: rgba(201,164,92,.18); }
html.midnight .foot-links a:hover { color: #e6dac1; }

/* dialogs */
html.midnight dialog.shop-modal, html.midnight dialog.game-modal { border-radius: 8px; box-shadow: 0 30px 80px rgba(0,0,0,.8), 0 0 0 1px rgba(201,164,92,.3); }
html.midnight dialog.shop-modal::backdrop, html.midnight dialog.game-modal::backdrop { background: rgba(4, 3, 2, .85); }
html.midnight .shop-bal { background: #2a1f16; }
html.midnight .shop-head h2::after { display: none; }
html.midnight .ach-bar i { background: linear-gradient(90deg, #4a3826, #7e2a26 60%, #c9a45c); }
html.midnight .item button, html.midnight .ach-claimall, html.midnight .ach button.rw { font-family: var(--body); font-weight: 400; }

/* the Clube tile and the mode switch (always styled dark, also outside midnight mode) */
html.midnight .pk.clube { box-shadow: 4px 4px 0 #3a0f0d, inset 0 0 0 1px rgba(201,164,92,.55); }
html.midnight .pk.clube { background: radial-gradient(ellipse 70% 120% at 12% 50%, rgba(255,190,110,.16), transparent 60%), linear-gradient(120deg, #0d0a08, #1c140e 60%, #2a1f16); color: #e6dac1; }
html.midnight .pk.clube b { color: #e6dac1; font-family: "IM Fell English SC", "IM Fell English", Georgia, serif; letter-spacing: .12em; }
html.midnight .pk.clube small { color: #b8a684; }
html.midnight .pick-h { color: var(--gold); }

/* ---------------------------------------------------------------- shared overlays (ach.js) */
.mn-lantern, .mn-tint { position: fixed; inset: 0; pointer-events: none; z-index: 2147483000; }
.mn-tint { z-index: 2147482999; background: #6b5434; mix-blend-mode: color; opacity: .5; }
@media (prefers-reduced-motion: reduce) { html.midnight .live i { animation: none; } }

/* ---------------------------------------------------------------- game pages (look.css) */
html.midnight body:not(:has(#gameFrame))::before {
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(255, 190, 110, .1), transparent 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='240'><g fill='none' stroke='%23c9b28a' stroke-opacity='.07' stroke-width='1.3' stroke-linecap='round'><path d='M90,22 C116,58 126,96 90,138 C54,96 64,58 90,22Z M90,44 C100,70 100,100 90,120 C80,100 80,70 90,44Z M90,138 C70,160 48,152 52,134 C55,122 70,124 68,134 M90,138 C110,160 132,152 128,134 C125,122 110,124 112,134 M90,138 L90,200 M82,88 Q90,81 98,88 Q90,95 82,88Z'/></g></svg>") 0 0 / 180px 240px,
    radial-gradient(ellipse 100% 90% at 50% 40%, #241b14, #0d0a07 75%);
}
html.midnight body:not(:has(#gameFrame))::after { background: radial-gradient(ellipse 80% 75% at 50% 45%, transparent 45%, rgba(0, 0, 0, .75) 100%); }

/* card of the day: the felt strip turns into an old leather tray */
html.midnight .daily { background: radial-gradient(ellipse 75% 110% at 72% 45%, #3b2a1a, #21170e 55%, #0f0a06); border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(201,164,92,.55), inset 0 12px 36px rgba(0,0,0,.45); color: #e6dac1; }
html.midnight .daily::before { border-color: rgba(201,164,92,.22); border-radius: 4px; }
html.midnight .daily-eyebrow, html.midnight .daily-streak li.now { color: #c9a45c; }
html.midnight .daily-streak li.on { background: #c9a45c; border-color: #c9a45c; }
html.midnight .dcard .bk::before { background: repeating-linear-gradient(45deg, rgba(255,255,255,.08) 0 4px, transparent 4px 10px), linear-gradient(160deg, #5a1f1f, #2a0c0c); }
