:root{
  --bg: #000000;
  --panel: #0b0b0b;
  --panel-2: #111111;
  --text: #ffffff;
  --muted: #cfcfcf;
  --line: rgba(255,255,255,.12);

  --accent: #1f6f3a;       /* forest green */
  --accent-2: #2a8a49;
  --danger: #b2402e;

  --radius: 14px;
  --shadow: 0 12px 30px rgba(0,0,0,.6);
  --max: 1100px;

  /* JDS-style header vars (for .site-header navigation) */
  --nav-height: 65px;
  --nav-bg:#0a0a0a;
  --nav-border:#1f1f1f;
  --nav-hover:#1b1b1b;
  --submenu-bg:#141414;
  --submenu-border:#1f1f1f;
  --submenu-hover:#1f1f1f;

  --navH: 58px; /* legacy */
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

/* Container */
.container{
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

/* NAV (JDS-style header) */
.site-header{
  position: relative;
  height: var(--nav-height);
  z-index: 1000;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
}
.site-header .nav-inner{
  max-width: 1100px;
  margin: 0 auto;
  height: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  position: relative;
}
.site-header .brand{
  position: absolute;
  left: 16px;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.site-header .brand img{ height: 36px; width: auto; display: block; }

.site-header .nav{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}
.site-header .nav > li{ position: relative; }
.site-header .nav a{
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.site-header .nav a:hover{ background: var(--nav-hover); }
.site-header .caret{ opacity: .9; font-size: .85em; }

/* Desktop submenu */
.site-header .dropdown-menu{
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--submenu-bg);
  border: 1px solid var(--submenu-border);
  border-radius: 10px;
  min-width: 180px;
  padding: 8px;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.site-header .dropdown-menu a{
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 600;
}
.site-header .dropdown-menu a:hover{ background: var(--submenu-hover); }
.site-header .nav li.dropdown:hover > .dropdown-menu,
.site-header .nav li.dropdown:focus-within > .dropdown-menu{ display: block; }

/* Mobile */
.site-header .hamburger{
  position: absolute;
  right: 16px;
  height: 38px;
  width: 42px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--nav-border);
  border-radius: 8px;
  background: #121212;
  cursor: pointer;
}
.site-header .hamburger span{ display: block; width: 22px; height: 2px; background: #fff; }
.site-header .hamburger::before,
.site-header .hamburger::after{
  content: '';
  position: absolute;
  left: 10px;
  width: 22px;
  height: 2px;
  background: #fff;
}
.site-header .hamburger::before{ top: 14px; }
.site-header .hamburger::after{ bottom: 14px; }

/* Mobile drawer */
.site-header .mobile-wrap{
  position: absolute;
  top: var(--nav-height);
  left: 0;
  right: 0;
  display: none;
  background: #0d0d0d;
  border-bottom: 1px solid var(--nav-border);
  z-index: 999;
}
.site-header .mobile-wrap.open{ display: block; }

.site-header .mobile-nav{
  list-style: none;
  margin: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.site-header .mobile-nav a{
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
}
.site-header .mobile-nav a:hover{ background: var(--nav-hover); }
.site-header .mobile-sub{
  display: none;
  margin: 6px 0 0 10px;
  padding-left: 10px;
  border-left: 2px solid var(--nav-border);
}
.site-header .mobile-dropdown.open .mobile-sub{ display: block; }

@media (max-width: 800px){
  .site-header .nav{ display: none; }
  .site-header .hamburger{ display: flex; }
}


/* HERO */
.hero{
  position: relative;
  height: 320px;
  overflow:hidden;
  border-bottom: 1px solid var(--line);
}
.hero__img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
  filter: saturate(1.05) contrast(1.02);
}
.hero__overlay{
  position:absolute;
  inset:0;
  background: linear-gradient(180deg, rgba(0,0,0,.10) 0%, rgba(0,0,0,.75) 70%, rgba(0,0,0,.88) 100%);
  display:flex;
  align-items:flex-end;
}
.hero__content{
  padding: 22px 0 26px;
}
.hero__title{
  margin:0;
  font-size: clamp(22px, 3.4vw, 34px);
  letter-spacing: .2px;
}
.hero__subtitle{
  margin: 8px 0 0;
  color: rgba(255,255,255,.82);
  max-width: 720px;
  line-height: 1.35;
}

/* Cards / layout */
.card{
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.section-title{
  margin: 0 0 12px;
  font-size: 16px;
  letter-spacing:.2px;
  color: rgba(255,255,255,.92);
}
.intro__text{
  margin:0;
  color: rgba(255,255,255,.86);
  line-height: 1.5;
}

/* Form */
.form-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 8px;
}
.field__label{
  display:block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 650;
}
.field__input{
  width:100%;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(15,16,20,.75);
  color: var(--text);
  padding: 12px 12px;
  font-size: 16px;
  outline: none;
}
.field__input:focus{
  border-color: rgba(31,111,58,.75);
  box-shadow: 0 0 0 3px rgba(31,111,58,.20);
}

.actions{
  display:flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  border-radius: 12px;
  padding: 12px 14px;
  text-decoration:none;
  font-weight: 800;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn--primary{
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: white;
  border-color: rgba(255,255,255,.10);
}
.btn--primary:hover{ filter: brightness(1.05); }
.btn--ghost{
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-color: rgba(255,255,255,.10);
}
.btn--ghost:hover{ background: rgba(255,255,255,.10); }

.form-error{
  margin: 10px 0 0;
  color: rgba(255,120,120,.95);
  min-height: 18px;
  font-weight: 650;
}

/* Disclaimer */
.disclaimer{
  margin: 22px 0 26px;
  opacity: .8;
}
.disclaimer__text{
  margin: 0;
  font-size: 12px;
  color: rgba(255,255,255,.70);
  line-height: 1.45;
}

/* Responsive */
@media (min-width: 800px){
  .hero{ height: 420px; }
  .form-grid{
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  *{ scroll-behavior: auto !important; transition: none !important; }
}

/* ---------- GAME PAGE (Chat-style) ---------- */
.page-game .container { width: min(var(--max), calc(100% - 24px)); }

.game{
  min-height: calc(100vh - var(--navH));
  display:flex;
  justify-content:center;
}

.game__wrap{
  width: min(var(--max), 100%);
  display:flex;
  flex-direction: column;
  min-height: calc(100vh - var(--navH));
}

.transcript{
  flex: 1;
  padding: 14px 12px 110px;
  overflow-y: auto;
}

.bubble{
  max-width: 860px;
  margin: 10px auto;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 8px 18px rgba(0,0,0,.35);
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.bubble--user{
  background: #070707;
  border-color: rgba(255,255,255,.14);
}

.bubble__role{
  font-size: 12px;
  font-weight: 900;
  color: rgba(255,255,255,.72);
  margin-bottom: 6px;
  letter-spacing: .2px;
}

.bubble__text{
  color: rgba(255,255,255,.92);
  font-size: 15px;
}

.banner{
  max-width: 860px;
  margin: 12px auto 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(31,111,58,.35);
  background: rgba(31,111,58,.12);
  color: rgba(255,255,255,.92);
  font-weight: 850;
}

.composer{
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--line);
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(10px);
  padding: 10px 12px;
}

.composer__input{
  width:100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: #070707;
  color: var(--text);
  padding: 12px;
  font-size: 16px;
  outline: none;
  resize: none;
}
.composer__input:focus{
  border-color: rgba(31,111,58,.75);
  box-shadow: 0 0 0 3px rgba(31,111,58,.20);
}

.composer__meta{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.composer__note{
  font-size: 12px;
  color: rgba(255,255,255,.65);
}

.composer__right{
  display:flex;
  align-items:center;
  gap: 10px;
}

.composer__count{
  font-size: 12px;
  color: rgba(255,255,255,.70);
  font-weight: 800;
}

.textarea{
  min-height: 110px;
  resize: none;
}

/* Endgame panel */
.hidden{ display:none !important; }

.endgame{
  padding: 0 12px 10px;
}

.endgame__card{
  max-width: 860px;
  margin: 0 auto 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 26px rgba(0,0,0,.45);
}

.endgame__title{
  margin: 0 0 10px;
  font-size: 18px;
}

.endgame__review{
  color: rgba(255,255,255,.90);
  line-height: 1.45;
  font-size: 14px;
}

.endgame__actions{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.endgame__row{
  margin-top: 12px;
}

.endgame__submit{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.endgame__submitBtns{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.muted{
  color: rgba(255,255,255,.65);
  margin-top: 4px;
  font-size: 12px;
}

.sep{
  border: none;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

@media (max-width: 520px){
  .transcript{ padding-bottom: 130px; }
  .bubble__text{ font-size: 14px; }
}


/* ---------- ENDGAME IN-CHAT (keeps transcript full height) ---------- */
.endchat__summary{
  display:flex;
  align-items:center;
  gap: 12px;
}
.endchat__badge{
  width: 120px;
  height: auto;
  display:block;
  flex: 0 0 auto;
}
.endchat__summaryText{
  display:flex;
  flex-direction: column;
  gap: 2px;
}
.endchat__headline{
  font-weight: 900;
  letter-spacing: .2px;
  color: rgba(255,255,255,.92);
}
.endchat__title{
  font-weight: 900;
  color: rgba(255,255,255,.92);
}
.endchat__percent{
  font-weight: 900;
  color: var(--accent);
}

.endchat__details{
  display:flex;
  flex-direction: column;
  gap: 14px;
}
.endchat__review{
  white-space: pre-wrap;
  line-height: 1.45;
  color: rgba(255,255,255,.90);
  font-size: 14px;
}
.endchat__share{
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.endchat__shareBadge{
  width: 54px;
  height: auto;
  display:block;
  margin-bottom: 10px;
}
.endchat__label{
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 650;
}
.endchat__textarea{
  width: 100%;
}
.endchat__row{ margin-top: 10px; }
.endchat__actions{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.endchat__submit{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.endchat__submitBtns{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}
.endchat__status{
  min-height: 18px;
}

@media (max-width: 520px){
  .endchat__badge{ width: 104px; }
}


/* ---------- LEADERBOARD ---------- */

.hero--small {
  height: 260px;
}

.leaderboard {
  margin-top: 24px;
}

.leaderboard__header,
.leaderboard__row {
  display: grid;
  grid-template-columns:
    40px
    40px
    1.3fr
    1.3fr
    90px
    1.5fr
    110px;
  gap: 10px;
  align-items: center;
}

.leaderboard__header {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  color: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 800;
}

.leaderboard__row {
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}

.leaderboard__row:hover {
  background: rgba(31,111,58,.08);
}

.leaderboard__badge img {
  width: 25px;
  height: 25px;
}

.leaderboard__score {
  font-weight: 900;
  color: var(--accent);
}

.leaderboard__note {
  margin-top: 14px;
  font-size: 12px;
  color: rgba(255,255,255,.65);
}

.leaderboard__loading,
.leaderboard__empty,
.leaderboard__error {
  padding: 18px;
  text-align: center;
  color: rgba(255,255,255,.75);
}

/* Mobile layout */
@media (max-width: 900px) {
  .leaderboard__header {
    display: none;
  }

  .leaderboard__row {
    grid-template-columns: 32px 32px 1fr;
    grid-template-areas:
      "rank badge name"
      ". . title"
      ". . meta"
      ". . score"
      ". . date";
    gap: 6px 10px;
  }

  .leaderboard__rank { grid-area: rank; }
  .leaderboard__badge { grid-area: badge; }
  .leaderboard__name { grid-area: name; font-weight: 900; }
  .leaderboard__title { grid-area: title; }
  .leaderboard__meta { grid-area: meta; }
  .leaderboard__score { grid-area: score; }
  .leaderboard__date { grid-area: date; font-size: 12px; color: rgba(255,255,255,.6); }
}


/* ---------- GAME SCROLL CONTAINER FIX ---------- */
.page-game .game__wrap{
  height: calc(100vh - var(--navH));
  min-height: 0;
}
.page-game .transcript{
  min-height: 0;
}

/* ---------- AUTO-SCROLL FIX OVERRIDES (do not remove existing rules) ---------- */
/* Align legacy --navH with the real JDS header height so the transcript is the scroll container. */
:root{
  --navH: var(--nav-height);
}

/* Force the game layout math to use the correct header height. */
.page-game .game,
.page-game .game__wrap{
  min-height: calc(100vh - var(--nav-height));
}
.page-game .game__wrap{
  height: calc(100vh - var(--nav-height));
}

/* Keep the transcript as the scroll container inside the flex column layout. */
.page-game .transcript{
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}




/* ---------- NEW MESSAGE PILL (ChatGPT-style) ---------- */
.newmsg-pill{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 92px; /* above composer */
  z-index: 2000;
  max-width: calc(100% - 24px);
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(15,16,20,.92);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0,0,0,.55);
}
.newmsg-pill:hover{
  background: rgba(25,26,32,.95);
}
@media (max-width: 520px){
  .newmsg-pill{ bottom: 108px; }
}
