/* /css/games.css - unified Jeopardy + Picture Reveal theme */

/* =========================================================
   ROOT + BASE
========================================================= */

:root{
  --game-green:#063f2b;
  --game-green2:#0b5c3a;
  --game-green3:#0d6f47;
  --game-blue:#071735;
  --game-blue2:#0b2c66;
  --game-gold:#c9a227;
  --game-gold2:#e7c85b;
  --game-cream:#fff8df;
  --game-paper:#fffdf6;
  --game-bg:#f4ecd8;
  --game-red:#8f2c22;
  --game-shadow:0 22px 60px rgba(6,63,43,.20);
  --game-shadow-dark:0 22px 60px rgba(0,0,0,.25);
}

*{box-sizing:border-box}

html,
body{
  margin:0;
  min-height:100%;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--game-bg);
  color:var(--game-green);
}

body{overflow-x:hidden}

button,
input{
  font:inherit;
}

[hidden]{
  display:none!important;
}

/* =========================================================
   SHARED PAGE SHELL
========================================================= */

.pj-page,
.pr-page{
  min-height:100vh;
  padding:18px;
  color:var(--game-green);
  background:
    radial-gradient(circle at 10% 0%,rgba(201,162,39,.22),transparent 32%),
    radial-gradient(circle at 92% 18%,rgba(6,63,43,.15),transparent 34%),
    linear-gradient(180deg,#fff8e6 0%,#efe2bf 100%);
}

.pj-topbar,
.pr-topbar{
  max-width:1600px;
  margin:0 auto 14px;
  padding:18px 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  color:var(--game-cream);
  border:1px solid rgba(201,162,39,.38);
  border-radius:26px;
  background:linear-gradient(135deg,rgba(6,63,43,.96),rgba(11,92,58,.94));
  box-shadow:var(--game-shadow);
}

.pj-brand,
.pr-brand{
  display:flex;
  align-items:center;
  gap:16px;
}

.pj-mark,
.pr-mark{
  width:64px;
  height:64px;
  border-radius:50%;
  display:grid;
  place-items:center;
  color:var(--game-gold2);
  border:2px solid rgba(231,200,91,.75);
  background:radial-gradient(circle,rgba(255,248,223,.14),rgba(255,248,223,.02));
  font-size:34px;
  box-shadow:0 0 0 6px rgba(201,162,39,.12);
}

.pj-kicker,
.pr-kicker{
  margin:0 0 4px;
  color:var(--game-gold2);
  text-transform:uppercase;
  letter-spacing:.18em;
  font-size:12px;
  font-weight:900;
}

.pj-topbar h1,
.pr-topbar h1{
  margin:0;
  font-size:clamp(30px,4vw,58px);
  line-height:.95;
  letter-spacing:-.04em;
}

.pj-topbar p:last-child,
.pr-topbar p:last-child{
  margin:7px 0 0;
  color:rgba(255,248,223,.84);
  font-weight:700;
}

.pj-top-actions,
.pr-top-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

/* =========================================================
   SHARED BUTTONS
========================================================= */

.pj-btn,
.pr-btn{
  border:0;
  border-radius:999px;
  padding:12px 16px;
  cursor:pointer;
  font-weight:900;
  letter-spacing:.01em;
  color:var(--game-green);
  background:#fff;
  box-shadow:0 10px 24px rgba(0,0,0,.13);
  transition:transform .15s ease,filter .15s ease,opacity .15s ease;
}

.pj-btn:hover,
.pr-btn:hover{
  transform:translateY(-1px);
  filter:saturate(1.05);
}

.pj-btn:disabled,
.pr-btn:disabled{
  cursor:not-allowed;
  opacity:.45;
  transform:none;
}

.pj-btn-soft,
.pr-btn-soft,
.pj-change-game,
.pr-change-game{
  background:#fff8df;
  color:var(--game-green);
}

.pj-btn-gold,
.pr-btn-gold{
  color:#442f05;
  background:linear-gradient(180deg,var(--game-gold2),var(--game-gold));
}

.pj-btn-danger,
.pr-btn-danger{
  color:var(--game-red);
  background:#fff1ee;
}

.pj-btn-small,
.pr-btn-small{
  padding:8px 11px;
  font-size:13px;
}

.pr-wide{
  width:100%;
}

/* =========================================================
   SHARED GAME PICKER
   Used by Jeopardy and Picture Reveal
========================================================= */

.pj-game-picker,
.pr-game-picker{
  max-width:1100px;
  margin:38px auto;
  display:grid;
  place-items:center;
}

.pj-picker-card,
.pr-picker-card{
  width:100%;
  border-radius:34px;
  padding:34px;
  text-align:center;
  color:var(--game-cream);
  background:
    radial-gradient(circle at 50% 0%,rgba(231,200,91,.22),transparent 42%),
    linear-gradient(135deg,#052d20,#0b5c3a 62%,#063f2b);
  border:2px solid rgba(231,200,91,.56);
  box-shadow:0 30px 90px rgba(6,63,43,.26);
}

.pj-picker-card h2,
.pr-picker-card h2{
  margin:6px 0 8px;
  font-size:clamp(34px,5vw,64px);
  line-height:.95;
  letter-spacing:-.04em;
}

.pj-picker-card > p:last-of-type,
.pr-picker-card > p:last-of-type{
  margin:0 auto 24px;
  max-width:620px;
  color:rgba(255,248,223,.84);
  font-weight:700;
  line-height:1.6;
}

.pj-game-options,
.pr-game-options{
  display:grid;
  grid-template-columns:repeat(2,minmax(240px,1fr));
  gap:14px;
  margin-top:24px;
}

.pj-game-option,
.pr-game-option{
  position:relative;
  text-align:left;
  border:1px solid rgba(231,200,91,.46);
  border-radius:24px;
  padding:20px;
  cursor:pointer;
  background:rgba(255,248,223,.10);
  color:var(--game-cream);
  box-shadow:0 16px 34px rgba(0,0,0,.16);
  transition:transform .18s ease,background .18s ease,border-color .18s ease;
}

.pj-game-option:hover,
.pr-game-option:hover{
  transform:translateY(-3px);
  background:rgba(255,248,223,.18);
  border-color:rgba(231,200,91,.9);
}

.pj-game-option strong,
.pr-game-option strong{
  display:block;
  color:var(--game-gold2);
  font-size:22px;
  line-height:1.1;
}

.pj-game-option span,
.pr-game-option span{
  display:block;
  margin-top:8px;
  color:rgba(255,248,223,.82);
  line-height:1.45;
  font-weight:650;
}

.pj-game-option em,
.pr-game-option em{
  display:inline-block;
  margin-top:10px;
  color:rgba(255,248,223,.72);
  font-style:normal;
  font-weight:800;
  font-size:13px;
}

.pj-game-option.locked,
.pr-game-option.locked{
  opacity:.88;
}

.pj-game-option.locked::after,
.pr-game-option.locked::after{
  content:"LOCKED";
  position:absolute;
  top:14px;
  right:14px;
  padding:5px 9px;
  border-radius:999px;
  background:rgba(231,200,91,.18);
  border:1px solid rgba(231,200,91,.58);
  color:var(--game-gold2);
  font-size:11px;
  font-weight:1000;
  letter-spacing:.12em;
}

/* =========================================================
   JEOPARDY SCOREBOARD + BOARD
========================================================= */

.pj-score-panel{
  max-width:1600px;
  margin:0 auto 14px;
  display:flex;
  gap:14px;
  align-items:stretch;
}

.pj-score-head{
  width:220px;
  flex:0 0 220px;
  border-radius:22px;
  padding:16px;
  background:rgba(255,253,246,.78);
  border:1px solid rgba(6,63,43,.12);
  box-shadow:0 12px 28px rgba(6,63,43,.08);
}

.pj-score-head strong{
  display:block;
  font-size:18px;
}

.pj-score-head span{
  display:block;
  margin-top:5px;
  color:rgba(6,63,43,.68);
  font-size:13px;
  line-height:1.35;
}

.pj-teams{
  flex:1;
  display:grid;
  grid-template-columns:repeat(4,minmax(150px,1fr));
  gap:10px;
}

.pj-team{
  border-radius:22px;
  padding:14px;
  background:rgba(255,253,246,.90);
  border:1px solid rgba(201,162,39,.32);
  box-shadow:0 12px 28px rgba(6,63,43,.08);
}

.pj-team-name{
  width:100%;
  border:0;
  border-bottom:1px dashed rgba(6,63,43,.24);
  background:transparent;
  color:var(--game-green);
  font-weight:900;
  font-size:15px;
  padding:0 0 5px;
  outline:none;
}

.pj-team-score{
  margin:8px 0 10px;
  color:var(--game-green);
  font-size:34px;
  line-height:1;
  font-weight:1000;
}

.pj-team-actions{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
}

.pj-board-wrap{
  max-width:1600px;
  margin:0 auto;
  overflow-x:auto;
  padding-bottom:12px;
}

.pj-board{
  min-width:1320px;
  display:grid;
  grid-auto-flow:column;
  grid-auto-columns:minmax(132px,1fr);
  gap:10px;
}

.pj-category{
  display:grid;
  grid-template-rows:94px repeat(5,104px);
  gap:10px;
}

.pj-cat-title{
  border-radius:18px;
  display:grid;
  place-items:center;
  text-align:center;
  padding:10px;
  color:var(--game-cream);
  background:linear-gradient(135deg,var(--game-green),var(--game-green2));
  font-weight:1000;
  line-height:1.1;
  letter-spacing:.01em;
  border:1px solid rgba(231,200,91,.45);
  box-shadow:0 12px 24px rgba(6,63,43,.17);
}

.pj-cell{
  border:0;
  border-radius:18px;
  background:
    radial-gradient(circle at 50% 10%,rgba(231,200,91,.30),transparent 38%),
    linear-gradient(180deg,#fff9e7,#f0dfab);
  color:#7b570a;
  font-weight:1000;
  font-size:clamp(24px,3vw,44px);
  cursor:pointer;
  box-shadow:0 14px 28px rgba(6,63,43,.12),inset 0 0 0 1px rgba(201,162,39,.45);
  transition:transform .15s ease,filter .15s ease,opacity .15s ease;
}

.pj-cell:hover{
  transform:translateY(-2px);
  filter:saturate(1.05);
}

.pj-cell.played{
  opacity:.22;
  filter:grayscale(.85);
}

.pj-cell.played::after{
  content:"✓";
  font-size:40px;
  color:var(--game-green);
}

.pj-log-wrap,
.pj-help{
  max-width:1600px;
  margin:12px auto 0;
  border-radius:18px;
  padding:13px 16px;
  background:rgba(255,253,246,.78);
  border:1px solid rgba(6,63,43,.10);
  color:rgba(6,63,43,.80);
}

.pj-log-wrap summary{
  cursor:pointer;
  font-weight:900;
}

#pjRoundLog{
  margin:10px 0 0;
  padding-left:22px;
  line-height:1.65;
}

/* =========================================================
   JEOPARDY MODAL
========================================================= */

.pj-modal{
  position:fixed;
  inset:0;
  display:none;
  place-items:center;
  z-index:9999;
  padding:24px;
  background:rgba(4,24,17,.78);
  backdrop-filter:blur(6px);
}

.pj-modal.open,
.pj-modal.active{
  display:grid;
}

.pj-modal-card{
  width:min(1180px,96vw);
  min-height:min(680px,88vh);
  position:relative;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:14px;
  border-radius:34px;
  padding:44px;
  text-align:center;
  color:var(--game-cream);
  background:
    radial-gradient(circle at 50% 0%,rgba(231,200,91,.24),transparent 42%),
    linear-gradient(135deg,#052d20,#0b5c3a 62%,#063f2b);
  border:2px solid rgba(231,200,91,.62);
  box-shadow:0 40px 120px rgba(0,0,0,.48);
}

.pj-close{
  position:absolute;
  right:18px;
  top:14px;
  width:44px;
  height:44px;
  border-radius:50%;
  border:1px solid rgba(255,248,223,.28);
  background:rgba(255,255,255,.08);
  color:#fff8df;
  cursor:pointer;
  font-size:32px;
  line-height:1;
}

.pj-question-meta{
  display:flex;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
  color:var(--game-gold2);
  font-weight:1000;
  text-transform:uppercase;
  letter-spacing:.1em;
}

.pj-question-meta strong{
  color:#442f05;
  background:linear-gradient(180deg,var(--game-gold2),var(--game-gold));
  padding:5px 12px;
  border-radius:999px;
  letter-spacing:0;
}

.pj-clue{
  font-size:clamp(34px,5vw,72px);
  font-weight:950;
  line-height:1.12;
  text-wrap:balance;
}

.pj-answer{
  width:min(920px,100%);
  margin:0 auto;
  border-radius:22px;
  padding:18px 22px;
  color:#17352d;
  background:#fff8df;
  border:1px solid rgba(231,200,91,.7);
  font-size:clamp(24px,3vw,44px);
  font-weight:1000;
  line-height:1.18;
}

.pj-modal-actions,
.pj-modal-score{
  display:flex;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
}

.pj-modal-score .pj-btn{
  min-width:120px;
}

.pj-question-image-wrap{
  width:min(300px,70%);
  margin:0 auto;
  border:0;
  border-radius:0;
  overflow:visible;
  background:transparent;
  box-shadow:none;
}

.pj-question-image-wrap img{
  width:100%;
  max-height:170px;
  object-fit:contain;
  display:block;
  background:transparent;
  filter:drop-shadow(0 12px 22px rgba(0,0,0,.22));
}

.pj-question-image-wrap[hidden]{
  display:none!important;
}

.pj-modal-card:has(.pj-question-image-wrap:not([hidden])) .pj-clue{
  font-size:clamp(26px,4vw,52px);
}

/* =========================================================
   PICTURE REVEAL ROUND PICKER
========================================================= */

.pr-start-screen{
  max-width:1180px;
  margin:42px auto;
  display:grid;
  place-items:center;
}

.pr-start-card{
  width:100%;
  padding:34px;
  text-align:center;
  border-radius:34px;
  color:var(--game-cream);
  border:2px solid rgba(231,200,91,.52);
  background:
    radial-gradient(circle at 50% 0%,rgba(231,200,91,.18),transparent 44%),
    linear-gradient(135deg,#052d20,#09244d 65%,#06101e);
  box-shadow:0 30px 90px rgba(0,0,0,.34);
}

.pr-start-card h2{
  margin:6px 0 8px;
  font-size:clamp(36px,5vw,68px);
  line-height:.95;
  letter-spacing:-.05em;
}

.pr-start-card > p:last-of-type{
  max-width:680px;
  margin:0 auto 24px;
  color:rgba(255,248,223,.82);
  font-weight:700;
  line-height:1.6;
}

.pr-round-options{
  display:grid;
  grid-template-columns:repeat(3,minmax(220px,1fr));
  gap:14px;
  margin-top:24px;
}

.pr-round-option{
  min-height:170px;
  border:1px solid rgba(231,200,91,.48);
  border-radius:24px;
  padding:18px;
  cursor:pointer;
  text-align:left;
  color:var(--game-cream);
  background:
    linear-gradient(180deg,rgba(255,248,223,.10),rgba(255,248,223,.04)),
    var(--round-bg,rgba(5,45,32,.8));
  background-size:cover;
  background-position:center;
  box-shadow:0 16px 36px rgba(0,0,0,.22);
  overflow:hidden;
  position:relative;
}

.pr-round-option::before{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(180deg,rgba(2,8,17,.18),rgba(2,8,17,.78));
}

.pr-round-option strong,
.pr-round-option span{
  position:relative;
  z-index:1;
  display:block;
}

.pr-round-option strong{
  color:var(--game-gold2);
  font-size:22px;
  line-height:1.12;
}

.pr-round-option span{
  margin-top:8px;
  color:rgba(255,248,223,.84);
  font-weight:700;
  line-height:1.4;
}

/* =========================================================
   PICTURE REVEAL GAMEPLAY
========================================================= */

.pr-game{
  max-width:1680px;
  margin:0 auto;
  display:grid;
  grid-template-columns:minmax(330px,420px) 1fr;
  gap:16px;
  align-items:start;
}

.pr-side{
  display:grid;
  gap:14px;
}

.pr-panel{
  border-radius:24px;
  padding:16px;
  color:var(--game-cream);
  border:1px solid rgba(231,200,91,.30);
  background:linear-gradient(135deg,rgba(6,63,43,.82),rgba(7,23,53,.88));
  box-shadow:0 16px 40px rgba(0,0,0,.20);
}

.pr-panel-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  margin-bottom:13px;
}

.pr-panel-head strong{
  color:var(--game-gold2);
  font-size:17px;
}

.pr-panel-head span{
  color:rgba(255,248,223,.70);
  font-size:13px;
  font-weight:700;
  text-align:right;
}

.pr-teams{
  display:grid;
  gap:10px;
}

.pr-team{
  border-radius:18px;
  padding:12px;
  border:1px solid rgba(231,200,91,.24);
  background:rgba(255,248,223,.08);
}

.pr-team-name{
  width:100%;
  border:0;
  border-bottom:1px dashed rgba(231,200,91,.40);
  background:transparent;
  color:var(--game-cream);
  outline:none;
  font-weight:900;
  padding:0 0 5px;
}

.pr-team-score{
  margin:8px 0 10px;
  color:var(--game-gold2);
  font-size:30px;
  line-height:1;
  font-weight:1000;
}

.pr-team-actions{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
}

.pr-question-card{
  border-radius:20px;
  padding:16px;
  color:var(--game-green);
  background:#fff8df;
}

.pr-question-meta{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  color:rgba(6,63,43,.72);
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:12px;
}

.pr-question-meta strong{
  padding:5px 11px;
  border-radius:999px;
  color:#3d2a05;
  background:linear-gradient(180deg,var(--game-gold2),var(--game-gold));
  letter-spacing:0;
}

.pr-clue{
  margin:16px 0;
  font-size:clamp(22px,2vw,34px);
  font-weight:950;
  line-height:1.18;
  color:var(--game-green);
}

.pr-answer{
  margin:0 0 14px;
  padding:12px 14px;
  border-radius:16px;
  color:var(--game-cream);
  background:linear-gradient(135deg,var(--game-green),var(--game-green2));
  font-size:20px;
  font-weight:950;
}

.pr-actions,
.pr-question-score{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.pr-question-score{
  margin-top:12px;
}

.pr-guess-box{
  display:grid;
  gap:10px;
}

.pr-image-answer{
  padding:13px 14px;
  border-radius:16px;
  color:var(--game-green);
  background:#fff8df;
  font-size:22px;
  font-weight:1000;
  text-align:center;
}

.pr-reveal-stage{
  min-height:calc(100vh - 132px);
  display:grid;
  place-items:center;
  border-radius:30px;
  padding:18px;
  border:1px solid rgba(231,200,91,.24);
  background:
    radial-gradient(circle at 60% 0%,rgba(231,200,91,.14),transparent 32%),
    linear-gradient(135deg,rgba(7,23,53,.70),rgba(2,8,17,.50));
  box-shadow:0 24px 70px rgba(0,0,0,.25);
}

.pr-image-wrap{
  width:min(100%,980px);
  aspect-ratio:1/1;
  position:relative;
  border-radius:30px;
  overflow:hidden;
  border:2px solid rgba(231,200,91,.60);
  background:#06101e;
  box-shadow:0 30px 90px rgba(0,0,0,.36);
}

.pr-image-wrap img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.pr-tile-grid{
  position:absolute;
  inset:0;
  display:grid;
  grid-template-columns:repeat(var(--cols,6),1fr);
  grid-template-rows:repeat(var(--rows,4),1fr);
}

.pr-tile{
  border:1px solid rgba(231,200,91,.34);
  background:
    radial-gradient(circle at 50% 20%,rgba(231,200,91,.18),transparent 38%),
    linear-gradient(135deg,#08224b,#06101e);
  cursor:pointer;
  position:relative;
  transition:opacity .22s ease,transform .22s ease,filter .22s ease;
}

.pr-tile::after{
  content:"";
  position:absolute;
  inset:12%;
  opacity:.34;
  background:
    linear-gradient(45deg,transparent 46%,rgba(231,200,91,.40) 48%,rgba(231,200,91,.40) 52%,transparent 54%),
    linear-gradient(-45deg,transparent 46%,rgba(231,200,91,.28) 48%,rgba(231,200,91,.28) 52%,transparent 54%);
  border-radius:16px;
}

.pr-tile:hover{
  filter:brightness(1.16);
}

.pr-tile.revealed{
  opacity:0;
  transform:scale(.96);
  pointer-events:none;
}

/* =========================================================
   VISIBILITY HELPERS
========================================================= */

.pj-game-area[hidden],
.pj-game-picker[hidden],
.pr-game-picker[hidden],
.pr-start-screen[hidden],
.pr-game[hidden]{
  display:none!important;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media(max-width:1080px){
  .pr-game{
    grid-template-columns:1fr;
  }

  .pr-side{
    grid-template-columns:1fr 1fr;
  }

  .pr-score-panel{
    grid-column:1/-1;
  }

  .pr-reveal-stage{
    min-height:auto;
  }
}

@media(max-width:980px){
  .pj-topbar,
  .pr-topbar,
  .pj-score-panel{
    display:block;
  }

  .pj-top-actions,
  .pr-top-actions{
    justify-content:flex-start;
    margin-top:14px;
  }

  .pj-score-head{
    width:auto;
    margin-bottom:10px;
  }

  .pj-teams{
    grid-template-columns:repeat(2,1fr);
  }

  .pj-board{
    min-width:1120px;
  }
}

@media(max-width:760px){
  .pj-page,
  .pr-page{
    padding:10px;
  }

  .pj-topbar,
  .pr-topbar{
    display:block;
    border-radius:20px;
    padding:14px;
  }

  .pj-top-actions,
  .pr-top-actions{
    justify-content:flex-start;
    margin-top:14px;
  }

  .pj-mark,
  .pr-mark{
    display:none;
  }

  .pj-game-options,
  .pr-game-options,
  .pr-round-options,
  .pr-side{
    grid-template-columns:1fr;
  }

  .pj-picker-card,
  .pr-picker-card,
  .pr-start-card{
    padding:24px 18px;
    border-radius:26px;
  }

  .pr-image-wrap{
    border-radius:20px;
  }
}

@media(max-width:640px){
  .pj-teams{
    grid-template-columns:1fr;
  }

  .pj-modal{
    padding:10px;
  }

  .pj-modal-card{
    padding:34px 18px;
    border-radius:24px;
    min-height:86vh;
  }

  .pj-clue{
    font-size:34px;
  }

  .pj-question-image-wrap{
    width:min(260px,80%);
  }

  .pj-question-image-wrap img{
    max-height:145px;
  }
}