:root {
  --ink: #132520;
  --deep: #071814;
  --felt: #0d4a3a;
  --felt-light: #17624d;
  --cream: #f3ead7;
  --paper: #fffaf0;
  --gold: #d5a84b;
  --gold-light: #f2d58d;
  --red: #a4392e;
  --blue: #294c68;
  --muted: #9aaea6;
  --line: rgba(237, 220, 184, 0.2);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--cream);
  background:
    radial-gradient(circle at 50% -20%, #244b3e, transparent 44%),
    linear-gradient(145deg, #07130f, #101f1a 60%, #07130f);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.hidden {
  display: none !important;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.24'/%3E%3C/svg%3E");
}

.lobby-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 44px 22px 74px;
}

.lobby-account-area {
  position: fixed;
  right: 24px;
  top: 22px;
  z-index: 20;
}

.account-button,
.game-account-button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 7px;
  color: #e7eee9;
  border: 1px solid rgba(237, 220, 184, 0.24);
  border-radius: 22px;
  background: rgba(5, 24, 18, 0.78);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.account-avatar {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  color: #26352f;
  border-radius: 50%;
  background: var(--gold-light);
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
}

.account-label {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
}

.lobby-card {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(7, 24, 20, 0.82);
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
}

.brand-lockup {
  position: relative;
  padding: clamp(38px, 6vw, 78px);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(8, 49, 38, 0.65), rgba(7, 24, 20, 0.92)),
    repeating-linear-gradient(45deg, transparent 0 16px, rgba(255, 255, 255, 0.018) 16px 17px);
}

.brand-lockup::after {
  content: "";
  position: absolute;
  width: 330px;
  height: 330px;
  left: -170px;
  bottom: -180px;
  border: 1px solid rgba(213, 168, 75, 0.22);
  border-radius: 50%;
  box-shadow: 0 0 0 35px rgba(213, 168, 75, 0.035), 0 0 0 75px rgba(213, 168, 75, 0.02);
}

.brand-mark {
  width: 94px;
  height: 94px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 42px;
  color: var(--gold-light);
  border: 1px solid rgba(213, 168, 75, 0.45);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 25px;
}

.brand-mark i {
  width: 5px;
  height: 42px;
  display: block;
  border-radius: 4px;
  background: var(--gold);
  transform: rotate(35deg);
}

.eyebrow {
  margin: 0 0 11px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

h1 {
  font-size: clamp(56px, 7vw, 94px);
  line-height: 0.92;
  letter-spacing: -0.065em;
}

.intro {
  max-width: 410px;
  margin: 28px 0 0;
  color: #b8c8c1;
  font-size: 15px;
  line-height: 1.7;
}

.lobby-form {
  padding: clamp(32px, 5vw, 66px);
  background: rgba(255, 250, 240, 0.975);
  color: var(--ink);
}

label > span,
.form-title {
  display: block;
  margin: 0 0 8px;
  color: #52655e;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  padding: 14px 15px;
  color: var(--ink);
  outline: none;
  border: 1px solid #c8cec8;
  border-radius: 9px;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
  border-color: #2d705b;
  box-shadow: 0 0 0 3px rgba(45, 112, 91, 0.12);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #52655e 50%),
    linear-gradient(135deg, #52655e 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
}

.room-actions {
  margin-top: 35px;
}

.mode-field {
  display: block;
}

.mode-description {
  margin: 10px 0 18px;
  padding: 11px 13px;
  color: #52655e;
  border-left: 3px solid #24725a;
  border-radius: 0 8px 8px 0;
  background: rgba(36, 114, 90, 0.07);
  font-size: 11px;
  line-height: 1.55;
}

.seres-setup {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 17px;
}

.challenge-time-field {
  grid-column: 1 / -1;
}

.range-setting {
  display: grid;
  grid-template-columns: 1fr 52px;
  align-items: center;
  gap: 12px;
}

.range-setting input[type="range"] {
  height: 6px;
  padding: 0;
  accent-color: #24725a;
  border: 0;
  box-shadow: none;
}

.range-setting output {
  padding: 7px 8px;
  color: #2b2414;
  border-radius: 7px;
  background: var(--gold-light);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.setting-row {
  display: flex;
  flex-wrap: wrap;
  gap: 25px;
  margin: 15px 0 20px;
}

.ranked-switch {
  color: #87651e;
}

.ranked-note {
  margin: -7px 0 17px;
  padding: 10px 12px;
  color: #6d5b31;
  border-left: 2px solid var(--gold);
  background: rgba(213, 168, 75, 0.09);
  font-size: 11px;
  line-height: 1.45;
}

.switch-label,
.check-label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #465b53;
  font-size: 13px;
  font-weight: 650;
}

.switch-label input,
.check-label input {
  width: auto;
}

.switch-label input {
  position: absolute;
  opacity: 0;
}

.switch {
  width: 36px;
  height: 20px;
  position: relative;
  border-radius: 20px;
  background: #b9c2be;
  transition: background 0.2s;
}

.switch::after {
  content: "";
  width: 14px;
  height: 14px;
  position: absolute;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}

.switch-label input:checked + .switch {
  background: #24725a;
}

.switch-label input:checked + .switch::after {
  transform: translateX(16px);
}

.button {
  min-height: 45px;
  padding: 0 20px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: transform 0.16s, filter 0.16s, opacity 0.16s;
}

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

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

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

.button.primary {
  color: white;
  background: linear-gradient(135deg, #17614b, #0c4233);
  box-shadow: 0 8px 18px rgba(12, 66, 51, 0.18);
}

.button.secondary {
  color: var(--ink);
  border: 1px solid #bcc8c2;
  background: transparent;
}

.button.gold {
  color: #2b2414;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
}

.button.danger {
  color: white;
  background: linear-gradient(135deg, #c94f40, #8d2a22);
  box-shadow: 0 8px 18px rgba(141, 42, 34, 0.22);
}

.create-block .button,
.join-block .button {
  width: 100%;
}

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 0;
  color: #87938e;
  font-size: 11px;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #d8ddd9;
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-weight: 850;
}

.check-label {
  margin: 12px 0 16px;
}

.form-error {
  min-height: 20px;
  margin: 15px 0 0;
  color: #a4392e;
  font-size: 13px;
}

.text-button,
.icon-button {
  border: 0;
  cursor: pointer;
  background: transparent;
}

.lobby-shell > .text-button {
  position: fixed;
  bottom: 24px;
  color: #adc0b8;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.game-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.topbar {
  min-height: 58px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 22px;
  border-bottom: 1px solid rgba(237, 220, 184, 0.13);
  background: rgba(5, 20, 16, 0.8);
}

.mini-brand {
  font-family: Georgia, serif;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.mini-brand strong {
  color: var(--gold);
}

.room-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9eb1a9;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.room-chip strong {
  color: var(--cream);
  font-size: 15px;
  letter-spacing: 0.24em;
}

.room-chip button {
  padding: 5px 8px;
  color: var(--gold-light);
  border: 1px solid rgba(213, 168, 75, 0.3);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.game-account-button {
  padding: 3px 9px 3px 4px;
  border-color: rgba(213, 168, 75, 0.25);
  background: rgba(255, 255, 255, 0.04);
}

.game-account-button .account-avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.game-account-button .account-label {
  max-width: 90px;
  overflow: hidden;
  color: #c8d4cf;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions .text-button {
  color: #a8b8b1;
  font-size: 12px;
}

.icon-button {
  width: 30px;
  height: 30px;
  color: var(--gold-light);
  border: 1px solid rgba(213, 168, 75, 0.34);
  border-radius: 50%;
}

.spectator-badge {
  padding: 5px 8px;
  color: #d3dfda;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.score-strip {
  min-height: 73px;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(180px, 0.55fr) minmax(230px, 1fr);
  align-items: stretch;
  border-bottom: 1px solid rgba(237, 220, 184, 0.13);
  background: rgba(6, 28, 22, 0.82);
}

.player-score-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  border-bottom: 1px solid rgba(237, 220, 184, 0.13);
  background: rgba(213, 168, 75, 0.14);
}

.player-score {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  min-height: 58px;
  padding: 8px 16px;
  background: rgba(6, 28, 22, 0.94);
}

.player-score.turn {
  background: rgba(35, 98, 77, 0.96);
  box-shadow: inset 0 -3px var(--gold);
}

.player-score.loser {
  background: rgba(113, 35, 28, 0.92);
}

.player-score span {
  overflow: hidden;
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-score strong {
  grid-row: span 2;
  color: var(--gold-light);
  font: 500 27px Georgia, serif;
}

.player-score small {
  color: #8ea69c;
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.team-score {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 9px 32px;
}

.team-b {
  justify-content: flex-end;
  text-align: right;
}

.team-score > strong {
  color: var(--gold-light);
  font-family: Georgia, serif;
  font-size: 38px;
  font-weight: 500;
}

.team-score span {
  display: block;
  font-family: Georgia, serif;
  font-size: 15px;
}

.team-score small,
.round-status small {
  color: #879e95;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.round-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  text-align: center;
  border-inline: 1px solid rgba(237, 220, 184, 0.1);
}

.round-status span {
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.round-status strong {
  max-width: 330px;
  margin: 3px 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-stage {
  min-height: 460px;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 18px 18px 6px;
}

.table-halo {
  width: min(900px, 94vw);
  height: min(520px, 60vh);
  position: absolute;
  border-radius: 50%;
  background: rgba(19, 93, 72, 0.17);
  filter: blur(40px);
}

.card-table {
  width: min(860px, 92vw);
  height: min(490px, 57vh);
  min-height: 410px;
  position: relative;
  border: 9px solid #4a3222;
  border-radius: 42%;
  background:
    radial-gradient(circle at 50% 45%, rgba(44, 127, 98, 0.34), transparent 45%),
    repeating-linear-gradient(32deg, transparent 0 13px, rgba(255, 255, 255, 0.012) 13px 14px),
    var(--felt);
  box-shadow:
    0 0 0 2px #947149,
    0 0 0 8px #291d15,
    0 22px 55px rgba(0, 0, 0, 0.55),
    inset 0 0 85px rgba(0, 0, 0, 0.34);
}

.seat {
  min-width: 146px;
  position: absolute;
  z-index: 5;
  transform: translate(-50%, -50%);
}

.seat-north {
  left: 50%;
  top: 4%;
}

.seat-east {
  left: 95%;
  top: 50%;
}

.seat-south {
  left: 50%;
  top: 96%;
}

.seat-west {
  left: 5%;
  top: 50%;
}

.seat-anchor {
  left: 22%;
  top: 16%;
}

.inactive-seat {
  display: none;
}

.player-count-5 .seat-north {
  left: 50%;
  top: 3%;
}

.player-count-5 .seat-east {
  left: 94%;
  top: 38%;
}

.player-count-5 .seat-south {
  left: 77%;
  top: 91%;
}

.player-count-5 .seat-west {
  left: 23%;
  top: 91%;
}

.player-count-5 .seat-anchor {
  left: 6%;
  top: 38%;
}

.player-count-3 .seat-north {
  left: 50%;
  top: 3%;
}

.player-count-3 .seat-east {
  left: 91%;
  top: 77%;
}

.player-count-3 .seat-south {
  left: 9%;
  top: 77%;
}

.seat-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid rgba(237, 220, 184, 0.2);
  border-radius: 12px;
  background: rgba(3, 18, 14, 0.9);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.seat-card.turn {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(213, 168, 75, 0.14), 0 8px 18px rgba(0, 0, 0, 0.28);
}

.seat-card.disconnected {
  opacity: 0.52;
}

.seat-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #20372f;
  border-radius: 50%;
  background: var(--cream);
  font-family: Georgia, serif;
  font-size: 16px;
}

.seat-data {
  min-width: 0;
  flex: 1;
}

.seat-name {
  display: block;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-meta {
  display: block;
  margin-top: 2px;
  color: #8fa39b;
  font-size: 8px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.dealer-dot {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #3a2b11;
  border-radius: 50%;
  background: var(--gold-light);
  font-size: 8px;
  font-weight: 900;
}

.empty-seat {
  display: grid;
  place-items: center;
  height: 50px;
  color: rgba(243, 234, 215, 0.55);
  border: 1px dashed rgba(243, 234, 215, 0.22);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.trick-area {
  width: 300px;
  height: 245px;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
}

.trick-slot {
  width: 74px;
  height: 106px;
  position: absolute;
}

.trick-north {
  left: 50%;
  top: 0;
  transform: translateX(-50%) rotate(2deg);
}

.trick-east {
  right: 6px;
  top: 50%;
  transform: translateY(-50%) rotate(92deg);
}

.trick-south {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) rotate(-2deg);
}

.trick-west {
  left: 6px;
  top: 50%;
  transform: translateY(-50%) rotate(-88deg);
}

.trick-anchor {
  left: 30px;
  top: 10px;
  transform: rotate(-38deg);
}

.table-emblem {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(229, 212, 173, 0.17);
  transform: translate(-50%, -50%);
  font-family: Georgia, serif;
  font-size: 10px;
  letter-spacing: 0.14em;
}

.table-emblem i {
  width: 4px;
  height: 23px;
  display: block;
  border-radius: 4px;
  background: currentColor;
  transform: rotate(34deg);
}

.playing-card {
  width: 72px;
  height: 131px;
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(34, 28, 20, 0.42);
  border-radius: 7px;
  background: #f8f6ed;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.38);
  transform-origin: 50% 100%;
}

button.playing-card {
  padding: 0;
  cursor: default;
}

.card-artwork {
  position: absolute;
  inset: -1px;
  display: block;
  background-image: url("/assets/cards/triestine-sprite.png");
  background-repeat: no-repeat;
  background-position: var(--art-x) var(--art-y);
  background-size: 1000% 400%;
}

.trick-slot .playing-card {
  width: 64px;
  height: 116px;
  animation: card-arrive 0.3s ease-out both;
}

@keyframes card-arrive {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.84);
  }
}

.captured-pile {
  position: absolute;
  bottom: 17%;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(243, 234, 215, 0.66);
  font-size: 10px;
}

.pile-a {
  left: 22%;
}

.pile-b {
  right: 22%;
}

.captured-pile i {
  width: 26px;
  height: 36px;
  display: block;
  border: 1px solid rgba(243, 234, 215, 0.23);
  border-radius: 4px;
  background: repeating-linear-gradient(45deg, #7d332c 0 3px, #dfc381 3px 4px);
  box-shadow: 3px 2px 0 rgba(243, 234, 215, 0.15);
  transform: rotate(-7deg);
}

.table-message {
  position: absolute;
  left: 50%;
  bottom: 12%;
  z-index: 4;
  max-width: 440px;
  padding: 6px 12px;
  color: #e8dec9;
  border-radius: 20px;
  background: rgba(4, 26, 20, 0.7);
  transform: translateX(-50%);
  font-size: 10px;
  text-align: center;
}

.led-suit-badge {
  position: absolute;
  left: 50%;
  top: 13%;
  z-index: 5;
  padding: 5px 9px;
  color: #2d250f;
  border-radius: 12px;
  background: var(--gold-light);
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.signal-feed {
  position: absolute;
  right: 11%;
  top: 16%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.signal-bubble {
  padding: 5px 8px;
  color: #3b2a0e;
  border-radius: 9px 9px 2px 9px;
  background: var(--gold-light);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
  font-size: 9px;
  animation: pop 0.25s ease-out;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.75);
  }
}

.play-zone {
  min-height: 185px;
  position: relative;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 16px 13px;
  background: linear-gradient(transparent, rgba(4, 18, 14, 0.76) 40%);
}

.player-hand {
  min-height: 126px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-top: 10px;
  perspective: 900px;
}

.player-hand .playing-card {
  margin-left: -16px;
  transition: transform 0.2s, opacity 0.2s, filter 0.2s;
}

.player-hand .playing-card:first-child {
  margin-left: 0;
}

.player-hand .playing-card.playable {
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(242, 213, 141, 0.6), 0 8px 16px rgba(0, 0, 0, 0.36);
  transform: translateY(-5px);
}

.player-hand .playing-card.playable:hover {
  z-index: 10;
  transform: translateY(-20px) scale(1.08);
}

.player-hand .playing-card.illegal {
  opacity: 0.35;
  filter: saturate(0.4);
}

.player-hand .playing-card.waiting {
  opacity: 0.76;
}

.hand-hint {
  height: 18px;
  color: #9fb2aa;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.declaration-bar,
.signal-controls,
.lobby-controls,
.seres-trick-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  padding: 8px 10px 8px 14px;
  border: 1px solid rgba(213, 168, 75, 0.35);
  border-radius: 12px;
  background: rgba(7, 27, 21, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.seres-action-bar {
  flex-wrap: wrap;
  justify-content: center;
}

.seres-action-bar select {
  width: auto;
  min-width: 170px;
  padding: 10px 35px 10px 12px;
}

.seres-trick-bar {
  color: #ffe4df;
  border-color: rgba(220, 88, 69, 0.55);
  background: rgba(76, 18, 14, 0.96);
  animation: pop 0.2s ease-out;
}

.seres-trick-bar span {
  font-size: 11px;
}

.declaration-bar span,
.signal-controls > span {
  display: block;
  color: var(--gold);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.declaration-bar strong {
  display: block;
  max-width: 360px;
  margin-top: 2px;
  font-size: 11px;
}

.declaration-bar .button {
  min-height: 36px;
}

.signal-controls button {
  padding: 7px 10px;
  color: var(--gold-light);
  border: 1px solid rgba(213, 168, 75, 0.28);
  border-radius: 7px;
  background: rgba(213, 168, 75, 0.08);
  cursor: pointer;
  font-size: 10px;
}

.lobby-controls {
  flex-direction: column;
  margin: 0 0 18px;
  padding: 18px 24px;
}

.lobby-controls p {
  margin: 0;
  color: #b8c8c1;
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 11, 9, 0.8);
  backdrop-filter: blur(12px);
}

.rules-modal,
.score-modal,
.auth-modal,
.profile-modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  position: relative;
  overflow: auto;
  padding: clamp(28px, 5vw, 52px);
  color: var(--ink);
  border: 1px solid #d5c9ae;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(213, 168, 75, 0.08), transparent 30%),
    var(--paper);
  box-shadow: var(--shadow);
}

.rules-modal h2,
.score-modal h2,
.auth-modal h2,
.profile-modal h2 {
  color: #18382e;
  font-size: clamp(31px, 5vw, 48px);
}

.auth-modal {
  width: min(450px, 100%);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 25px 0 22px;
  padding: 4px;
  border-radius: 10px;
  background: #e7e7df;
}

.auth-tabs button {
  padding: 9px;
  color: #617069;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-tabs button.active {
  color: #173a2e;
  background: white;
  box-shadow: 0 2px 8px rgba(24, 56, 46, 0.1);
}

.auth-modal form {
  display: grid;
  gap: 16px;
}

.auth-modal .button {
  width: 100%;
  margin-top: 2px;
}

.auth-modal .form-error {
  margin: -4px 0 0;
}

.auth-footnote {
  margin: 8px 0 0;
  color: #77857f;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.profile-modal {
  width: min(900px, 100%);
}

.profile-heading {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-heading h2 {
  font-size: clamp(30px, 5vw, 46px);
}

.profile-heading .eyebrow {
  margin-bottom: 3px;
}

.profile-avatar {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: linear-gradient(135deg, #25775e, #103e31);
  font: 500 25px Georgia, serif;
  box-shadow: 0 8px 20px rgba(16, 62, 49, 0.2);
}

.profile-logout {
  margin-left: auto;
  padding: 7px 10px;
  color: #8b4940;
  border: 1px solid #d8c6c0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.profile-stat {
  padding: 17px;
  border: 1px solid #ddd9ce;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
}

.profile-stat span {
  display: block;
  color: #78857f;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profile-stat strong {
  display: block;
  margin-top: 5px;
  color: #163d30;
  font: 500 28px Georgia, serif;
}

.profile-stat small {
  color: #7c8983;
  font-size: 10px;
}

.profile-section {
  margin-top: 31px;
  padding-top: 25px;
  border-top: 1px solid #dedbd1;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h3 {
  margin: 0;
  color: #193c31;
  font: 500 25px Georgia, serif;
}

.section-heading .eyebrow {
  margin-bottom: 4px;
}

.section-heading > small {
  max-width: 280px;
  color: #7f8b86;
  font-size: 10px;
  text-align: right;
}

.duo-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 15px;
}

.duo-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 13px 15px;
  border: 1px solid #dedbd2;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
}

.duo-item strong {
  color: #27483d;
  font-size: 13px;
}

.duo-item small {
  display: block;
  margin-top: 3px;
  color: #82908a;
  font-size: 9px;
}

.duo-item .duo-mmr {
  color: #9a7125;
  font: 500 23px Georgia, serif;
}

.empty-profile-list {
  margin: 15px 0 0;
  padding: 18px;
  color: #7f8c86;
  border: 1px dashed #d3d4cc;
  border-radius: 10px;
  font-size: 11px;
  text-align: center;
}

.match-history {
  display: grid;
  gap: 8px;
  margin-top: 15px;
}

.history-item {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #dedbd2;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
}

.history-result {
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.history-result.win {
  color: #1e654e;
  background: #dceee6;
}

.history-result.loss {
  color: #91463d;
  background: #f1dfdc;
}

.history-players {
  min-width: 0;
}

.history-players strong {
  display: block;
  overflow: hidden;
  color: #334c43;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-players small,
.history-date {
  color: #84908b;
  font-size: 9px;
}

.history-score {
  color: #234539;
  font: 500 19px Georgia, serif;
  white-space: nowrap;
}

.history-rating {
  min-width: 70px;
  font-size: 10px;
  text-align: right;
}

.rating-up {
  color: #187052;
}

.rating-down {
  color: #a13f35;
}

.rating-summary {
  margin-top: 17px;
  padding: 13px 16px;
  color: #3f514a;
  border: 1px solid #d6c38f;
  border-radius: 10px;
  background: rgba(213, 168, 75, 0.1);
  font-size: 12px;
  text-align: center;
}

.rating-summary strong {
  color: #8d6520;
}

.modal-close {
  width: 36px;
  height: 36px;
  position: absolute;
  right: 18px;
  top: 18px;
  color: #40534b;
  border: 1px solid #cbd0ca;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 35px;
  margin-top: 30px;
}

.rules-grid strong {
  color: #986d25;
  font-family: Georgia, serif;
  font-size: 17px;
}

.rules-grid p {
  margin: 8px 0 0;
  color: #4b5c55;
  font-size: 13px;
  line-height: 1.6;
}

.score-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 28px;
}

.score-breakdown.free-for-all {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.team-breakdown {
  padding: 19px;
  border: 1px solid #d9d9cf;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.68);
}

.team-breakdown.winner {
  border-color: #cba64f;
  box-shadow: inset 0 0 0 2px rgba(213, 168, 75, 0.16);
}

.team-breakdown.loser {
  border-color: #b44d42;
  background: rgba(180, 77, 66, 0.09);
  box-shadow: inset 0 0 0 2px rgba(180, 77, 66, 0.12);
}

.team-breakdown h3 {
  margin: 0 0 15px;
  color: #18382e;
  font-family: Georgia, serif;
  font-size: 18px;
}

.score-line {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 7px 0;
  color: #55655e;
  border-bottom: 1px solid #e5e2d9;
  font-size: 12px;
}

.score-line.total {
  color: #173a2e;
  border-bottom: 0;
  font-weight: 850;
}

.match-total {
  margin-top: 13px;
  padding-top: 12px;
  color: #8b6827;
  border-top: 2px solid #d9c18a;
  font-family: Georgia, serif;
  font-size: 20px;
  text-align: right;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 24px;
}

.waiting-note {
  margin: 10px 0 0;
  color: #66766f;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 120;
  padding: 10px 15px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  background: rgba(13, 32, 26, 0.96);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
  font-size: 12px;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 760px) {
  .lobby-account-area {
    right: 12px;
    top: 10px;
  }

  .lobby-account-area .account-label {
    display: none;
  }

  .lobby-card {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    padding: 35px;
  }

  .brand-mark {
    width: 66px;
    height: 66px;
    margin-bottom: 25px;
  }

  .intro {
    margin-top: 18px;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    padding: 0 10px;
  }

  .mini-brand {
    font-size: 0;
  }

  .mini-brand strong {
    font-size: 17px;
  }

  .room-chip {
    justify-content: center;
  }

  .room-chip > span {
    display: none;
  }

  .top-actions {
    gap: 5px;
  }

  .game-account-button {
    padding-right: 4px;
  }

  .game-account-button .account-label {
    display: none;
  }

  .score-strip {
    min-height: 61px;
    grid-template-columns: 1fr 0.8fr 1fr;
  }

  .team-score {
    gap: 7px;
    padding: 6px 9px;
  }

  .team-score > strong {
    font-size: 28px;
  }

  .team-score span {
    font-size: 11px;
  }

  .team-score small,
  .round-status small {
    display: none;
  }

  .round-status {
    padding: 5px;
  }

  .round-status strong {
    max-width: 130px;
    font-size: 9px;
  }

  .table-stage {
    min-height: 390px;
    padding: 14px 5px 0;
  }

  .card-table {
    width: 94vw;
    height: 380px;
    min-height: 380px;
    border-width: 6px;
    border-radius: 37%;
  }

  .seat {
    min-width: 110px;
  }

  .seat-north {
    top: 4%;
  }

  .seat-east {
    left: 84%;
  }

  .seat-west {
    left: 16%;
  }

  .seat-south {
    top: 96%;
  }

  .seat-card {
    gap: 5px;
    padding: 5px 7px;
  }

  .seat-avatar {
    width: 27px;
    height: 27px;
    font-size: 13px;
  }

  .seat-name {
    font-size: 10px;
  }

  .dealer-dot {
    width: 17px;
    height: 17px;
  }

  .trick-area {
    width: 245px;
    height: 205px;
  }

  .trick-slot,
  .trick-slot .playing-card {
    width: 56px;
    height: 102px;
  }

  .playing-card {
    width: 60px;
    height: 109px;
  }

  .table-message {
    bottom: 11%;
    max-width: 260px;
    font-size: 9px;
  }

  .captured-pile {
    bottom: 19%;
  }

  .pile-a {
    left: 16%;
  }

  .pile-b {
    right: 16%;
  }

  .play-zone {
    min-height: 155px;
    padding-inline: 4px;
  }

  .player-hand {
    width: 100%;
    min-height: 108px;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 10px 8px 3px;
    scrollbar-width: none;
  }

  .player-hand::-webkit-scrollbar {
    display: none;
  }

  .player-hand .playing-card {
    width: 60px;
    height: 109px;
    margin-left: -29px;
  }

  .player-hand .playing-card:first-child {
    margin-left: auto;
  }

  .player-hand .playing-card:last-child {
    margin-right: auto;
  }

  .declaration-bar,
  .signal-controls {
    max-width: calc(100vw - 16px);
  }

  .signal-controls > span {
    display: none;
  }

  .signal-controls {
    gap: 5px;
  }

  .score-breakdown,
  .rules-grid {
    grid-template-columns: 1fr;
  }

  .profile-modal,
  .auth-modal {
    padding: 28px 20px;
  }

  .profile-stats {
    grid-template-columns: 1fr 1fr;
  }

  .profile-stat:first-child {
    grid-column: 1 / -1;
  }

  .duo-list {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }

  .section-heading > small {
    text-align: left;
  }

  .history-item {
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .history-rating {
    grid-column: 2 / -1;
    text-align: left;
  }

  .history-date {
    display: none;
  }
}

@media (max-height: 720px) and (min-width: 761px) {
  .table-stage {
    min-height: 360px;
  }

  .card-table {
    height: 390px;
    min-height: 360px;
  }

  .play-zone {
    min-height: 155px;
  }

  .playing-card {
    width: 64px;
    height: 116px;
  }
}
