:root{
  /* parchment/bone */
  --bg:#efe7d3;
  --bg2:#e6dcc6;
  --card:rgba(255,248,232,0.72);
  --card2:rgba(255,248,232,0.56);
  --border:rgba(92,68,44,0.35);
  --border2:rgba(92,68,44,0.22);

  /* ink */
  --text:#2a1c12;
  --muted:#5c4a3d;

  /* accents */
  --primary:#2b7cff;
  --primary2:#1e57c8;

  --you:#1f8a3a;    /* green */
  --ai:#c86a1e;     /* orange */
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color:var(--text);

  /* “stock-ish” parchment texture (CSS-only) */
  background:
    radial-gradient(900px 700px at 18% 0%, rgba(145,104,64,0.20), transparent 58%),
    radial-gradient(900px 700px at 86% 20%, rgba(110,84,54,0.14), transparent 62%),
    radial-gradient(700px 500px at 50% 90%, rgba(92,68,44,0.12), transparent 60%),
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.08),
      rgba(255,255,255,0.08) 2px,
      rgba(0,0,0,0.02) 3px,
      rgba(0,0,0,0.02) 6px
    ),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

#app{max-width:1100px;margin:0 auto;padding:28px 16px 60px}

header h1{margin:0 0 4px;font-size:44px;letter-spacing:0.5px}
.sub{margin:0;color:var(--muted)}

.card{
  margin-top:18px;
  border:1px solid var(--border);
  border-radius:18px;
  padding:18px;
  background: var(--card);
  box-shadow: 0 18px 50px rgba(0,0,0,0.18);
  backdrop-filter: blur(6px);
}

.hidden{display:none}

.row{display:flex;gap:10px;align-items:center;margin-top:10px;flex-wrap:wrap}
label{color:var(--muted)}
input{
  width:180px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border2);
  background: rgba(255,255,255,0.65);
  color: var(--text);
}

button{
  border-radius:12px;
  border:1px solid var(--border);
  padding:10px 14px;
  color:var(--text);
  background: rgba(255,255,255,0.45);
  cursor:pointer;
  font-weight:750;
}

button:disabled{opacity:0.55;cursor:not-allowed}

.primary{
  background: linear-gradient(180deg, var(--primary), var(--primary2));
  border-color: rgba(43,124,255,0.65);
  color: #fff;
}
.secondary{background: rgba(255,255,255,0.58);}
.ghost{background: transparent;}

.topbar{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap:12px;
  margin-bottom:10px;
}
.label{color:var(--muted);font-size:12px}
.value{font-size:22px;font-weight:850}

/* Room badge */
.roomBadge{
  display:inline-block;
  margin-left:10px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid rgba(92,68,44,0.25);
  background: rgba(255,255,255,0.55);
  font-weight:900;
  color: var(--text);
  letter-spacing: 0.8px;
  transform: translateY(-1px);
}

#turnWho.you, #turnScore.you{color:var(--you)}
#turnWho.ai,  #turnScore.ai {color:var(--ai)}

.scores{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  margin:10px 0;
}

/* Color-code the two score boxes */
.scores .scorebox:nth-child(1){
  border-color: rgba(31,138,58,0.35);
  box-shadow: inset 0 0 0 1px rgba(31,138,58,0.12);
}
.scores .scorebox:nth-child(2){
  border-color: rgba(200,106,30,0.35);
  box-shadow: inset 0 0 0 1px rgba(200,106,30,0.12);
}

.scorebox{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px;
  background: var(--card2);
}

.msg{
  margin:10px 0 12px;
  padding:10px;
  border-radius:12px;
  border:1px solid var(--border2);
  background: rgba(255,255,255,0.55);
  min-height:22px;
}

.layout{
  display:grid;
  grid-template-columns: 1.7fr 1fr;
  gap:14px;
  align-items:start;
}

.panel{
  margin-top:12px;
  border:1px solid var(--border2);
  border-radius:14px;
  padding:12px;
  background: rgba(255,255,255,0.55);
}
.panel h3{margin:0 0 10px}
.dice-area h3{margin:10px 0 8px}

.hint{
  margin:8px 0 0;
  color:var(--muted);
  font-size:13px;
}

.selPreview{
  display:inline-block;
  margin-left:10px;
  font-weight:850;
  color: var(--text);
}

.log{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;}
.line{
  padding:6px 0;
  border-bottom:1px solid rgba(92,68,44,0.10);
}
.line:last-child{border-bottom:none}

.line.you{ color: var(--you); }
.line.ai{  color: var(--ai); }

.smallmuted{color:var(--muted);font-size:12px}

.dice{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  padding:8px 0 4px;
  position:relative;
  z-index:5;
}

.die{
  width:76px;
  height:76px;
  border-radius:14px;
  border:2px solid rgba(92,68,44,0.22);
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.9), rgba(255,255,255,0.55) 55%, rgba(0,0,0,0.04) 100%),
    linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.55));
  display:grid;
  place-items:center;
  user-select:none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}

.die img{
  width:64px;
  height:64px;
  pointer-events:none;
  user-select:none;
  -webkit-user-drag:none;
}

.die.selected{
  outline:3px solid rgba(31,138,58,0.55);
  transform: translateY(-1px);
}

.die.kept{
  opacity:0.35;
  filter: grayscale(0.9);
  pointer-events:none;
}

.tray{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  min-height:46px;
}
.tray .mini{
  width:44px;height:44px;
  border-radius:12px;
  border:1px solid rgba(92,68,44,0.22);
  background: rgba(255,255,255,0.55);
  display:grid;
  place-items:center;
}
.tray .mini img{width:36px;height:36px;pointer-events:none}

.score-ref{display:flex;flex-direction:column;gap:8px}
.score-row{
  display:grid;
  grid-template-columns: 170px 1fr 90px;
  align-items:center;
  gap:10px;
  border:1px solid rgba(92,68,44,0.14);
  border-radius:12px;
  padding:8px 10px;
  background: rgba(255,255,255,0.45);
}
.diceicons{display:flex;gap:6px;align-items:center}
.diceicons img{width:22px;height:22px;pointer-events:none}
.label2{color:var(--muted);font-size:13px}
.pts{text-align:right;font-weight:900}

.footer{margin-top:14px}

/* Hide the subtitle/tagline under the main title */
header .subtitle,
header .sub,
header .tagline {
  display: none !important;
}


@media (max-width: 900px){
  .layout{grid-template-columns:1fr}
  .topbar{grid-template-columns:1fr 1fr 1fr}
}
