:root {
  color-scheme: dark;
  --night: #111b1c;
  --panel: #172525;
  --line: #344640;
  --ink: #f8f0df;
  --muted: #aebfb4;
  --gold: #efd096;
  --mint: #ace5c1;
  --red: #f5aaa5;
  font-family: 'Leelawadee UI', Tahoma, system-ui, sans-serif;
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-width: 0;
  background: #0c1515;
  color: var(--ink);
}
body {
  min-height: 100svh;
}
button,
input {
  font: inherit;
}
button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #263935;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}
button:hover:enabled {
  filter: brightness(1.16);
}
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
[hidden] {
  display: none !important;
}
h1,
h2,
p {
  margin: 0;
}
.app-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-areas: 'mast' 'nav' 'table' 'dock';
  grid-template-rows: 62px 52px minmax(0, 1fr) 158px;
  width: min(100%, 1000px);
  height: 100svh;
  min-height: 0;
  margin: auto;
  overflow: hidden;
  background: var(--night);
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
}
.masthead {
  grid-area: mast;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px clamp(12px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
}
.brand,
.mast-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--gold);
  color: #291e11;
  font-size: 25px;
}
.brand strong {
  display: block;
  font:
    600 21px/1 Georgia,
    serif;
  white-space: nowrap;
}
.brand span:not(.brand-mark) {
  display: block;
  margin-top: 4px;
  font: 700 9px/1.1 system-ui;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.connection {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.icon-button,
.profile-button,
.emoji-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  flex: none;
}
.icon-button {
  font-size: 22px;
}
.profile-button {
  background: transparent;
  border-color: transparent;
}
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border-radius: 50%;
  background: #e4c988;
  color: #2d261b;
  font-size: 18px;
  font-weight: 800;
}
.avatar.heart,
.avatar.diamond {
  background: #e8b9b4;
  color: #812c31;
}
.avatar.club {
  background: #a9d5bf;
  color: #20443a;
}
.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.nav {
  grid-area: nav;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px clamp(8px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar {
  display: none;
}
.nav button {
  flex: 1;
  min-width: 65px;
  padding: 0 7px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}
.nav button span {
  color: #a6bdab;
  margin-left: 3px;
  font-size: 12px;
}
.nav .nav-current {
  background: #2a3d35;
  color: var(--mint);
}
.table-area {
  grid-area: table;
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #20342d 0, #142322 68%);
}
.table-heading {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: clamp(12px, 3vw, 28px);
  right: clamp(12px, 3vw, 28px);
  display: flex;
  justify-content: space-between;
  align-items: start;
  pointer-events: none;
}
.table-heading strong,
.table-heading span {
  display: block;
}
.table-heading strong {
  font-size: 15px;
}
.table-heading span {
  font-size: 11px;
  color: var(--muted);
}
.table-heading .occupancy {
  color: var(--mint);
  white-space: nowrap;
}
.arena {
  position: absolute;
  inset: 42px 0 0;
  max-width: 840px;
  width: 100%;
  margin: auto;
}
.felt {
  position: absolute;
  inset: 12% 7% 12%;
  border: clamp(6px, 1.6vw, 12px) solid #493d2d;
  border-radius: 50% / 42%;
  outline: 1px solid #84704d;
  box-shadow:
    0 5px 0 #6c5a3c,
    0 14px 25px #0007,
    inset 0 0 45px #031c16;
  background:
    repeating-linear-gradient(125deg, #ffffff08 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 48% 40%, #2a7358, #123e33 74%);
}
.felt-line {
  position: absolute;
  inset: 12px 6%;
  border: 1px solid #a4d1ac55;
  border-radius: inherit;
}
.board {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}
.street {
  color: #c7e9ce;
  font: 700 11px/1 system-ui;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.cards {
  display: flex;
  justify-content: center;
  gap: clamp(3px, 0.8vw, 7px);
}
.playing-card,
.empty-card {
  position: relative;
  width: clamp(31px, 8.2vw, 54px);
  aspect-ratio: 0.72;
  border-radius: 5px;
  flex: none;
}
.playing-card {
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #fffaf0, #e5dbc5);
  border: 1px solid #fff7e7;
  color: #142320;
  box-shadow: 0 3px 6px #0005;
  font-weight: 800;
}
.playing-card.red {
  color: #a32d34;
}
.playing-card small {
  position: absolute;
  top: 1px;
  left: 3px;
  font-size: clamp(10px, 2vw, 14px);
  line-height: 1;
}
.playing-card b {
  font-size: clamp(23px, 5.2vw, 39px);
  line-height: 1;
  transform: translateY(4px);
}
.empty-card {
  border: 1px dashed #b9dab788;
  background: #091e1940;
}
.pot {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #f4dcaa;
  font: 700 10px/1 system-ui;
  letter-spacing: 0.06em;
}
.pot strong {
  font: 700 clamp(15px, 3vw, 21px)/1 system-ui;
  letter-spacing: 0;
  color: #fff0ca;
}
.chip {
  width: 16px;
  height: 16px;
  border: 3px dashed #f9dfaa;
  border-radius: 50%;
  background: #a27b40;
}
.seat {
  position: absolute;
  z-index: 1;
  width: clamp(72px, 20%, 120px);
  min-height: 58px;
  padding: 4px;
  border: 1px solid #607365;
  border-radius: 10px;
  background: #192a26;
  box-shadow: 0 4px 12px #0006;
  text-align: center;
  font-size: 11px;
}
.seat strong,
.seat .stack {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.seat .avatar {
  width: 23px;
  height: 23px;
  font-size: 14px;
}
.seat .stack {
  color: #d4e3d5;
  font-variant-numeric: tabular-nums;
}
.seat .debt {
  color: var(--red);
}
.seat[data-turn='true'] {
  border-color: #fae1a8;
  box-shadow:
    0 0 0 2px #a88a50,
    0 0 18px #f3cd7444;
}
.seat[data-winner='true'] {
  border-color: var(--gold);
}
.seat .seat-tag {
  position: absolute;
  top: 4px;
  right: 5px;
  color: var(--gold);
  font: 800 9px system-ui;
}
.seat .seat-medal {
  position: absolute;
  top: 4px;
  left: 4px;
}
.seat.vacant {
  display: grid;
  place-items: center;
  padding: 0;
  border-style: dashed;
  background: #172b26;
  box-shadow: none;
}
.seat.vacant button {
  width: 100%;
  min-height: 58px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: #c8d7c9;
  font-size: 11px;
}
.seat-0 {
  left: 50%;
  bottom: 1%;
  transform: translateX(-50%);
}
.seat-1 {
  left: 2%;
  bottom: 15%;
}
.seat-2 {
  left: 2%;
  top: 12%;
}
.seat-3 {
  left: 50%;
  top: 1%;
  transform: translateX(-50%);
}
.seat-4 {
  right: 2%;
  top: 12%;
}
.seat-5 {
  right: 2%;
  bottom: 15%;
}
.hole-cards {
  position: absolute;
  bottom: max(18%, 71px);
  left: 50%;
  transform: translateX(-50%);
}
.hole-cards .playing-card {
  width: clamp(27px, 6.3vw, 39px);
}
.hole-cards .playing-card b {
  font-size: clamp(21px, 4.2vw, 30px);
}
.reaction-bubble {
  position: absolute;
  z-index: 3;
  right: 6%;
  top: 3%;
  max-width: 32%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 10px;
  border: 1px solid #71694e;
  border-radius: 12px;
  background: #2e4036;
}
.dock {
  grid-area: dock;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
  padding: 10px clamp(12px, 3vw, 28px);
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.dock-heading,
.dock-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
}
.dock-heading {
  color: var(--gold);
}
.dock-heading #countdown,
.dock-bottom {
  font-size: 11px;
  color: var(--muted);
}
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
}
.action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.action-grid button {
  padding: 2px;
  font-size: 13px;
}
.action-grid button small {
  display: block;
  font-size: 10px;
}
.main-action,
.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #2b2010;
}
.fold-action {
  color: #f5b7ad;
}
.dock-bottom {
  flex: 1;
  min-height: 44px;
}
.dock-bottom > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dock-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  flex: none;
}
.text-button {
  padding: 0 7px;
  border-color: transparent;
  background: transparent;
  color: var(--mint);
  font-size: 12px;
}
.emoji-toggle {
  font-size: 22px;
  background: transparent;
}
.emoji-menu {
  position: absolute;
  z-index: 5;
  right: 10px;
  bottom: 100%;
  display: flex;
  gap: 3px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #22352e;
  box-shadow: 0 8px 24px #0009;
}
.emoji-menu button {
  width: 44px;
  padding: 0;
  font-size: 21px;
}
.result-panel {
  position: absolute;
  z-index: 4;
  inset: 7% max(5%, calc((100% - 540px) / 2));
  display: flex;
  flex-direction: column;
  padding: 14px;
  border: 1px solid #847152;
  border-radius: 14px;
  background: #1b302aee;
  box-shadow: 0 12px 32px #000a;
}
.result-header,
.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}
.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--gold);
  font: 700 9px/1.2 system-ui;
  letter-spacing: 0.14em;
}
.result-header h2,
.modal h1,
.modal h2 {
  font-size: 20px;
}
.result-header > div {
  min-width: 0;
}
#result-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.result-header p,
.modal-copy {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}
.result-list,
.person-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  overflow: auto;
}
.result-list li,
.person-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.result-person,
.person-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.person-line strong,
.result-person strong {
  overflow-wrap: anywhere;
}
.result-detail {
  display: grid;
  justify-items: end;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
}
.result-detail .playing-card {
  width: 29px;
}
.result-detail .playing-card b {
  font-size: 22px;
}
.result-detail .playing-card small {
  font-size: 9px;
}
.result-list [data-winner='true'] strong {
  color: var(--gold);
}
.modal-backdrop {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  background: #050c0bd9;
}
.modal {
  width: min(100%, 440px);
  max-height: 100%;
  overflow: auto;
  padding: 20px;
  border: 1px solid #596a5e;
  border-radius: 18px;
  background: #192b27;
  box-shadow: 0 18px 60px #0009;
}
.modal label {
  display: block;
  margin: 15px 0 6px;
  color: #dbe8da;
  font-weight: 700;
  font-size: 12px;
}
.modal input:not([type='file']) {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid #5b7061;
  border-radius: 9px;
  background: #10201c;
  color: var(--ink);
  font-size: 16px;
}
.modal-copy {
  line-height: 1.5;
}
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.wide {
  width: 100%;
  margin-top: 14px;
}
.profile-choices {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar-large {
  width: 58px;
  height: 58px;
  font-size: 30px;
}
.preset-grid {
  display: flex;
  gap: 5px;
}
.preset-grid button {
  width: 44px;
  padding: 0;
  font-size: 21px;
}
.preset-grid button[aria-pressed='true'] {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}
.upload-button {
  display: inline-flex !important;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px dashed #789280;
  border-radius: 9px;
  cursor: pointer;
}
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.form-note {
  min-height: 1em;
  margin-top: 7px;
  color: #f6b8ae;
  font-size: 12px;
}
.loan-quote {
  margin-top: 15px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #12221e;
}
.loan-quote p {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}
.loan-quote button {
  width: 100%;
  margin-top: 10px;
}
.balance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.balance-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #12221e;
}
.balance-grid span,
.balance-grid strong {
  display: block;
}
.balance-grid span {
  color: var(--muted);
  font-size: 11px;
}
.balance-grid strong {
  margin-top: 4px;
  font-size: 19px;
}
.rank-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  flex: none;
  font-size: 18px;
}
.person-meta {
  display: grid;
  gap: 2px;
}
.person-meta small {
  color: var(--muted);
}
.empty-message {
  color: var(--muted);
  font-size: 13px;
}
.toast {
  position: fixed;
  z-index: 20;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 10px 14px;
  border: 1px solid #8b7655;
  border-radius: 10px;
  background: #293a31;
  box-shadow: 0 4px 20px #0009;
  text-align: center;
}
@media (orientation: landscape) and (max-height: 500px) {
  .app-shell {
    grid-template-areas: 'mast nav' 'table dock';
    grid-template-columns: minmax(0, 1fr) minmax(230px, 36%);
    grid-template-rows: 52px minmax(0, 1fr);
  }
  .masthead {
    padding-block: 4px;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
  }
  .brand strong {
    font-size: 18px;
  }
  .connection {
    display: none;
  }
  .nav {
    border-bottom: 1px solid var(--line);
    padding: 2px 5px;
  }
  .nav button {
    min-width: 0;
    font-size: 12px;
  }
  .table-heading {
    top: 5px;
  }
  .arena {
    inset: 30px 0 0;
  }
  .dock {
    border-top: 0;
    border-left: 1px solid var(--line);
    justify-content: center;
    gap: 8px;
    overflow: visible;
  }
  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dock-bottom {
    flex: 0;
  }
  .dock-bottom > span {
    display: none;
  }
  .dock-buttons {
    width: 100%;
  }
  .board {
    top: 26%;
    gap: 3px;
  }
  .playing-card,
  .empty-card {
    width: clamp(25px, 5vw, 38px);
  }
  .playing-card b {
    font-size: 24px;
  }
  .seat {
    min-height: 50px;
  }
  .seat .avatar {
    width: 19px;
    height: 19px;
    font-size: 12px;
  }
  .seat.vacant button {
    min-height: 50px;
  }
  .hole-cards {
    bottom: max(24%, 61px);
  }
  .hole-cards .playing-card {
    width: 27px;
  }
  .result-panel {
    inset: 2% 8%;
    padding: 9px;
  }
  .result-header h2 {
    font-size: 16px;
  }
}
@media (orientation: portrait) and (max-height: 640px) {
  .app-shell {
    grid-template-rows: 56px 48px minmax(0, 1fr) 142px;
  }
  .nav {
    padding-block: 2px;
  }
  .arena {
    inset-block-start: 34px;
  }
  .dock {
    padding-block: 8px;
    gap: 6px;
  }
  .board {
    top: max(24%, 62px);
    gap: 4px;
  }
  .board-cards .playing-card,
  .board-cards .empty-card {
    width: clamp(29px, 7.9vw, 45px);
  }
  .hole-cards {
    bottom: max(18%, 65px);
  }
}
@media (max-width: 370px) {
  .connection {
    display: none;
  }
  .nav button {
    min-width: 62px;
  }
  .dock {
    padding-inline: 9px;
  }
  .text-button {
    padding-inline: 4px;
  }
  .seat {
    width: 72px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
.result-board {
  justify-content: start;
  flex: none;
  margin-top: 8px;
}
.result-board .playing-card {
  width: clamp(28px, 7vw, 34px);
  aspect-ratio: 0.8;
}
.result-board .playing-card b {
  font-size: 21px;
}
.result-board .playing-card small {
  font-size: 10px;
}
.result-list {
  min-height: 0;
}
.connection-recovery {
  position: fixed;
  z-index: 21;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 95%;
  padding: 6px 8px;
  border: 1px solid var(--gold);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 8px 28px #0008;
}
.dock-heading > div:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dock-meta {
  display: flex;
  flex: none;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}
.debt-status,
.person-meta .debt {
  color: var(--red);
}
.result-person .payout {
  color: var(--gold);
  font-weight: 650;
}
