@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;800&family=EB+Garamond:wght@400;500;700&display=swap');

:root {
  --ink: #0a0e13;
  --midnight: #0e2236;
  --navy: #112b44;
  --paper: #e3d6ba;
  --paper-edge: #c7b792;
  --gold: #d6af6a;
  --gold-bright: #f0c980;
  --shadow: rgba(0,0,0,.55);
}

html, body { height: 100%; }

body {
  margin: 0; padding: 90px 20px calc(var(--chip-bar-h, 0px) + 48px);
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  color: #eaeef4;
  isolation: isolate; /* allow star layers behind content */
  background-image:
    radial-gradient(140% 100% at 50% 0%, rgba(255,255,255,.06), rgba(0,0,0,0) 60%),
    radial-gradient(120% 120% at 50% 120%, rgba(0,0,0,.55), rgba(0,0,0,0) 60%),
    linear-gradient(180deg, var(--midnight), var(--navy));
  background-size: auto, auto, auto;
  background-attachment: fixed, fixed, fixed;
  background-repeat: no-repeat, no-repeat, no-repeat;
  display: flex; flex-direction: column; align-items: center;
}

/* New ornate frame will be injected as an SVG element with class .ornate-frame */
.ornate-frame { width: 100%; height: 100%; display: block; }
.swirl-host, .swirl-layer { width: 100%; height: 100%; display:block; }

.landing-container, .games-section, .welcome-container {
  box-sizing: border-box;
  text-align: center;
  width: min(960px, 100%);
  padding: clamp(16px, 3vw, 28px);
  /* Aged paper with blue wear and speckling */
  background:
    /* edge wear (blue) */
    radial-gradient(120% 120% at 0% 0%, rgba(40,70,110,.10), rgba(40,70,110,0) 40%),
    radial-gradient(120% 120% at 100% 0%, rgba(40,70,110,.10), rgba(40,70,110,0) 40%),
    radial-gradient(120% 120% at 0% 100%, rgba(40,70,110,.10), rgba(40,70,110,0) 40%),
    radial-gradient(120% 120% at 100% 100%, rgba(40,70,110,.10), rgba(40,70,110,0) 40%),
    /* subtle fibers/speckle */
    repeating-radial-gradient(circle at 20px 24px, rgba(20,40,70,.08) 0 1px, rgba(0,0,0,0) 1.5px 9px),
    repeating-radial-gradient(circle at 60px 48px, rgba(20,40,70,.05) 0 1px, rgba(0,0,0,0) 1.6px 11px),
    /* parchment base */
    linear-gradient(180deg, #efe5cc, var(--paper));
  color: #2b2a28;
  border-radius: 14px;
  border: 1px solid var(--paper-edge);
  box-shadow: 0 16px 32px var(--shadow), inset 0 0 0 2px rgba(255,255,255,.35), inset 0 0 80px rgba(0,0,0,.08);
  margin-bottom: 30px;
  position: relative;
}

.landing-container:before, .games-section:before, .welcome-container:before,
.landing-container:after, .games-section:after, .welcome-container:after {
  content: '';
  position: absolute;
  inset: 10px; border: 2px solid rgba(214,175,106,.45); border-radius: 10px; pointer-events: none;
}
.landing-container:after, .games-section:after, .welcome-container:after { inset: 20px; border-color: rgba(214,175,106,.25); border-radius: 8px; }

h1, h2 { font-family: 'Cinzel', 'EB Garamond', serif; color: var(--gold); letter-spacing: .5px; }

/* Shared title banner for landing/games hub when styles.css isn't loaded */
.title-banner {
  display:flex;justify-content:center;align-items:center;
  margin: 0 auto 12px; padding: 8px 26px 10px;
  background: linear-gradient(180deg, #112b44, #0e2236 68%, #0a1624);
  border: 2px solid var(--gold);
  border-radius: 6px; position: relative; max-width: 920px;
  box-shadow: 0 4px 12px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.12);
}
.title-banner:before, .title-banner:after {
  content:""; position:absolute; top:50%; width:34px; height:60%; transform:translateY(-50%);
  background: radial-gradient(circle at 50% 50%, rgba(240,201,128,.65) 0, rgba(214,175,106,.25) 60%, rgba(214,175,106,0) 75%);
  filter: blur(1px); opacity:.55; pointer-events:none;
}
.title-banner:before { left:6px; }
.title-banner:after { right:6px; }
.title-banner h1 { margin:0; font-size: clamp(1.85rem, 5vw, 2.4rem); letter-spacing:1px; }
.title-banner h2 { margin:0; font-size: clamp(1.25rem, 4vw, 1.6rem); letter-spacing:.8px; color: var(--gold); font-weight:600; }

/* Inline gold text readability helper */
.gold-inline-banner {
  display: inline-block;
  background: linear-gradient(180deg,#132b45,#0e2236 70%,#091929);
  padding: 2px 8px 4px;
  margin: 2px 2px 2px 0;
  border-radius: 6px;
  border: 1px solid rgba(214,175,106,.55);
  box-shadow: 0 2px 6px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.12);
  line-height: 1.2;
  font-weight: 600;
  position: relative;
}
.gold-inline-banner::before, .gold-inline-banner::after {
  content:""; position:absolute; top:50%; width:10px; height:50%; transform:translateY(-50%);
  background: radial-gradient(circle at 50% 50%, rgba(240,201,128,.55) 0, rgba(214,175,106,.15) 60%, rgba(214,175,106,0) 75%);
  opacity:.5; pointer-events:none;
}
.gold-inline-banner::before { left:4px; }
.gold-inline-banner::after { right:4px; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 16px; }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); margin-bottom: 12px; }
p { font-size: clamp(1rem, 2.4vw, 1.15rem); line-height: 1.55; color: #1a1a1a; }

button, .navigator button, #enterCarnivalButton, #learnCarnivalButton {
  font-family: 'Cinzel', 'EB Garamond', serif;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  padding: 10px 20px;
  color: #0d1b2a;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: 1px solid #b99153;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .2s ease;
  box-shadow: 0 2px 0 #b99153, 0 6px 16px rgba(0,0,0,.25);
  position: relative; z-index: 10;
}
button:hover, .navigator button:hover, #enterCarnivalButton:hover, #learnCarnivalButton:hover { filter: brightness(1.03); transform: translateY(-1px); }

.games-section ul { list-style: none; padding: 0; margin: 0; }
.games-section li { font-size: 1.1rem; margin: 6px 0; }

.chip-counter { text-align: center; margin: 20px 0; font-size: 1.2rem; color: var(--gold); }

.navigator { text-align: center; margin: 20px 0; }

.slot-box { position: relative; z-index: 10; }

.welcome-text { font-size: 18px; line-height: 1.6; margin: 20px 0; color: #1a1a1a; }

/* Lower-right silhouette host (SVG injected by JS uses #silhouette-slot inside) */
#silhouette-slot { display:block; }

/* Unified Top Navigation Bar for landing/games hub */
.ndd-topbar { position:fixed; inset:0 0 auto 0; z-index:1100; display:flex; align-items:center; gap:12px; padding:10px 16px; background:rgba(255,255,255,.9); backdrop-filter:blur(8px); border-bottom:1px solid rgba(0,0,0,.12); box-shadow:0 4px 14px rgba(0,0,0,.25); font-family:'Cinzel','EB Garamond',serif; }
.ndd-topbar .tb-group{ display:flex; gap:8px; align-items:center; }
.ndd-topbar .tb-toggle{ padding:6px 10px; border:1px solid rgba(0,0,0,.15); background:#fff; border-radius:8px; cursor:pointer; font-weight:600; }
.ndd-topbar .tb-toggle:hover{ background:#f4f4f4; }
.ndd-topbar .tb-search{ flex:1; display:flex; align-items:center; }
.ndd-topbar .tb-search input{ width:100%; padding:7px 10px; border:1px solid #c0b59e; border-radius:8px; background:#fffdf7; font-size:.95rem; font-family:'EB Garamond', Georgia, 'Times New Roman', serif; }
.ndd-topbar .tb-search input:focus{ outline:2px solid #d6af6a; }
.ndd-topbar .tb-btn{ padding:6px 10px; border:1px solid #b99153; background:linear-gradient(180deg,var(--gold-bright),var(--gold)); color:#0d1b2a; border-radius:8px; cursor:pointer; font-weight:600; text-decoration:none; }
.ndd-topbar .tb-btn:hover{ filter:brightness(1.05); }
.ndd-topbar .tb-tree{ position:fixed; top:52px; left:0; right:0; max-height:0; overflow:hidden; background:rgba(255,255,255,.94); backdrop-filter:blur(10px); border-bottom:1px solid rgba(0,0,0,.12); box-shadow:0 10px 28px rgba(0,0,0,.25); transition:max-height .35s ease; z-index:1099; }
.ndd-topbar .tb-tree.open{ max-height:420px; }
.tb-section{ padding:14px 18px; display:grid; grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); gap:10px; }
.tb-section h4{ grid-column:1/-1; margin:0 0 4px; font-size:.9rem; letter-spacing:.5px; text-transform:uppercase; color:#5a4928; }
.tb-link{ display:block; padding:8px 10px; border:1px solid #d4c4a6; background:#fff7e6; border-radius:8px; font-size:.8rem; font-weight:600; color:#5b3b00; text-decoration:none; box-shadow:0 2px 6px rgba(0,0,0,.15); }
.tb-link:hover{ background:#fff0d1; }
.ndd-topbar .tb-close{ margin-left:auto; }
@media (prefers-color-scheme: dark){
  .ndd-topbar{ background:rgba(26,28,32,.85); color:#eee; border-bottom-color:rgba(255,255,255,.15); }
  .ndd-topbar .tb-search input{ background:#2c2f33; color:#eee; border-color:#555; }
  .ndd-topbar .tb-toggle{ background:#2c2f33; color:#eee; border-color:#555; }
  .ndd-topbar .tb-toggle:hover{ background:#363a3f; }
  .ndd-topbar .tb-tree{ background:rgba(30,32,36,.92); border-bottom-color:rgba(255,255,255,.12); }
  .tb-link{ background:#3b2c13; border-color:#6a5427; color:#ffe5ad; }
  .tb-link:hover{ background:#46361b; }
}