:root {
  color-scheme: dark;
  font: 100%/1.55 system-ui, sans-serif;
  color: #f6f3eb;
  background: #191d1b;
  --panel: #222825;
  --line: #3d4842;
  --muted: #b9c6bd;
  --accent: #b5e7c5;
  --ember: #ff6a45;
  --gold: #ffd23f;
  --azure: #3fa0ff;
  --violet: #b98cff;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { width: min(100% - 2rem, 70rem); margin-inline: auto; padding-block: 1.5rem 4rem; }
header, header nav, .brand { display: flex; align-items: center; }
header { justify-content: space-between; gap: 1rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
header nav { gap: clamp(.75rem, 3vw, 1.5rem); }
a { color: var(--accent); text-underline-offset: .22em; }
header a { text-decoration: none; }
header a:hover, .back:hover { text-decoration: underline; }
.brand { gap: .55rem; color: inherit; font-weight: 750; font-size: 1.35rem; letter-spacing: -.04em; }
.brand-mark { display: grid; grid-template-columns: repeat(2, .48rem); gap: .15rem; transform: rotate(-12deg); }
.brand-mark i { height: .48rem; border-radius: .12rem; background: var(--ember); }
.brand-mark i:nth-child(2) { background: var(--gold); }
.brand-mark i:nth-child(3) { background: var(--violet); }
.brand-mark i:nth-child(4) { background: var(--azure); }
h1, h2, h3, p { margin: 0; }
h1, h2 { letter-spacing: -.045em; line-height: 1.05; }
h1 { font: 700 clamp(3rem, 9vw, 6.15rem)/.95 Georgia, serif; letter-spacing: -.075em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.02rem; }
p, small { color: var(--muted); }
small { font-size: .875rem; }
button, .quiet, input { border-radius: .55rem; font: inherit; }
button, .quiet { cursor: pointer; color: inherit; border: 1px solid transparent; }
button:disabled, button[aria-disabled="true"] { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid white; outline-offset: 3px; }
.quiet, .primary { display: inline-block; padding: .5rem .8rem; text-decoration: none; font-weight: 650; }
.quiet { background: #2a322d; border-color: var(--line); }
.quiet:hover:not(:disabled) { border-color: var(--accent); }
.primary { background: var(--accent); color: #18281f; }
.primary:hover:not(:disabled) { background: #d0f4da; }
.quiet:disabled, .primary:disabled { opacity: .55; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: clamp(2.2rem, 7vw, 5.5rem) 0 clamp(2rem, 5vw, 3.6rem); }
.intro p { margin-top: 1rem; max-width: 31rem; font-size: 1.12rem; }
.intro-cards { display: flex; padding-right: clamp(.4rem, 4vw, 3rem); }
.face { --pip: var(--accent); display: grid; grid-template: 1fr repeat(3, 2fr) 1fr / 1fr repeat(3, 2fr) 1fr; place-items: center; aspect-ratio: 1; overflow: hidden; border-radius: .45rem; background: #0b0d0c; border: 1px solid #343b37; }
.face i { width: 62%; aspect-ratio: 1; background: var(--pip); filter: drop-shadow(0 0 .15em color-mix(in srgb, var(--pip) 55%, transparent)); }
.ember { --pip: var(--ember); }
.gold { --pip: var(--gold); }
.azure { --pip: var(--azure); }
.violet { --pip: var(--violet); }
/* Each color also has its own pip shape, so colors never rely on hue alone. */
.ember i, .marker.ember { border-radius: 50%; }
.gold i, .marker.gold { border-radius: 12%; transform: scale(.88); }
.azure i, .marker.azure { border-radius: 10%; transform: rotate(45deg) scale(.8); }
.violet i, .marker.violet { border-radius: 50%; background: radial-gradient(circle closest-side, transparent 50%, var(--pip) 56%); }
.intro-cards .face { width: clamp(3rem, 7vw, 5.4rem); box-shadow: 0 .5rem 1rem #10151255; }
.intro-cards .face:nth-child(1) { transform: translate(.45rem, .45rem) rotate(-15deg); }
.intro-cards .face:nth-child(2) { transform: rotate(-6deg); }
.intro-cards .face:nth-child(3) { transform: translate(-.45rem, -.1rem) rotate(5deg); }
.intro-cards .face:nth-child(4) { transform: translate(-.9rem, .3rem) rotate(14deg); }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(1rem, 3vw, 1.45rem); }
.panel-head, .offer, .room-list li { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.offer { flex-wrap: wrap; margin-block: 1.2rem .75rem; }
.segments { display: flex; gap: .2rem; padding: .2rem; border: 1px solid var(--line); border-radius: .7rem; }
.segments button { background: transparent; padding: .34rem .5rem; white-space: nowrap; }
.segments button[aria-pressed="true"] { background: #3c4a41; }
.empty { padding-block: .85rem .25rem; }
.room-list, .players { margin: .65rem 0 0; padding: 0; list-style: none; }
.room-list li { padding-block: .75rem; border-top: 1px solid var(--line); }
.room-list small { display: block; overflow-wrap: anywhere; }
.more { margin-top: .55rem; }
.rules { margin-top: 2.75rem; scroll-margin-top: 1.5rem; }
.rules-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1rem; }
.rules article { border-top: 1px solid var(--line); padding-top: .9rem; }
.rules article p { margin-top: .3rem; }
.example, .demo { display: flex; gap: .28rem; align-items: center; }
.example { margin-bottom: .65rem; height: 2.2rem; }
.example .face, .example .slot { width: 2rem; height: 2rem; border-radius: .3rem; }
.example .slot { border: 1px dashed var(--line); }
.demo { background: transparent; padding: 0; }
.demo .face { transition: background-color .2s, color .2s; }
.demo:hover .face, .winning-example .face { border-color: #fff8; }
.account, .error { margin-top: 1rem; }
.account p { margin-block: .6rem; }
.account-actions { margin-top: .75rem; }
.account-actions button + button { margin-left: .5rem; }
.account form { margin-top: .65rem; display: flex; flex-wrap: wrap; gap: .55rem; align-items: end; }
.account label { display: grid; gap: .25rem; }
.account input { background: #191d1b; color: inherit; border: 1px solid var(--line); padding: .5rem; max-width: 100%; }
.error { padding: .6rem .85rem; border-radius: .5rem; background: #4a2b30; color: #ffdddd; }
.text-button { text-decoration: underline; background: transparent; color: inherit; }
.match { padding-top: 1.2rem; }
.back { display: inline-block; margin-bottom: .85rem; }
.waiting h1 { font-size: clamp(2.6rem, 8vw, 4rem); }
.waiting p { margin-block: .7rem; }
.table { display: grid; grid-template-columns: minmax(0, 38rem) minmax(14rem, 1fr); gap: clamp(1rem, 4vw, 2.4rem); align-items: start; }
.board { margin-inline: auto; display: grid; grid-template-columns: repeat(var(--size), minmax(0, 1fr)); gap: clamp(.23rem, .7vw, .45rem); padding: clamp(.4rem, 1.3vw, .85rem); border: 1px solid var(--line); border-radius: .9rem; background: #121714; }
.cell { position: relative; aspect-ratio: 1; padding: 0; min-width: 0; border: 0; background: #262e29; transition: background-color .15s; }
.cell:not([aria-disabled="true"]):hover { background: #384940; }
.cell .face { position: absolute; inset: 0; animation: settle .19s ease-out; }
.target { outline: 2px dashed var(--accent); outline-offset: 1px; z-index: 1; }
.selected, .winner { outline: 2px solid #fff; outline-offset: 2px; z-index: 1; }
.winner .face { animation: highlight .46s ease-out; }
@keyframes settle { from { opacity: .55; transform: scale(.91); } }
@keyframes highlight { 48% { transform: scale(1.07); filter: brightness(1.2); } }
.controls { border-top: 1px solid var(--line); padding-top: .9rem; }
.controls p { margin-top: .55rem; }
.hand { display: flex; gap: .48rem; margin-top: .95rem; }
.hand .face { width: 4.2rem; }
.players { margin-block: 1.1rem; }
.players li { display: flex; align-items: center; gap: .55rem; padding-block: .44rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.players li span:last-child { margin-left: auto; color: var(--muted); font-size: .875rem; }
.markers { display: flex; gap: .2rem; flex: none; }
.marker { width: .75rem; height: .75rem; flex: none; background: var(--pip); }
.round-log { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--muted); font-size: .875rem; }
.round-log li + li { margin-top: .35rem; }
.replay { display: flex; align-items: center; justify-content: space-between; gap: .45rem; margin-top: .65rem; }
.replay label { display: grid; text-align: center; min-width: 0; font-size: .875rem; }
.replay input { width: 100%; accent-color: var(--accent); }
@media (max-width: 690px) {
  .lobby-grid, .table { grid-template-columns: 1fr; }
  .intro { gap: .85rem; }
  .intro-cards { padding-right: 0; }
  .intro-cards .face { width: 2rem; }
  .intro-cards .face:nth-child(n+3) { display: none; }
}
@media (max-width: 480px) {
  main { width: calc(100% - 1.4rem); }
  .rules-grid { grid-template-columns: 1fr; }
  .segments button span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
