  :root { --ink: #fbf3e4; --muted: #b7a690; --page: #17130f; --paper: rgba(255,249,238,0.92); --dark: #2b2118;
    --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
  * { box-sizing: border-box; }
  html, body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.4 var(--ui); }
  #game { position: relative; overflow: hidden; height: calc(100vh - 44px); height: calc(100svh - 44px); min-height: 460px; background: #1b1510; -webkit-user-select: none; user-select: none; }
  header { position: absolute; top: 0; left: 0; right: 0; height: 52px; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px;
    background: linear-gradient(rgba(20,14,9,0.75), rgba(20,14,9,0.4)); border-bottom: 1px solid rgba(255,240,220,0.08); }
  h1 { font-size: 17px; margin: 0 4px 0 0; font-weight: 800; white-space: nowrap; letter-spacing: -0.2px; }
  .grow { flex: 1; }
  button, select { font: 600 14px var(--ui); border: 1px solid rgba(255,240,220,0.22); background: rgba(255,240,220,0.1); color: var(--ink); border-radius: 10px; padding: 7px 12px; cursor: pointer; }
  button:hover:not(:disabled) { background: rgba(255,240,220,0.2); }
  button:disabled { opacity: 0.4; cursor: default; }
  /* current difficulty, shown next to the title; opens the opponent picker */
  .lvl { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 13px; }
  .lvl i { width: 8px; height: 8px; border-radius: 50%; background: #e0a24c; }
  .lvl b { font-weight: 700; }
  .lvl span { opacity: 0.6; font-size: 10px; }
  .lvl[data-l=easy] i { background: #6cc070; }
  .lvl[data-l=hard] i { background: #e5573f; }
  .lvl[data-l=friend] i { background: #7fb2e5; }
  .lvl[data-l=daily] i { background: #f2c94c; box-shadow: 0 0 0 3px rgba(242,201,76,0.25); }
  /* hit chances over your blots */
  #shots { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
  .shot { position: absolute; transform: translate(-50%, -100%); padding: 2px 7px; border-radius: 999px; font: 700 11.5px/1.3 var(--ui); font-variant-numeric: tabular-nums;
    color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.35); white-space: nowrap; }
  .shot.lo { background: #3f8f5a; } .shot.mid { background: #c9862b; } .shot.hi { background: #c2412f; }
  /* the coach's note after each of your moves */
  #coach { position: absolute; z-index: 3; left: 50%; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 66px); transform: translate(-50%, 8px); width: max-content; max-width: min(520px, calc(100vw - 24px));
    padding: 10px 16px; border-radius: 14px; background: rgba(251,246,236,0.96); color: var(--dark); box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    font-size: 14px; line-height: 1.35; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; border-left: 4px solid #3f8f5a; }
  #coach.show { opacity: 1; transform: translate(-50%, 0); }
  #coach.good { border-left-color: #c9a22b; } #coach.tip { border-left-color: #e0a24c; }
  #coach b { margin-right: 6px; }
  #bar #dbl { background: #7a2621; color: #fff; border-color: #5a1b17; }
  #score small { font-weight: 600; opacity: 0.65; font-size: 11px; margin-left: 2px; }
  .coachline { font-size: 13.5px; color: #3f6f4f !important; }
  #gtype { margin-top: -8px; }
  .chk { display: flex; gap: 8px; align-items: center; justify-content: center; margin: -6px 0 16px; font-size: 14px; color: #6b5640; cursor: pointer; }
  #overCoach { text-align: left; margin: 0 0 16px; font-size: 14px; color: #4a3c2c; }
  #overCoach p { margin: 0 0 6px; color: inherit; }
  #overCoach .tip { color: #8a5a1a; }
  header button, #score { white-space: nowrap; }
  .short { display: none; }
  #score { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 15px; padding: 4px 10px; border-radius: 8px; background: rgba(255,240,220,0.08); }
  #gl { position: absolute; inset: 0; touch-action: none; display: block; }
  /* soft light falloff over the table */
  #vig { position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: radial-gradient(ellipse 70% 72% at 50% 47%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.32) 100%); }
  #themes { position: absolute; z-index: 6; top: 58px; right: 12px; width: 330px; max-width: calc(100vw - 24px); padding: 12px; border-radius: 16px;
    background: rgba(251,246,236,0.97); color: var(--dark); box-shadow: 0 18px 50px rgba(0,0,0,0.35); opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity 0.18s, transform 0.18s; }
  #themes.show { opacity: 1; transform: none; pointer-events: auto; }
  #themes .ph { font-weight: 800; font-size: 15px; margin: 2px 4px 10px; }
  #themes .grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  #themes .sw { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 12px; background: #fff; border: 2px solid transparent; color: var(--dark); text-align: left; font-size: 12.5px; font-weight: 700; }
  #themes .sw:hover { background: #fff; border-color: rgba(80,55,30,0.18); }
  #themes .sw.on { border-color: #c47a22; }
  #themes .sw svg { width: 100%; height: auto; display: block; border-radius: 7px; }
  .pip { position: absolute; z-index: 2; text-shadow: 0 1px 3px rgba(0,0,0,0.6); color: rgba(255,248,236,0.85) !important; left: 14px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }
  #pipTop { top: 60px; }
  body.portrait #pipTop { left: auto; right: 14px; }
  #pipBot { bottom: 100px; }
  #bar { position: absolute; z-index: 3; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
    padding: 8px 10px 8px 16px; background: var(--paper); color: var(--dark); border-radius: 999px; box-shadow: 0 8px 30px rgba(0,0,0,0.4); max-width: calc(100vw - 16px); }
  #status { font-size: 14px; max-width: 360px; line-height: 1.25; }
  #dice { display: flex; gap: 2px; font-size: 26px; line-height: 1; }
  #dice .chip { color: #2b2118; }
  #dice .chip.dark { color: #7a2a1a; }
  #dice .chip.used { opacity: 0.22; }
  #bar button { background: #fff; color: var(--dark); border-color: rgba(80,55,30,0.2); }
  #bar button.go { background: linear-gradient(#e0a24c, #c47a22); color: #fff; border-color: #a5631a; min-width: 84px; }
  #bar button:disabled { opacity: 0.35; }
  .dlg { position: absolute; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center; background: rgba(10,7,4,0.55); }
  .dlg.show { display: flex; }
  .card { background: #fbf4e6; color: var(--dark); border-radius: 18px; padding: 22px 24px; min-width: 280px; max-width: calc(100vw - 32px); box-shadow: 0 20px 60px rgba(0,0,0,0.5); text-align: center; }
  .card .dh { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
  .card p { margin: 0 0 16px; color: #6b5640; }
  .card select { background: #fff; color: var(--dark); border-color: rgba(80,55,30,0.25); width: 100%; margin: 4px 0 16px; }
  .card button { background: #fff; color: var(--dark); border-color: rgba(80,55,30,0.25); margin: 0 4px; }
  .card button.go { background: linear-gradient(#e0a24c, #c47a22); color: #fff; border-color: #a5631a; }
  #more { display: flex; align-items: center; justify-content: center; height: 44px; color: var(--muted); text-decoration: none; font-size: 14px; border-top: 1px solid rgba(255,240,220,0.08); }
  article { padding: 8px 16px 48px; }
  article > div { max-width: 720px; margin: 0 auto; }
  article h2 { font-size: 22px; margin: 32px 0 10px; }
  article p, article li { font-size: 16px; line-height: 1.6; color: #cfc3b3; }
  article h3 { font-size: 17px; margin: 22px 0 6px; }
  article strong { color: #f1e7d6; }
  .setup { width: 100%; max-width: 560px; height: auto; display: block; margin: 8px auto 4px; }
  .setup text { font: 600 12px var(--ui); fill: #b7a690; }
  .openings { width: 100%; border-collapse: collapse; font-size: 15px; color: #cfc3b3; }
  .openings th, .openings td { text-align: left; padding: 7px 10px; border-bottom: 1px solid rgba(255,240,220,0.1); }
  .openings th { color: #f1e7d6; font-weight: 700; }
  .openings td:first-child, .openings td:nth-child(2) { white-space: nowrap; font-variant-numeric: tabular-nums; color: #f1e7d6; }
  footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; }
  footer a { color: #e9c58a; }
  @media (max-width: 560px) {
    h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    header { gap: 6px; padding: 0 8px 0 10px; }
    header button { padding: 7px 9px; }
    .long { display: none; } .short { display: inline; }
    #bar { flex-wrap: wrap; justify-content: center; border-radius: 18px; width: calc(100vw - 16px); padding: 8px 10px; gap: 8px; }
    #status { font-size: 13px; max-width: none; flex: 1 0 100%; text-align: center; }
    #dice { font-size: 22px; }
    #pipBot { bottom: 130px; }
    #coach { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 100px); font-size: 13px; }
  }

  /* acey-deucey: pick your doubles after a 1-2 */
  #pick { position: absolute; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none; flex-wrap: wrap; justify-content: center; gap: 8px; width: min(360px, calc(100vw - 32px));
    padding: 18px; border-radius: 18px; background: #fbf4e6; color: var(--dark); box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
  #pick.show { display: flex; }
  #pick .dh { flex: 1 0 100%; text-align: center; font-size: 20px; font-weight: 800; margin-bottom: 4px; }
  #pick button { font-size: 30px; line-height: 1; padding: 8px 12px; background: #fff; color: var(--dark); border-color: rgba(80,55,30,0.25); }
  #pick button:hover { background: #fff3dc; }
