  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body { margin: 0; color: #ece6da; font: 15px/1.4 "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; background: #1f2326; }
  /* the room: a dark carpet (grain added by main.js) under one warm lamp */
  #game { position: relative; height: 100vh; height: 100svh; min-height: 520px; display: flex; flex-direction: column; overflow: hidden;
    -webkit-user-select: none; user-select: none; overscroll-behavior: none; background-color: #1f2326;
    background-image: radial-gradient(75% 60% at 50% 46%, rgba(255,214,150,.20) 0%, rgba(255,214,150,.07) 45%, rgba(0,0,0,0) 70%),
      radial-gradient(120% 100% at 50% 50%, rgba(0,0,0,0) 40%, rgba(0,0,0,.55) 100%); }
  header { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 16px 4px; }
  h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .4px; white-space: nowrap; }
  header button { white-space: nowrap; }
  .grow { flex: 1; }
  #game button, #dlg button, #dlg select { font: inherit; font-size: 14px; color: inherit; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15);
    border-radius: 10px; padding: 7px 13px; cursor: pointer; transition: background .15s; }
  #game button:hover, #dlg button:hover { background: rgba(255,255,255,.14); }
  .guide { display: flex; align-items: center; gap: 7px; font-size: 13px; opacity: .9; }
  #game select { font: inherit; font-size: 14px; color: inherit; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15); border-radius: 10px; padding: 7px 6px; cursor: pointer; }
  #game select option { color: #222; }

  /* players: name, group, and the balls each still has to pot */
  #hud { flex: none; display: flex; justify-content: center; gap: 10px; padding: 6px 12px 2px; }
  #hud[hidden] { display: none; }
  .pl { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 12px; border-radius: 14px; background: rgba(10,12,13,.45);
    border: 1px solid rgba(255,255,255,.08); opacity: .62; transition: opacity .2s, border-color .2s, box-shadow .2s; }
  .pl.on { opacity: 1; border-color: rgba(246,215,154,.75); box-shadow: 0 0 0 3px rgba(246,215,154,.12); }
  .pl .nm { font-weight: 600; white-space: nowrap; }
  .pl .grp { font-size: 12px; opacity: .7; white-space: nowrap; }
  .pl .lv { font-style: normal; font-size: 11px; letter-spacing: .3px; padding: 0 7px; border-radius: 9px; border: 1px solid rgba(255,255,255,.22); opacity: .8; white-space: nowrap; }
  .pl .lv:empty { display: none; }
  .dsub { font-size: 12px; letter-spacing: .6px; text-transform: uppercase; opacity: .55; margin: 14px 0 7px; }
  .dh + .dsub { margin-top: 0; }
  .pl .left { display: flex; gap: 3px; }
  .pl .left i { width: 13px; height: 13px; border-radius: 50%; background: var(--c); box-shadow: inset -2px -2px 3px rgba(0,0,0,.35), inset 1px 1px 2px rgba(255,255,255,.35); }
  .pl .left i.st { background: linear-gradient(#f1ead8 0 24%, var(--c) 24% 76%, #f1ead8 76%); }
  .pl .left i.gone { opacity: .16; }
  .b1 { --c: #e2b33a; } .b2 { --c: #2f5aa6; } .b3 { --c: #c23b30; } .b4 { --c: #7a56b0; } .b5 { --c: #d97a2e; } .b6 { --c: #2f8a5e; } .b7 { --c: #9a363c; } .b8 { --c: #111; }
  .pl .left i.b8 { box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); }

  #stage { flex: 1; min-height: 0; position: relative; touch-action: none; }
  #table { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
  #status { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px);
    padding: 7px 16px; border-radius: 20px; font-size: 14px; text-align: center; pointer-events: none;
    background: rgba(12,14,15,.6); border: 1px solid rgba(255,255,255,.09); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
  #status b { font-weight: 600; color: #f6d79a; }

  #status.warn { border-color: rgba(255,140,120,.55); }
  #status.warn b { color: #ff9d8a; }
  /* a foul, announced over the table */
  #notice { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); width: max-content; max-width: min(440px, calc(100% - 28px)); padding: 12px 18px 13px;
    border-radius: 14px; text-align: center; pointer-events: none; background: rgba(38,22,20,.93); border: 1px solid rgba(255,140,120,.55); box-shadow: 0 12px 34px rgba(0,0,0,.5); }
  #notice[hidden] { display: none; }
  #notice.show { animation: notice 4.2s both; }
  @keyframes notice { 0% { opacity: 0; transform: translate(-50%, -8px); } 6% { opacity: 1; transform: translate(-50%, 0); } 90% { opacity: 1; } 100% { opacity: 0; } }
  #notice b { display: block; font-size: 16px; font-weight: 650; color: #ff9d8a; }
  #notice span { display: block; margin-top: 3px; font-size: 14px; }
  #notice i { display: block; margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.12); font-style: normal; font-size: 13px; color: #f6d79a; }
  #overRule { margin: -8px 0 18px; padding: 9px 12px; border-radius: 10px; font-size: 13px; text-align: left; background: rgba(255,140,120,.1); border: 1px solid rgba(255,140,120,.3); }
  #overRule[hidden] { display: none; }
  #over { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8,10,11,.45); animation: fade .35s; }
  #over[hidden] { display: none; }
  @keyframes fade { from { opacity: 0; } }
  .card { position: relative; width: min(400px, calc(100vw - 32px)); padding: 24px 22px 20px; border-radius: 18px; background: #262b2f; color: #ece6da;
    border: 1px solid rgba(255,255,255,.1); box-shadow: 0 24px 60px rgba(0,0,0,.55); text-align: center; }
  #overTitle { font-size: 26px; font-weight: 650; color: #f6d79a; }
  #overWhy { margin: 8px 0 18px; opacity: .88; }
  .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
  #game button.go { background: #e9c57a; border-color: #e9c57a; color: #2a2116; font-weight: 600; }
  #game button.go:hover { background: #f4d591; }

  #dlg { padding: 0; border: 0; background: none; max-width: none; color: inherit; }
  #dlg::backdrop { background: rgba(0,0,0,.55); }
  #dlg .card { text-align: left; }
  .dh { font-size: 20px; font-weight: 650; margin-bottom: 14px; }
  #dlg .x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; padding: 0; font-size: 20px; line-height: 1; border-color: transparent; background: none; }
  .modes { display: grid; gap: 8px; }
  #dlg .modes button { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline; text-align: left; padding: 10px 14px; }
  .modes b { font-size: 16px; }
  .modes i { font-style: normal; font-size: 12px; opacity: .65; justify-self: start; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; padding: 0 7px; }
  .modes span { grid-column: 1 / -1; font-size: 13px; opacity: .75; }
  #dlg .modes button.cur { border-color: rgba(246,215,154,.8); background: rgba(246,215,154,.1); }

  #more { flex: none; display: flex; align-items: center; justify-content: center; height: 38px; color: rgba(236,230,218,.6); text-decoration: none; font-size: 13px;
    border-top: 1px solid rgba(255,255,255,.06); background: rgba(0,0,0,.18); }
  #more:hover { color: #ece6da; }

  article { padding: 8px 16px 40px; background: #1b1e21; }
  article > div { max-width: 720px; margin: 0 auto; }
  article h2 { font-size: 23px; margin: 34px 0 10px; color: #f3ecdf; }
  article h3 { font-size: 17px; margin: 22px 0 6px; color: #f3ecdf; }
  article p, article li, article td, article th { font-size: 16px; line-height: 1.65; color: #c6c1b7; }
  article li { margin-bottom: 6px; }
  article strong { color: #ece6da; }
  article a { color: #f0c873; }
  article table { border-collapse: collapse; width: 100%; margin: 10px 0 14px; }
  article th, article td { text-align: left; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.1); vertical-align: top; }
  article th { color: #ece6da; font-weight: 600; }
  article td:first-child { white-space: nowrap; color: #ece6da; }
  .rack { display: block; width: min(100%, 420px); height: auto; margin: 14px 0; }
  .small { font-size: 13px !important; opacity: .7; margin-top: 26px; }
  footer { text-align: center; color: #9a968d; font-size: 13px; padding: 24px 16px 40px; background: #1b1e21; }
  footer a { color: #f0c873; }

  @media (max-width: 560px) {
    header { padding: 8px 10px 2px; gap: 6px; }
    #game header button, #game select { padding: 7px 9px; }
    .guide span { display: none; }
    h1 { font-size: 15px; }
    #hud { gap: 6px; padding: 6px 8px 0; }
    .pl { flex-wrap: wrap; gap: 3px 6px; padding: 5px 9px; }
    .pl .left { flex-basis: 100%; }
    .pl .left i { width: 11px; height: 11px; }
    #status { font-size: 13px; padding: 6px 12px; border-radius: 14px; }
  }
