/* Cacho — Bolivian theme. Aguayo textile stripes, flag palette, café warmth. */
:root {
  --red: #b3122f;
  --red-dark: #8a0e24;
  --yellow: #f4b400;
  --green: #007a33;
  --cream: #f7efe2;
  --paper: #fffaf0;
  --ink: #3a2418;
  --leather: #6b4226;
  --stripe-1: #d7263d; --stripe-2: #f46036; --stripe-3: #f4b400;
  --stripe-4: #007a33; --stripe-5: #5b2a86;
}

* { box-sizing: border-box; margin: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.aguayo {
  height: 14px;
  background: repeating-linear-gradient(90deg,
    var(--stripe-1) 0 28px, var(--stripe-2) 28px 44px, var(--stripe-3) 44px 72px,
    var(--stripe-4) 72px 88px, var(--stripe-5) 88px 104px, var(--stripe-3) 104px 120px);
}

header { text-align: center; padding: 2rem 1rem 1rem; }
h1 {
  font-family: 'Alfa Slab One', serif;
  font-size: clamp(3rem, 10vw, 5.5rem);
  letter-spacing: 0.06em;
  color: var(--red);
  text-shadow: 3px 3px 0 var(--yellow), 6px 6px 0 var(--green);
}
.tagline { color: var(--leather); font-weight: 600; margin-top: 0.5rem; }

main { flex: 1; width: min(880px, 100% - 2rem); margin: 1rem auto 2rem; }
footer { text-align: center; padding: 1rem; color: var(--leather); font-size: 0.85rem; }
footer a { color: var(--red); }

/* ---- setup ---- */
.setup { background: var(--paper); border: 2px solid var(--leather); border-radius: 12px;
  padding: 2rem; max-width: 420px; margin: 0 auto; box-shadow: 6px 6px 0 rgba(107, 66, 38, 0.25); }
.setup h2 { font-family: 'Alfa Slab One', serif; color: var(--green); margin-bottom: 1rem; }
.setup input { display: block; width: 100%; margin: 0.5rem 0; padding: 0.6rem 0.8rem;
  font: inherit; border: 2px solid var(--leather); border-radius: 8px; background: var(--cream); }
.setup .row { display: flex; gap: 0.5rem; margin-top: 1rem; }

button {
  font: inherit; font-weight: 800; cursor: pointer; border: none; border-radius: 8px;
  padding: 0.7rem 1.4rem; background: var(--red); color: #fff;
  box-shadow: 0 3px 0 var(--red-dark); transition: transform 0.05s;
}
button:active { transform: translateY(2px); box-shadow: none; }
button:disabled { background: #b9a795; box-shadow: none; cursor: not-allowed; }
button.ghost { background: var(--paper); color: var(--leather); box-shadow: 0 3px 0 var(--leather); }

/* ---- play area ---- */
.turn-banner { text-align: center; margin-bottom: 1rem; font-size: 1.2rem; }
.turn-banner strong { color: var(--red); font-size: 1.5rem; }

.felt { background: var(--green); border: 6px solid var(--leather); border-radius: 16px;
  padding: 1.5rem; text-align: center; box-shadow: inset 0 0 40px rgba(0,0,0,0.3); }

.dice { display: flex; justify-content: center; gap: 0.8rem; flex-wrap: wrap; min-height: 72px; }
.die {
  width: 64px; height: 64px; border-radius: 12px; background: var(--paper);
  border: 2px solid var(--ink); cursor: pointer; position: relative;
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.4); transition: transform 0.1s;
}
.die:hover { transform: translateY(-3px); }
.die.held { background: var(--yellow); border-color: var(--red); outline: 3px solid var(--red);
  transform: translateY(-8px); }
.die .pip { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); place-self: center; }
.die.held .pip { background: var(--red-dark); }
.p1 { grid-area: 1/1; } .p2 { grid-area: 1/2; } .p3 { grid-area: 1/3; }
.p4 { grid-area: 2/1; } .p5 { grid-area: 2/2; } .p6 { grid-area: 2/3; }
.p7 { grid-area: 3/1; } .p8 { grid-area: 3/2; } .p9 { grid-area: 3/3; }

.hint { color: rgba(255,255,255,0.85); font-size: 0.85rem; margin-top: 0.8rem; }
.felt button { margin-top: 1rem; background: var(--yellow); color: var(--ink);
  box-shadow: 0 3px 0 #b8860b; font-size: 1.1rem; }

/* ---- scoresheet ---- */
.sheet { margin-top: 1.5rem; background: var(--paper); border: 2px solid var(--leather);
  border-radius: 12px; overflow-x: auto; }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet th, .sheet td { padding: 0.45rem 0.7rem; text-align: center; border-bottom: 1px solid #e0d3bd; }
.sheet th { background: var(--red); color: #fff; }
.sheet th.current-player { background: var(--yellow); color: var(--ink); }
.sheet td.cat { text-align: left; font-weight: 600; white-space: nowrap; }
.sheet td.cat small { color: var(--leather); font-weight: 400; }
.sheet td.playable { cursor: pointer; background: #eaf5ea; color: var(--green); font-weight: 800; }
.sheet td.playable:hover { background: var(--green); color: #fff; }
.sheet td.zero { color: #b04a4a; }
.sheet td.crossed { color: #b9a795; }
.sheet tr.totals td { font-weight: 800; border-top: 3px double var(--leather); font-size: 1.05rem; }

/* ---- win overlay ---- */
.overlay { position: fixed; inset: 0; background: rgba(58, 36, 24, 0.85);
  display: grid; place-items: center; z-index: 10; }
.overlay .box { background: var(--paper); border: 4px solid var(--yellow); border-radius: 16px;
  padding: 2.5rem; text-align: center; max-width: 90vw; }
.overlay h2 { font-family: 'Alfa Slab One', serif; color: var(--red); font-size: 2.2rem; }
.overlay p { margin: 1rem 0; font-size: 1.1rem; }

@media (max-width: 520px) {
  .die { width: 52px; height: 52px; }
  .setup { padding: 1.2rem; }
}
