:root {
  color-scheme: dark;
  --bg: #071713;
  --bg-elevated: #0b241c;
  --table: #13513c;
  --table-deep: #0d3b2d;
  --gold: #e8be65;
  --gold-soft: #f6dda5;
  --cream: #fffaf0;
  --ink: #191613;
  --muted: #9db8ad;
  --white: #f7fbf9;
  --danger: #ff8d7d;
  --success: #7ee2ac;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.36);
  --card-width: clamp(48px, 7vw, 74px);
  --card-height: calc(var(--card-width) * 1.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--white);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-background {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 20% -10%, rgba(51, 151, 109, 0.26), transparent 38%),
    radial-gradient(circle at 100% 20%, rgba(232, 190, 101, 0.1), transparent 30%),
    linear-gradient(180deg, #09231b 0%, var(--bg) 75%);
}

.app-background::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.10'%3E%3Cpath d='M40 8 72 40 40 72 8 40Z'/%3E%3Cpath d='M40 25 55 40 40 55 25 40Z'/%3E%3C/g%3E%3C/svg%3E");
}

.topbar {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand-button {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.brand-button strong,
.brand-button small {
  display: block;
}

.brand-button strong {
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.brand-button small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.72rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #163326;
  background: linear-gradient(145deg, var(--gold-soft), var(--gold));
  box-shadow: 0 8px 25px rgba(232, 190, 101, 0.22);
  font-weight: 900;
  font-size: 1.15rem;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.close-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.icon-button {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 750;
}

.icon-button:hover,
.close-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.22);
}

.app-shell {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding-bottom: 46px;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 14px;
}

.score-card {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 17px;
  border: 1px solid var(--line);
  background: rgba(10, 33, 26, 0.82);
  box-shadow: 0 9px 30px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.score-card.is-leader {
  border-color: rgba(232, 190, 101, 0.55);
  background: linear-gradient(135deg, rgba(232, 190, 101, 0.16), rgba(10, 33, 26, 0.88));
}

.score-card.is-winner::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: var(--gold);
}

.avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #102b21;
  background: var(--gold-soft);
  font-weight: 900;
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.score-meta {
  min-width: 0;
  flex: 1;
}

.score-name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: #dceae4;
  font-size: 0.75rem;
}

.score-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-value {
  margin-top: 2px;
  font-size: 1.12rem;
  font-weight: 850;
}

.deal-score {
  color: var(--success);
  font-size: 0.7rem;
  font-weight: 750;
}

.game-table {
  position: relative;
  min-height: clamp(390px, 51vw, 610px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: clamp(32px, 7vw, 90px);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.05), transparent 34%),
    linear-gradient(145deg, #165b44, var(--table-deep));
  box-shadow: var(--shadow), inset 0 0 0 10px rgba(1, 18, 12, 0.2), inset 0 0 0 12px rgba(232, 190, 101, 0.18);
  overflow: hidden;
  isolation: isolate;
}

.game-table::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.17;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.18'%3E%3Ccircle cx='60' cy='60' r='21'/%3E%3Cpath d='M60 26 94 60 60 94 26 60Z'/%3E%3C/g%3E%3C/svg%3E");
}

.table-ring {
  position: absolute;
  inset: 24px;
  border: 1px dashed rgba(255, 255, 255, 0.11);
  border-radius: inherit;
  pointer-events: none;
}

.dealer-chip {
  position: absolute;
  z-index: 5;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #193326;
  background: var(--gold);
  border: 2px solid #fff3d5;
  font-size: 0.7rem;
  font-weight: 900;
  transition: inset 250ms ease, transform 250ms ease;
}

.dealer-0 { left: 18%; bottom: 13%; }
.dealer-1 { right: 12%; top: 47%; }
.dealer-2 { left: 18%; top: 12%; }
.dealer-3 { left: 10%; top: 47%; }

.seat {
  position: absolute;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 90px;
}

.seat-top { left: 50%; top: 26px; transform: translateX(-50%); }
.seat-left { left: 22px; top: 50%; transform: translateY(-50%); }
.seat-right { right: 22px; top: 50%; transform: translateY(-50%); }
.seat-bottom { left: 50%; bottom: 22px; transform: translateX(-50%); }

.seat-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 160px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #e8f2ee;
  background: rgba(4, 22, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  font-size: 0.72rem;
  font-weight: 750;
}

.seat-badge .mini-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #193326;
  background: var(--gold-soft);
  font-size: 0.65rem;
  font-weight: 900;
}

.seat-status {
  color: rgba(244, 255, 250, 0.68);
  font-size: 0.68rem;
}

.card-backs {
  display: flex;
}

.mini-card-back {
  width: 26px;
  height: 36px;
  margin-left: -12px;
  border: 2px solid #f5e0b2;
  border-radius: 5px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.08) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.08) 75%),
    #6e1f2a;
  background-size: 7px 7px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.24);
}

.mini-card-back:first-child { margin-left: 0; }

.table-center {
  position: absolute;
  inset: 18% 17%;
  display: grid;
  place-items: center;
  text-align: center;
}

.center-message {
  max-width: 460px;
  padding: 20px;
}

.center-kicker {
  color: var(--gold-soft);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  font-weight: 850;
  text-transform: uppercase;
}

.center-message h2 {
  margin: 8px 0 7px;
  font-size: clamp(1.45rem, 4vw, 2.7rem);
  line-height: 1.05;
}

.center-message p {
  margin: 0;
  color: rgba(240, 251, 246, 0.75);
  font-size: clamp(0.82rem, 2vw, 1rem);
  line-height: 1.55;
}

.deck-stack {
  position: relative;
  width: 64px;
  height: 88px;
  margin: 0 auto 17px;
}

.deck-card {
  position: absolute;
  inset: 0;
  border: 3px solid #f4dfb4;
  border-radius: 10px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.08) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.08) 75%),
    #792632;
  background-size: 10px 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.deck-card:nth-child(1) { transform: rotate(-8deg) translate(-8px, 2px); }
.deck-card:nth-child(2) { transform: rotate(5deg) translate(7px, 1px); }

.trick-layout {
  width: 100%;
  max-width: 660px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.trick-play {
  position: relative;
  min-width: 0;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(4, 30, 21, 0.48);
}

.trick-play.is-winning {
  border-color: rgba(232, 190, 101, 0.7);
  box-shadow: 0 0 0 2px rgba(232, 190, 101, 0.13), 0 12px 24px rgba(0, 0, 0, 0.18);
}

.trick-player {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
  color: #d9ebe4;
  font-size: 0.66rem;
  font-weight: 800;
}

.trick-player span:last-child {
  color: var(--gold-soft);
  white-space: nowrap;
}

.trick-cards {
  display: flex;
  justify-content: center;
}

.primary-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 78px;
  padding: 14px 0 5px;
}

.button {
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 820;
  transition: transform 150ms ease, filter 150ms ease, opacity 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  color: #173126;
  background: linear-gradient(145deg, var(--gold-soft), var(--gold));
  box-shadow: 0 8px 24px rgba(232, 190, 101, 0.2);
}

.button-secondary {
  color: #e7f3ee;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.button-large {
  width: 100%;
  min-height: 50px;
  font-size: 0.98rem;
}

.action-note {
  color: var(--muted);
  font-size: 0.74rem;
}

.arrangement-panel {
  margin-top: 8px;
  padding: clamp(16px, 3vw, 25px);
  border: 1px solid var(--line);
  border-radius: 25px;
  background: rgba(9, 31, 24, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel-heading,
.hand-zone-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.panel-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(1.2rem, 3vw, 1.65rem);
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  font-weight: 900;
}

.arrangement-tools {
  display: flex;
  gap: 7px;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 13px;
}

.group-box {
  min-width: 0;
  min-height: 155px;
  padding: 11px;
  border-radius: 17px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.group-box:hover,
.group-box.is-drop-target {
  border-color: rgba(232, 190, 101, 0.72);
  background: rgba(232, 190, 101, 0.08);
  transform: translateY(-1px);
}

.group-box.is-invalid {
  border-color: rgba(255, 141, 125, 0.64);
}

.group-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 7px;
  min-height: 35px;
}

.group-heading strong {
  display: block;
  font-size: 0.77rem;
}

.group-heading small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.61rem;
}

.group-count {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #c9dcd4;
  font-size: 0.62rem;
  font-weight: 800;
}

.card-row {
  min-height: var(--card-height);
  display: flex;
  align-items: center;
  justify-content: center;
}

.group-cards {
  margin-top: 7px;
  padding: 5px 0 2px;
}

.group-cards .playing-card + .playing-card,
.trick-cards .playing-card + .playing-card {
  margin-left: calc(var(--card-width) * -0.38);
}

.trick-cards .playing-card {
  --card-width: clamp(37px, 5.2vw, 58px);
}

.hand-zone {
  padding: 13px;
  border: 1px dashed rgba(255, 255, 255, 0.17);
  border-radius: 18px;
  background: rgba(1, 14, 10, 0.25);
}

.hand-zone.is-drop-target {
  border-color: var(--gold);
}

.hand-zone-heading {
  margin-bottom: 13px;
  color: #dbeae4;
  font-size: 0.76rem;
  font-weight: 780;
}

.selection-hint {
  color: var(--muted);
  font-weight: 600;
}

.hand-cards {
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px 12px;
  scrollbar-color: rgba(255,255,255,.22) transparent;
}

.hand-cards .playing-card {
  flex: 0 0 auto;
}

.hand-cards .playing-card + .playing-card {
  margin-left: calc(var(--card-width) * -0.18);
}

.playing-card {
  position: relative;
  width: var(--card-width);
  height: var(--card-height);
  flex: 0 0 var(--card-width);
  border: 1px solid rgba(0, 0, 0, 0.17);
  border-radius: calc(var(--card-width) * 0.13);
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 13%, rgba(232, 190, 101, 0.22), transparent 25%),
    linear-gradient(145deg, #fffdf8, #f3ead8);
  box-shadow: 0 7px 17px rgba(0, 0, 0, 0.28);
  user-select: none;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, outline 150ms ease;
}

.playing-card.red {
  color: #b12736;
}

.playing-card:hover {
  transform: translateY(-5px);
  z-index: 5;
}

.playing-card.is-selected {
  transform: translateY(-13px);
  outline: 3px solid var(--gold);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.33), 0 0 0 6px rgba(232, 190, 101, 0.12);
  z-index: 10;
}

.card-corner {
  position: absolute;
  top: 7%;
  left: 10%;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.86;
  font-size: calc(var(--card-width) * 0.24);
  font-weight: 900;
}

.card-corner span:last-child {
  margin-top: calc(var(--card-width) * 0.045);
  font-size: calc(var(--card-width) * 0.28);
}

.card-suit-large {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 14%;
  font-size: calc(var(--card-width) * 0.5);
  opacity: 0.92;
}

.card-corner-bottom {
  top: auto;
  left: auto;
  right: 10%;
  bottom: 7%;
  transform: rotate(180deg);
}

.empty-slot {
  width: var(--card-width);
  height: var(--card-height);
  flex: 0 0 var(--card-width);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: calc(var(--card-width) * 0.13);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.17);
  font-size: 0.68rem;
}

.empty-slot + .empty-slot {
  margin-left: calc(var(--card-width) * -0.38);
}

.validation-message {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.75rem;
}

.validation-message.is-error { color: var(--danger); }
.validation-message.is-valid { color: var(--success); }

.modal {
  width: min(94vw, 560px);
  max-height: min(90vh, 780px);
  padding: 0;
  border: 0;
  border-radius: 25px;
  color: var(--white);
  background: transparent;
  overflow: visible;
}

.modal::backdrop {
  background: rgba(1, 10, 7, 0.79);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: 100%;
  max-height: min(90vh, 780px);
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 25px;
  background:
    radial-gradient(circle at 100% 0, rgba(232, 190, 101, 0.12), transparent 31%),
    linear-gradient(145deg, #113a2c, #091d17);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  overflow-y: auto;
}

.welcome-modal {
  width: min(94vw, 480px);
  text-align: center;
}

.welcome-modal .eyebrow {
  margin-top: 4px;
}

.welcome-modal h1 {
  margin: 7px 0 9px;
  font-size: clamp(1.75rem, 6vw, 2.55rem);
  line-height: 1.05;
}

.modal-copy {
  margin: 0 auto 22px;
  max-width: 390px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.88rem;
}

.welcome-art {
  position: relative;
  height: 142px;
  margin: -8px 0 11px;
  display: grid;
  place-items: center;
}

.welcome-logo {
  position: relative;
  z-index: 4;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #173529;
  background: linear-gradient(145deg, #ffe7ad, #dba84c);
  border: 5px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
  font-size: 1.42rem;
  font-weight: 950;
}

.floating-card {
  position: absolute;
  width: 69px;
  height: 96px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border-radius: 10px;
  color: #1f1a16;
  background: var(--cream);
  border: 2px solid #e6d7b9;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
  font-weight: 900;
}

.card-one { transform: translateX(-84px) rotate(-18deg); color: #b12736; }
.card-two { transform: translateX(84px) rotate(18deg); }
.card-three { transform: translateY(-10px) rotate(3deg); color: #b12736; }

.field-label {
  display: block;
  margin-bottom: 7px;
  color: #dcebe5;
  text-align: left;
  font-size: 0.77rem;
  font-weight: 800;
}

.text-input {
  width: 100%;
  height: 50px;
  margin-bottom: 12px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 13px;
  outline: none;
  color: var(--white);
  background: rgba(0, 0, 0, 0.18);
}

.text-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(232, 190, 101, 0.12);
}

.privacy-note {
  margin: 12px 0 0;
  color: #7f9b90;
  font-size: 0.68rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 4px 0 0;
  font-size: 1.55rem;
}

.close-button {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 1.4rem;
}

.rules-content {
  color: #c8dcd4;
  font-size: 0.84rem;
  line-height: 1.6;
}

.rules-content h3 {
  margin: 20px 0 7px;
  color: var(--white);
  font-size: 1rem;
}

.rules-content ol,
.rules-content ul {
  padding-left: 20px;
}

.rule-ranking {
  display: grid;
  gap: 7px;
  margin: 12px 0;
}

.rule-rank {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.055);
}

.rule-rank strong { color: var(--gold-soft); }
.rule-rank span { text-align: right; color: #9eb8ad; }

.result-card {
  text-align: center;
}

.result-icon {
  width: 75px;
  height: 75px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #173126;
  background: var(--gold);
  font-size: 2rem;
  box-shadow: 0 12px 35px rgba(232, 190, 101, 0.25);
}

.result-card h2 {
  margin: 0 0 8px;
  font-size: 1.9rem;
}

.result-card > p {
  margin: 0 auto 18px;
  color: var(--muted);
}

.result-scores {
  display: grid;
  gap: 8px;
  margin: 17px 0;
}

.result-score-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  text-align: left;
  font-size: 0.8rem;
}

.result-score-row strong:last-child {
  color: var(--gold-soft);
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.result-actions .button { flex: 1; }

.menu-card {
  display: grid;
  gap: 8px;
}

.menu-row {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 11px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  text-align: left;
}

.menu-row:hover {
  background: rgba(255, 255, 255, 0.085);
}

.menu-row > span:first-child {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #173126;
  background: var(--gold-soft);
  font-size: 1.2rem;
  font-weight: 900;
}

.menu-row strong,
.menu-row small {
  display: block;
}

.menu-row small {
  margin-top: 2px;
  color: var(--muted);
}

.toast-region {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  width: min(calc(100% - 32px), 450px);
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  color: #f1f9f6;
  background: rgba(6, 28, 21, 0.94);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
  text-align: center;
  font-size: 0.78rem;
  animation: toast-in 180ms ease both;
}

.toast.error { border-color: rgba(255, 141, 125, 0.45); }
.toast.success { border-color: rgba(126, 226, 172, 0.45); }

.busy-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 850px) {
  .score-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-box {
    min-height: 145px;
  }

  .table-center {
    inset: 19% 14%;
  }
}

@media (max-width: 600px) {
  :root {
    --card-width: 55px;
  }

  .topbar,
  .app-shell {
    width: min(100% - 18px, 1240px);
  }

  .topbar {
    padding-top: 10px;
  }

  .brand-button small {
    display: none;
  }

  .icon-button {
    min-width: 37px;
    height: 37px;
    padding: 0 9px;
    border-radius: 11px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .score-card {
    padding: 8px 9px;
  }

  .avatar {
    width: 31px;
    height: 31px;
    font-size: 0.75rem;
  }

  .score-value { font-size: 0.95rem; }
  .score-name { font-size: 0.68rem; }

  .game-table {
    min-height: 430px;
    border-radius: 36px;
    box-shadow: var(--shadow), inset 0 0 0 7px rgba(1, 18, 12, 0.2), inset 0 0 0 9px rgba(232, 190, 101, 0.18);
  }

  .table-ring { inset: 17px; }
  .seat-top { top: 18px; }
  .seat-bottom { bottom: 16px; }
  .seat-left { left: 11px; }
  .seat-right { right: 11px; }
  .seat-badge { padding: 5px 7px; max-width: 108px; }
  .seat-badge .mini-avatar { display: none; }
  .seat-status { font-size: 0.6rem; }
  .mini-card-back { width: 21px; height: 30px; margin-left: -11px; }

  .table-center {
    inset: 20% 10%;
  }

  .trick-layout {
    gap: 7px;
  }

  .trick-play {
    padding: 7px;
    border-radius: 12px;
  }

  .trick-cards .playing-card {
    --card-width: 41px;
  }

  .trick-player {
    font-size: 0.57rem;
  }

  .arrangement-panel {
    padding: 14px;
    border-radius: 20px;
  }

  .panel-heading {
    align-items: flex-end;
  }

  .arrangement-tools .button {
    padding: 9px 10px;
    font-size: 0.7rem;
  }

  .group-grid {
    gap: 7px;
    margin-top: 14px;
  }

  .group-box {
    min-height: 137px;
    padding: 8px;
  }

  .group-cards .playing-card,
  .empty-slot {
    --card-width: 48px;
  }

  .hand-zone {
    padding: 10px;
  }

  .selection-hint {
    display: none;
  }

  .primary-actions {
    min-height: 70px;
    flex-direction: column;
    gap: 6px;
  }

  .primary-actions .button {
    width: min(100%, 360px);
  }

  .result-actions {
    flex-direction: column;
  }
}

@media (max-width: 390px) {
  :root { --card-width: 51px; }
  .group-cards .playing-card,
  .empty-slot { --card-width: 43px; }
  .trick-cards .playing-card { --card-width: 36px; }
  .score-strip { gap: 6px; }
  .score-card { gap: 7px; }
  .avatar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* Online room MVP */
.welcome-actions {
  display: grid;
  gap: 9px;
}

.welcome-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 10px;
  color: #7f9b90;
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.welcome-divider::before,
.welcome-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: rgba(255,255,255,.1);
}

.join-room-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.join-room-row .text-input { margin-bottom: 0; }
.room-code-input { text-transform: uppercase; letter-spacing: .12em; font-weight: 900; }
.invite-notice { margin: 10px 0 0; color: var(--gold-soft); font-size: .75rem; font-weight: 800; }

.room-lobby {
  width: min(100%, 410px);
  margin: 0 auto;
  text-align: center;
}

.room-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 11px;
  padding: 8px 12px;
  border: 1px solid rgba(232,190,101,.32);
  border-radius: 999px;
  background: rgba(0,0,0,.16);
  color: var(--gold-soft);
  font-size: .78rem;
  font-weight: 950;
  letter-spacing: .12em;
}

.lobby-player-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 7px;
  margin: 12px 0;
}

.lobby-player {
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  color: #dcebe5;
  font-size: .75rem;
  font-weight: 800;
}

.lobby-player.is-empty { color: #728e83; border-style: dashed; }
.lobby-copy-button { margin-top: 4px; }
.online-room-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--gold-soft);
  background: rgba(232,190,101,.1);
  border: 1px solid rgba(232,190,101,.2);
  font-size: .68rem;
  font-weight: 900;
}
