:root {
  --bg: #061713;
  --bg-soft: #0a231c;
  --panel: rgba(13, 42, 34, 0.82);
  --panel-solid: #0d2a22;
  --panel-raised: #12382d;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f0e4;
  --muted: #9cb6aa;
  --muted-2: #789389;
  --gold: #e3b968;
  --gold-bright: #f7dca2;
  --gold-deep: #b8873c;
  --mint: #6ddbb1;
  --danger: #ff7e6d;
  --danger-soft: rgba(255, 126, 109, 0.12);
  --red: #cf4338;
  --blue: #3d6fe0;
  --yellow: #dfa41b;
  --black: #303734;
  --radius: 18px;
  --tile-w: 46px;
  --tile-h: 64px;
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.45);
  --font: "Noto Sans KR", "Malgun Gothic", sans-serif;
  --font-display: "Outfit", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(64, 146, 112, 0.22), transparent 55%),
    radial-gradient(900px 600px at 100% 10%, rgba(227, 185, 104, 0.09), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
  z-index: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

.screen.is-active {
  display: block;
  animation: screenIn 0.35s ease both;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-transform: uppercase;
}

.brand-type {
  display: flex;
  flex-direction: column;
  font-size: 1.06rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.brand-type small {
  font-family: var(--font-display);
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-top: 3px;
}

.logo-mark {
  --mark: 38px;
  width: var(--mark);
  height: var(--mark);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: linear-gradient(145deg, #173f33, #0a241d);
  box-shadow:
    0 0 0 1px rgba(227, 185, 104, 0.28),
    0 6px 20px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  flex: 0 0 auto;
}

.logo-mark-lg {
  --mark: 54px;
  gap: 3px;
  padding: 4px;
  border-radius: 12px;
}

.lm {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-family: var(--font-display);
  font-size: calc(var(--mark) * 0.26);
  font-weight: 800;
  background: linear-gradient(155deg, #fffdf5, #ece3cf);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 1px 2px rgba(0, 0, 0, 0.3);
}

.lm-r {
  color: var(--red);
}

.lm-b {
  color: var(--blue);
}

.lm-y {
  color: #b47c00;
}

.lm-k {
  color: var(--black);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 18px;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  color: #1c170b;
  background: linear-gradient(135deg, #f7dda6 0%, #e3b968 48%, #c9964a 100%);
  box-shadow:
    0 8px 24px rgba(227, 185, 104, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.btn-primary:hover {
  box-shadow:
    0 12px 30px rgba(227, 185, 104, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.13);
  color: var(--text);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btn-danger {
  background: #a9453b;
  color: #fff;
}

.btn-sm {
  padding: 8px 13px;
  border-radius: 10px;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  transition: all 0.16s ease;
  flex: 0 0 auto;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

.link-btn {
  border: 0;
  background: none;
  color: var(--gold);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 4px;
}

.link-btn:hover {
  color: var(--gold-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.mini-btn {
  border: 1px solid rgba(227, 185, 104, 0.35);
  background: rgba(227, 185, 104, 0.1);
  color: var(--gold-bright);
  border-radius: 8px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 700;
}

.mini-btn:hover {
  background: rgba(227, 185, 104, 0.18);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 15px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 11px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.field input::placeholder {
  color: #608076;
}

.field input:focus {
  border-color: rgba(227, 185, 104, 0.6);
  background: rgba(0, 0, 0, 0.3);
  outline: none;
}

.password-field {
  position: relative;
  display: block;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 700;
}

.form-error {
  background: var(--danger-soft);
  border: 1px solid rgba(255, 126, 109, 0.3);
  color: #ffb3a8;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.82rem;
  margin: 0 0 12px;
}

.form-hint {
  color: var(--muted-2);
  font-size: 0.76rem;
  text-align: center;
  margin: 12px 0 0;
}

.auth-screen {
  grid-template-columns: minmax(0, 1.12fr) minmax(420px, 0.88fr);
  min-height: 100dvh;
}

.auth-screen.is-active {
  display: grid;
}

.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 6vw, 84px);
  background:
    radial-gradient(760px 520px at 20% 22%, rgba(73, 171, 130, 0.26), transparent 60%),
    radial-gradient(560px 460px at 92% 84%, rgba(227, 185, 104, 0.13), transparent 60%),
    linear-gradient(135deg, #0a261e 0%, #071d17 55%, #05140f 100%);
  overflow: hidden;
  border-right: 1px solid var(--line);
}

.auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at 40% 40%, #000 0%, transparent 68%);
  opacity: 0.5;
}

.auth-brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: clamp(44px, 8vh, 90px);
}

.auth-copy {
  position: relative;
  max-width: 560px;
  z-index: 2;
}

.auth-copy h1 {
  font-size: clamp(2.4rem, 4.2vw, 4.1rem);
  line-height: 1.16;
  letter-spacing: -0.045em;
  margin: 16px 0 18px;
  font-weight: 900;
}

.auth-copy h1 em {
  color: var(--gold);
  font-style: normal;
  background: linear-gradient(100deg, #f8e2ae, #d8a34c);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-copy p {
  color: var(--muted);
  font-size: clamp(0.94rem, 1.2vw, 1.04rem);
  line-height: 1.75;
  max-width: 480px;
  margin: 0;
}

.tile-scene {
  position: absolute;
  right: clamp(-30px, 1vw, 40px);
  top: 50%;
  width: min(45%, 440px);
  height: 420px;
  transform: translateY(-50%);
  pointer-events: none;
}

.scene-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tile-w);
  height: var(--tile-h);
  border-radius: 9px;
  font-family: var(--font-display);
  font-size: calc(var(--tile-h) * 0.4);
  font-weight: 800;
  background: linear-gradient(155deg, #fffdf6 0%, #f2ead7 58%, #e4d8bf 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 0 0 1px rgba(91, 76, 51, 0.22),
    0 8px 20px rgba(0, 0, 0, 0.38);
  position: relative;
  color: var(--tile-color, var(--black));
}

.scene-tile::after {
  content: "";
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: 7%;
  height: 3px;
  border-radius: 2px;
  background: var(--tile-color, var(--black));
  opacity: 0.85;
}

.c-r {
  --tile-color: var(--red);
}

.c-b {
  --tile-color: var(--blue);
}

.c-y {
  --tile-color: #b47c00;
}

.c-k {
  --tile-color: #262c2a;
}

.scene-joker,
.c-joker {
  --tile-color: #d7a84d;
  background: linear-gradient(155deg, #39413d, #1d2422 60%, #141917);
  color: #f0c877;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16) inset,
    0 0 0 1px rgba(227, 185, 104, 0.35),
    0 8px 20px rgba(0, 0, 0, 0.4);
}

.tile-scene .scene-tile {
  position: absolute;
  width: clamp(52px, 5.2vw, 76px);
  height: auto;
  aspect-ratio: 0.72;
  font-size: clamp(1.2rem, 2.1vw, 1.9rem);
  animation: floatTile 7s ease-in-out infinite;
}

.tile-scene .scene-tile:nth-child(1) {
  top: 2%;
  right: 34%;
  transform: rotate(-9deg);
  animation-delay: -0.4s;
}

.tile-scene .scene-tile:nth-child(2) {
  top: 10%;
  right: 8%;
  transform: rotate(7deg);
  animation-delay: -1.7s;
}

.tile-scene .scene-tile:nth-child(3) {
  top: 34%;
  right: 46%;
  transform: rotate(4deg);
  animation-delay: -3s;
}

.tile-scene .scene-tile:nth-child(4) {
  top: 40%;
  right: 14%;
  transform: rotate(-11deg);
  animation-delay: -2.2s;
}

.tile-scene .scene-tile:nth-child(5) {
  top: 67%;
  right: 38%;
  transform: rotate(8deg);
  animation-delay: -4.4s;
}

.tile-scene .scene-tile:nth-child(6) {
  top: 72%;
  right: 4%;
  transform: rotate(-5deg);
  animation-delay: -5.2s;
}

.tile-scene .scene-tile:nth-child(7) {
  top: 53%;
  right: 29%;
  transform: rotate(12deg);
  animation-delay: -6s;
}

@keyframes floatTile {
  0%,
  100% {
    margin-top: 0;
  }
  50% {
    margin-top: -16px;
  }
}

.auth-features {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  list-style: none;
  padding: 0;
  margin: 52px 0 0;
  z-index: 2;
}

.auth-features li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.auth-features span {
  font-family: var(--font-display);
  font-size: 0.62rem;
  color: var(--gold);
  border: 1px solid rgba(227, 185, 104, 0.35);
  padding: 2px 5px;
  border-radius: 4px;
}

.auth-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(600px 400px at 100% 0%, rgba(227, 185, 104, 0.07), transparent 60%),
    rgba(6, 22, 18, 0.6);
}

.auth-card {
  width: min(100%, 400px);
  padding: clamp(24px, 3.4vw, 36px);
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(19, 52, 43, 0.95), rgba(9, 29, 23, 0.98));
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.auth-mobile-brand {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 24px;
}

.auth-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 10px;
  font-weight: 800;
  font-size: 0.9rem;
  transition: all 0.16s ease;
}

.auth-tab.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.auth-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 0.68rem;
  line-height: 1.5;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 68px;
  padding: 0 clamp(16px, 4vw, 44px);
  background: rgba(5, 19, 15, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

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

.brand-button:hover .brand-type {
  color: var(--gold-bright);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-btn {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.88rem;
  transition: all 0.16s ease;
}

.nav-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.is-active {
  color: var(--gold-bright);
  background: rgba(227, 185, 104, 0.1);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.header-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}

.header-user-info span {
  font-weight: 800;
  font-size: 0.85rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user-info small {
  font-size: 0.68rem;
  color: var(--muted);
}

.header-user-info b {
  color: var(--gold);
  font-family: var(--font-display);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #1d5544, #0d2c23);
  border: 1px solid rgba(227, 185, 104, 0.32);
  color: var(--gold-bright);
  font-weight: 900;
  font-size: 0.9rem;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.avatar-sm {
  width: 34px;
  height: 34px;
  font-size: 0.78rem;
}

.lobby-main {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 3.4vw, 34px) 30px;
}

.lobby-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 30px;
  align-items: center;
  padding: clamp(28px, 4.4vw, 52px);
  border-radius: 26px;
  border: 1px solid rgba(227, 185, 104, 0.17);
  background:
    radial-gradient(800px 500px at 8% 0%, rgba(63, 145, 110, 0.24), transparent 60%),
    radial-gradient(500px 380px at 94% 92%, rgba(227, 185, 104, 0.14), transparent 62%),
    linear-gradient(135deg, rgba(17, 49, 40, 0.95), rgba(7, 25, 20, 0.96));
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.lobby-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(115deg, #000 0%, transparent 55%);
  opacity: 0.35;
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero-copy h1 {
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.05em;
  margin: 12px 0 14px;
  font-weight: 900;
}

.hero-copy h1 em {
  font-style: normal;
  color: var(--gold);
  background: linear-gradient(100deg, #f8e2ae, #d7a24a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-copy p {
  color: var(--muted);
  max-width: 580px;
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 24px 0 18px;
}

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  font-size: 0.75rem;
}

.online-pill b {
  color: var(--text);
  font-family: var(--font-display);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(109, 219, 177, 0.5);
  animation: livePulse 2.2s infinite;
}

@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(109, 219, 177, 0.45);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(109, 219, 177, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(109, 219, 177, 0);
  }
}

.hero-art {
  position: relative;
  min-height: 260px;
  z-index: 1;
}

.hero-glow {
  position: absolute;
  inset: 10% 6%;
  background: radial-gradient(circle, rgba(227, 185, 104, 0.18), transparent 65%);
  filter: blur(18px);
}

.hero-set {
  position: absolute;
  display: flex;
  gap: 6px;
  padding: 13px;
  border-radius: 16px;
  background: rgba(4, 16, 12, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
  transform: rotate(-5deg);
  left: 2%;
  top: 24%;
}

.hero-set .scene-tile {
  width: clamp(40px, 4.2vw, 58px);
  height: auto;
  aspect-ratio: 0.72;
  font-size: clamp(1rem, 1.7vw, 1.35rem);
}

.hero-set-2 {
  left: auto;
  right: 0;
  top: 54%;
  transform: rotate(4deg);
}

.hero-chip {
  position: absolute;
  left: 16%;
  bottom: 13%;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(109, 219, 177, 0.12);
  border: 1px solid rgba(109, 219, 177, 0.28);
  color: var(--mint);
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(15, 44, 36, 0.82), rgba(7, 26, 20, 0.88));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head h2 {
  font-size: 1.04rem;
  margin: 0 0 2px;
  letter-spacing: -0.02em;
}

.panel-head p {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.74rem;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 260px;
}

.room-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  transition: all 0.16s ease;
}

.room-card:hover {
  border-color: rgba(227, 185, 104, 0.3);
  background: rgba(227, 185, 104, 0.04);
}

.room-code {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.1em;
  font-size: 0.84rem;
  color: var(--gold-bright);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(227, 185, 104, 0.2);
  border-radius: 7px;
  padding: 5px 8px;
  flex: 0 0 auto;
}

.room-info {
  min-width: 0;
  flex: 1;
}

.room-info b {
  display: block;
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-info small {
  display: block;
  color: var(--muted-2);
  font-size: 0.7rem;
  margin-top: 2px;
}

.room-count {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.room-count span {
  color: var(--muted-2);
  font-family: var(--font);
  font-weight: 500;
  font-size: 0.7rem;
}

.room-join {
  flex: 0 0 auto;
  border: 1px solid rgba(227, 185, 104, 0.36);
  background: rgba(227, 185, 104, 0.1);
  color: var(--gold-bright);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 800;
}

.room-join:hover {
  background: rgba(227, 185, 104, 0.2);
}

.room-empty,
.ranking-empty {
  display: flex;
  min-height: 210px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 5px;
  color: var(--muted-2);
  font-size: 0.82rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 24px;
}

.room-empty strong,
.ranking-empty strong {
  color: var(--text);
  font-size: 0.92rem;
}

.side-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.preview-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  font-size: 0.82rem;
}

.preview-row:last-child {
  border-bottom: 0;
}

.preview-rank {
  width: 24px;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--muted-2);
  text-align: center;
  flex: 0 0 auto;
}

.preview-row:nth-child(1) .preview-rank {
  color: #f1c963;
}

.preview-row:nth-child(2) .preview-rank {
  color: #c8d3cf;
}

.preview-row:nth-child(3) .preview-rank {
  color: #cd8f5e;
}

.preview-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.preview-row.is-me .preview-name {
  color: var(--gold-bright);
}

.preview-points {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold);
  font-size: 0.8rem;
}

.preview-row.is-empty {
  justify-content: center;
  color: var(--muted-2);
  border: 0;
  padding: 22px 0;
}

.howto-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.howto-list li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.howto-list li > span {
  font-family: var(--font-display);
  font-size: 0.62rem;
  color: var(--gold);
  border: 1px solid rgba(227, 185, 104, 0.28);
  border-radius: 5px;
  padding: 2px 5px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.howto-list b {
  display: block;
  font-size: 0.82rem;
}

.howto-list p {
  margin: 2px 0 0;
  color: var(--muted-2);
  font-size: 0.72rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted-2);
  font-size: 0.7rem;
  padding: 26px 4px 0;
}

.ranking-main {
  width: min(1000px, 100%);
  margin: 0 auto;
  padding: 34px clamp(16px, 3.4vw, 34px) 60px;
}

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

.page-heading h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  letter-spacing: -0.05em;
  margin: 6px 0 8px;
}

.page-heading p {
  color: var(--muted);
  max-width: 680px;
  margin: 0;
  font-size: 0.88rem;
}

.ranking-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 18px;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 800;
  transition: all 0.16s ease;
}

.segmented button.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.podium {
  display: grid;
  grid-template-columns: 1fr 1.14fr 1fr;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.podium-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(23, 61, 49, 0.9), rgba(8, 27, 21, 0.92));
  padding: 18px 12px;
  text-align: center;
  overflow: hidden;
}

.podium-card.first {
  border-color: rgba(227, 185, 104, 0.34);
  background:
    radial-gradient(200px 160px at 50% 0%, rgba(227, 185, 104, 0.18), transparent 70%),
    linear-gradient(160deg, rgba(29, 68, 54, 0.95), rgba(9, 29, 22, 0.94));
  padding-top: 26px;
  padding-bottom: 24px;
}

.podium-crown {
  color: var(--gold);
  font-size: 0.62rem;
  font-family: var(--font-display);
  letter-spacing: 0.16em;
  font-weight: 700;
  margin-bottom: 6px;
}

.podium-card .avatar {
  width: 46px;
  height: 46px;
  margin: 0 auto 9px;
  font-size: 1rem;
}

.podium-card.first .avatar {
  width: 56px;
  height: 56px;
  border-color: var(--gold);
  color: #1b160c;
  background: linear-gradient(135deg, #f5d89b, #c99747);
}

.podium-name {
  font-weight: 800;
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-points {
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 800;
  color: var(--gold);
  margin-top: 2px;
}

.podium-meta {
  color: var(--muted-2);
  font-size: 0.68rem;
}

.ranking-table {
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: rgba(8, 27, 21, 0.6);
}

.rank-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 70px 70px 92px;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  font-size: 0.84rem;
}

.rank-row:last-child {
  border-bottom: 0;
}

.rank-row.head {
  color: var(--muted-2);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.025);
  padding-top: 10px;
  padding-bottom: 10px;
}

.rank-row.is-me {
  background: rgba(227, 185, 104, 0.07);
}

.rank-no {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--muted);
}

.rank-row:nth-child(2) .rank-no,
.rank-row:nth-child(3) .rank-no,
.rank-row:nth-child(4) .rank-no {
  color: var(--gold);
}

.rank-user {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.rank-user .avatar {
  width: 29px;
  height: 29px;
  font-size: 0.68rem;
}

.rank-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.rank-stat {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--muted);
  text-align: right;
}

.rank-points {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--gold);
  text-align: right;
}

.my-rank-card {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(227, 185, 104, 0.24);
  background: rgba(227, 185, 104, 0.06);
}

.my-rank-card .avatar {
  width: 38px;
  height: 38px;
}

.my-rank-info {
  flex: 1;
  min-width: 0;
}

.my-rank-info b {
  display: block;
  font-size: 0.9rem;
}

.my-rank-info small {
  color: var(--muted-2);
  font-size: 0.72rem;
}

.my-rank-value {
  text-align: right;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--gold);
  font-size: 1.15rem;
}

.my-rank-value small {
  display: block;
  font-family: var(--font);
  font-size: 0.65rem;
  color: var(--muted-2);
  font-weight: 500;
}

.game-screen {
  background:
    radial-gradient(1000px 600px at 50% -10%, rgba(56, 132, 101, 0.18), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 8px),
    #071a14;
  overflow: hidden;
}

.game-header {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 62px;
  padding: 0 clamp(12px, 2.4vw, 24px);
  background: rgba(4, 16, 12, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.game-room-code {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-2);
  font-size: 0.68rem;
}

.code-copy {
  border: 1px solid rgba(227, 185, 104, 0.22);
  background: rgba(227, 185, 104, 0.08);
  border-radius: 7px;
  padding: 4px 9px;
  color: var(--gold-bright);
}

.code-copy b {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.game-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.turn-pill {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.turn-pill.is-mine {
  background: rgba(227, 185, 104, 0.14);
  border-color: rgba(227, 185, 104, 0.4);
  color: var(--gold-bright);
}

.turn-pill.is-finished {
  background: rgba(109, 219, 177, 0.1);
  border-color: rgba(109, 219, 177, 0.3);
  color: var(--mint);
}

.turn-timer {
  min-width: 46px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  font-variant-numeric: tabular-nums;
}

.turn-timer.is-low {
  color: #ff9d8f;
  border-color: rgba(255, 126, 109, 0.45);
  animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
  50% {
    background: rgba(255, 126, 109, 0.12);
  }
}

.game-header-actions {
  display: flex;
  gap: 6px;
}

.game-main {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(1440px, 100%);
  height: calc(100dvh - 62px);
  margin: 0 auto;
  padding: 10px clamp(10px, 2vw, 18px) 0;
}

.opponents {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  flex: 0 0 auto;
  scrollbar-width: none;
}

.opponents::-webkit-scrollbar {
  display: none;
}

.opponent {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 150px;
  padding: 7px 11px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(15, 43, 35, 0.72);
  transition: all 0.2s ease;
  flex: 0 0 auto;
}

.opponent.is-turn {
  border-color: rgba(227, 185, 104, 0.46);
  background: rgba(227, 185, 104, 0.08);
  box-shadow: 0 0 22px rgba(227, 185, 104, 0.08);
}

.opponent.is-offline {
  opacity: 0.6;
}

.opponent .avatar {
  width: 34px;
  height: 34px;
  font-size: 0.76rem;
}

.opponent-info {
  min-width: 0;
  flex: 1;
}

.opponent-name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opponent-badges {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.badge-bot {
  color: #9fc5ff;
  background: rgba(61, 111, 224, 0.12);
  border-color: rgba(61, 111, 224, 0.28);
}

.badge-meld {
  color: var(--mint);
  background: rgba(109, 219, 177, 0.08);
  border-color: rgba(109, 219, 177, 0.22);
}

.badge-off {
  color: var(--danger);
  background: rgba(255, 126, 109, 0.08);
  border-color: rgba(255, 126, 109, 0.2);
}

.opponent-tiles {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--gold-bright);
}

.opponent-tiles svg {
  width: 14px;
  height: 14px;
  color: var(--muted-2);
}

.opponent-result {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8rem;
}

.opponent-result.win {
  color: var(--gold);
}

.opponent-result.lose {
  color: var(--danger);
}

.board-panel {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(800px 300px at 50% 0%, rgba(227, 185, 104, 0.04), transparent 60%),
    rgba(3, 14, 10, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.board-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.68rem;
  color: var(--muted-2);
}

.pile-info {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.pile-info b {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.8rem;
}

.pile-dot {
  width: 8px;
  height: 11px;
  border-radius: 2px;
  background: linear-gradient(155deg, #fffdf6, #d9cfb9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.selection-hint {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.board {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.board-empty {
  width: 100%;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 5px;
  color: var(--muted-2);
  font-size: 0.8rem;
}

.board-empty b {
  color: var(--muted);
  font-size: 0.9rem;
}

.set-card {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  transition: all 0.16s ease;
  position: relative;
}

.set-card.is-valid {
  border-color: rgba(109, 219, 177, 0.22);
  background: rgba(109, 219, 177, 0.035);
}

.set-card.is-invalid {
  border-color: rgba(255, 126, 109, 0.5);
  background: rgba(255, 126, 109, 0.07);
}

.set-card.is-target {
  cursor: pointer;
}

.set-card.is-target:hover {
  border-color: rgba(227, 185, 104, 0.4);
  background: rgba(227, 185, 104, 0.06);
}

.set-move {
  border: 1px solid rgba(227, 185, 104, 0.35);
  background: rgba(227, 185, 104, 0.12);
  color: var(--gold-bright);
  border-radius: 6px;
  width: 24px;
  align-self: stretch;
  font-size: 0.82rem;
  font-weight: 800;
  flex: 0 0 auto;
}

.set-move:hover {
  background: rgba(227, 185, 104, 0.24);
}

.set-state {
  width: 15px;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-2);
  font-size: 0.62rem;
  flex: 0 0 auto;
  cursor: help;
}

.set-card.is-valid .set-state {
  color: var(--mint);
}

.set-card.is-invalid .set-state {
  color: var(--danger);
}

.set-tiles {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
}

.new-set-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 72px;
  min-height: var(--tile-h);
  padding: 8px 12px;
  border-radius: 11px;
  border: 1px dashed rgba(227, 185, 104, 0.3);
  background: rgba(227, 185, 104, 0.035);
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 700;
  transition: all 0.16s ease;
}

.new-set-slot svg {
  width: 18px;
  height: 18px;
}

.new-set-slot:hover {
  background: rgba(227, 185, 104, 0.09);
  border-color: rgba(227, 185, 104, 0.5);
}

.tile {
  --tile-color: var(--black);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tile-w);
  height: var(--tile-h);
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(155deg, #fffdf6 0%, #f2ead7 58%, #e4d8bf 100%);
  color: var(--tile-color);
  font-family: var(--font-display);
  font-size: calc(var(--tile-h) * 0.42);
  font-weight: 800;
  padding: 0;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 0 0 1px rgba(91, 76, 51, 0.24),
    0 4px 10px rgba(0, 0, 0, 0.3);
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    filter 0.14s ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tile::after {
  content: "";
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: 6%;
  height: 3px;
  border-radius: 2px;
  background: var(--tile-color);
  opacity: 0.85;
}

.tile.c-r {
  --tile-color: var(--red);
}

.tile.c-b {
  --tile-color: var(--blue);
}

.tile.c-y {
  --tile-color: #b47c00;
}

.tile.c-k {
  --tile-color: #262c2a;
}

.tile.c-joker {
  --tile-color: #d7a84d;
  background: linear-gradient(155deg, #39413d, #1d2422 60%, #141917);
  color: #f0c877;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16) inset,
    0 0 0 1px rgba(227, 185, 104, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.34);
}

.tile.c-joker::before {
  content: "JOKER";
  position: absolute;
  bottom: 11%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.42em;
  letter-spacing: 0.08em;
  color: rgba(240, 200, 119, 0.75);
}

.tile.c-joker::after {
  display: none;
}

.tile.is-clickable {
  cursor: pointer;
}

.tile.is-clickable:hover {
  transform: translateY(-3px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 0 0 1px rgba(91, 76, 51, 0.24),
    0 8px 16px rgba(0, 0, 0, 0.38);
}

.tile.c-joker.is-clickable:hover {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16) inset,
    0 0 0 1px rgba(227, 185, 104, 0.5),
    0 8px 16px rgba(0, 0, 0, 0.4);
}

.tile.is-selected {
  transform: translateY(-6px);
  box-shadow:
    0 0 0 2px var(--gold),
    0 0 0 5px rgba(227, 185, 104, 0.18),
    0 10px 20px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.tile.is-locked {
  cursor: default;
}

.hand-panel {
  flex: 0 0 auto;
  padding: 8px 13px calc(9px + env(safe-area-inset-bottom));
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 45, 36, 0.93), rgba(8, 27, 21, 0.97));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.hand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 26px;
}

.hand-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
}

.hand-title b {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 0.86rem;
}

.meld-badge {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--gold-bright);
  background: rgba(227, 185, 104, 0.09);
  border: 1px solid rgba(227, 185, 104, 0.24);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
}

.meld-badge.is-done {
  color: var(--mint);
  background: rgba(109, 219, 177, 0.07);
  border-color: rgba(109, 219, 177, 0.24);
}

.meld-badge.is-warning {
  color: #ffb3a8;
  background: rgba(255, 126, 109, 0.08);
  border-color: rgba(255, 126, 109, 0.26);
}

.hand {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  padding: 7px 2px;
  min-height: calc(var(--tile-h) + 12px);
}

.hand .tile {
  --tile-w: clamp(33px, 5.4vw, 47px);
  --tile-h: calc(var(--tile-w) * 1.4);
}

.board .tile {
  --tile-w: clamp(30px, 4.2vw, 43px);
  --tile-h: calc(var(--tile-w) * 1.4);
  font-size: calc(var(--tile-h) * 0.42);
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
}

.action-hint {
  color: var(--muted-2);
  font-size: 0.7rem;
  line-height: 1.4;
  min-width: 0;
}

.action-buttons {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.action-buttons .btn {
  padding: 8px 15px;
  border-radius: 10px;
  font-size: 0.82rem;
}

.gameover-card {
  max-width: 480px;
  text-align: center;
  overflow: hidden;
  position: relative;
}

.gameover-glow {
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 360px;
  height: 260px;
  background: radial-gradient(circle, rgba(227, 185, 104, 0.26), transparent 65%);
  pointer-events: none;
}

.gameover-card h2 {
  font-size: 1.8rem;
  margin: 8px 0 18px;
  position: relative;
}

.gameover-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 20px;
  text-align: left;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.result-row.is-me {
  border-color: rgba(227, 185, 104, 0.28);
  background: rgba(227, 185, 104, 0.06);
}

.result-place {
  width: 26px;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--muted);
  text-align: center;
}

.result-row:first-child .result-place {
  color: var(--gold);
}

.result-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
}

.result-score.plus {
  color: var(--mint);
}

.result-score.minus {
  color: var(--danger);
}

.gameover-summary {
  font-size: 0.8rem;
  color: var(--muted);
  margin: -6px 0 18px;
}

.gameover-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 10, 8, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(100%, 560px);
  max-height: 90dvh;
  overflow-y: auto;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(500px 300px at 50% 0%, rgba(227, 185, 104, 0.06), transparent 60%),
    linear-gradient(165deg, #11362b, #081f18 75%);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  padding: clamp(22px, 3.6vw, 30px);
  animation: modalIn 0.22s ease both;
}

.modal-card.modal-sm {
  max-width: 430px;
}

.modal-card.modal-xs {
  max-width: 370px;
}

.rules-card {
  max-width: 680px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.modal-card h2 {
  margin: 6px 0 8px;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.modal-sub {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 18px;
  line-height: 1.6;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 18px;
}

.choice-card {
  position: relative;
}

.choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-card span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 13px 8px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  transition: all 0.16s ease;
  cursor: pointer;
}

.choice-card span b {
  font-family: var(--font-display);
  font-size: 1rem;
}

.choice-card span small {
  color: var(--muted-2);
  font-size: 0.66rem;
}

.choice-card input:checked + span {
  border-color: rgba(227, 185, 104, 0.6);
  background: rgba(227, 185, 104, 0.11);
  box-shadow: inset 0 0 0 1px rgba(227, 185, 104, 0.15);
}

.choice-card input:checked + span b {
  color: var(--gold-bright);
}

.waiting-card {
  max-width: 620px;
}

.waiting-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 18px;
  color: var(--muted-2);
  font-size: 0.72rem;
}

.code-copy-lg {
  padding: 5px 12px;
}

.code-copy-lg b {
  font-size: 1.06rem;
}

.seat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.seat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  min-height: 62px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.seat.is-empty {
  border-style: dashed;
  color: var(--muted-2);
  justify-content: center;
  font-size: 0.75rem;
}

.seat.is-host {
  border-color: rgba(227, 185, 104, 0.26);
}

.seat .avatar {
  width: 36px;
  height: 36px;
}

.seat-info {
  min-width: 0;
}

.seat-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-meta {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}

.seat-remove {
  margin-left: auto;
  border: 1px solid rgba(255, 126, 109, 0.24);
  background: rgba(255, 126, 109, 0.07);
  color: #ffb3a8;
  border-radius: 7px;
  padding: 4px 7px;
  font-size: 0.65rem;
}

.waiting-status {
  color: var(--muted-2);
  font-size: 0.76rem;
  text-align: center;
  margin: 16px 0;
}

.waiting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.waiting-actions .btn {
  flex: 1;
  min-width: 120px;
}

.rules-body {
  margin: 10px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.rules-body h3 {
  font-size: 0.92rem;
  margin: 0 0 5px;
  color: var(--gold-bright);
}

.rules-body p,
.rules-body li {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
  margin: 0;
}

.rules-body ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rules-body b {
  color: var(--text);
}

.game-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 50dvh;
  overflow-y: auto;
  padding: 4px 2px;
}

.log-item {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.045);
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.5;
}

.log-time {
  color: var(--muted-2);
  font-family: var(--font-display);
  font-size: 0.66rem;
  flex: 0 0 auto;
  padding-top: 1px;
}

.log-item.type-win,
.log-item.type-meld {
  color: var(--gold-bright);
  background: rgba(227, 185, 104, 0.06);
  border-color: rgba(227, 185, 104, 0.18);
}

.log-item.type-draw {
  color: #a9c8dd;
}

.log-empty {
  text-align: center;
  color: var(--muted-2);
  font-size: 0.78rem;
  padding: 30px 0;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}

.toast-stack {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  width: min(92vw, 440px);
}

.toast {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(14, 44, 35, 0.96);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  animation: toastIn 0.22s ease both;
  text-align: center;
  max-width: 100%;
}

.toast.is-error {
  border-color: rgba(255, 126, 109, 0.4);
  background: rgba(73, 27, 23, 0.97);
  color: #ffc4bb;
}

.toast.is-success {
  border-color: rgba(109, 219, 177, 0.36);
  color: #bcffe6;
}

.toast.is-leaving {
  animation: toastOut 0.2s ease both;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.connection-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  padding: 7px 14px;
  text-align: center;
  background: #7c3b32;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

@media (max-width: 1000px) {
  .auth-screen {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    display: none;
  }

  .auth-panel {
    min-height: 100dvh;
  }

  .auth-mobile-brand {
    display: flex;
  }

  .lobby-hero {
    grid-template-columns: 1.3fr 0.7fr;
  }

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

  .side-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .app-header {
    height: 60px;
    gap: 14px;
    padding: 0 14px;
  }

  .header-user-info {
    display: none;
  }

  .main-nav {
    margin-left: auto;
  }

  .nav-btn {
    padding: 7px 11px;
    font-size: 0.8rem;
  }

  .header-user {
    margin-left: 0;
  }

  .lobby-main {
    padding-top: 16px;
  }

  .lobby-hero {
    grid-template-columns: 1fr;
    padding: 24px 20px;
  }

  .hero-copy h1 {
    font-size: clamp(1.85rem, 9vw, 2.5rem);
  }

  .hero-copy p {
    font-size: 0.85rem;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 20px;
  }

  .hero-actions .btn-primary {
    grid-column: 1 / -1;
  }

  .hero-art {
    display: none;
  }

  .hero-actions .btn {
    padding: 11px 12px;
    font-size: 0.82rem;
  }

  .side-stack {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
    gap: 4px;
    padding-top: 18px;
  }

  .ranking-main {
    padding-top: 22px;
  }

  .rank-row {
    grid-template-columns: 40px minmax(0, 1fr) 54px 70px;
    padding: 11px 12px;
  }

  .rank-row .rank-games {
    display: none;
  }

  .rank-row.head {
    font-size: 0.64rem;
  }

  .podium {
    gap: 6px;
  }

  .podium-card {
    padding: 13px 6px;
  }

  .podium-card.first {
    padding-top: 18px;
    padding-bottom: 16px;
  }

  .podium-card .avatar {
    width: 36px;
    height: 36px;
  }

  .podium-card.first .avatar {
    width: 44px;
    height: 44px;
  }

  .podium-name {
    font-size: 0.72rem;
  }

  .podium-points {
    font-size: 0.88rem;
  }

  .podium-meta {
    font-size: 0.6rem;
  }

  .game-header {
    height: 56px;
    gap: 8px;
    padding: 0 10px;
  }

  .game-header .icon-btn {
    width: 34px;
    height: 34px;
  }

  .game-room-code > span {
    display: none;
  }

  .code-copy {
    padding: 4px 7px;
  }

  .code-copy b {
    font-size: 0.78rem;
  }

  .game-status {
    gap: 5px;
  }

  .turn-pill {
    font-size: 0.66rem;
    padding: 4px 8px;
  }

  .turn-timer {
    min-width: 38px;
    padding: 4px 5px;
    font-size: 0.78rem;
  }

  .game-header-actions {
    gap: 4px;
  }

  .game-header-actions .icon-btn:first-child {
    display: none;
  }

  .game-main {
    height: calc(100dvh - 56px);
    gap: 6px;
    padding: 6px 6px 0;
  }

  .opponents {
    gap: 5px;
  }

  .opponent {
    min-width: 0;
    padding: 5px 8px;
    gap: 6px;
  }

  .opponent .avatar {
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
  }

  .opponent-name {
    font-size: 0.7rem;
  }

  .opponent-tiles {
    font-size: 0.7rem;
  }

  .opponent-badges {
    display: none;
  }

  .board-topline {
    padding: 6px 9px;
    font-size: 0.62rem;
  }

  .board {
    padding: 8px;
    gap: 6px;
  }

  .set-card {
    padding: 5px;
    gap: 2px;
  }

  .set-tiles {
    gap: 2px;
  }

  .set-state {
    width: 10px;
    font-size: 0.5rem;
  }

  .new-set-slot {
    min-width: 58px;
    font-size: 0.6rem;
  }

  .hand-panel {
    padding: 6px 8px calc(7px + env(safe-area-inset-bottom));
  }

  .hand {
    gap: 3px;
    padding: 5px 0;
  }

  .hand .tile {
    --tile-w: clamp(30px, 9vw, 41px);
  }

  .board .tile {
    --tile-w: clamp(27px, 7.6vw, 35px);
  }

  .action-bar {
    display: block;
    padding-top: 6px;
  }

  .action-hint {
    display: none;
  }

  .action-buttons {
    display: grid;
    grid-template-columns: 0.9fr 1fr 1fr;
    gap: 5px;
  }

  .action-buttons .btn {
    padding: 9px 8px;
    font-size: 0.78rem;
  }

  .meld-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
  }

  .hand-title {
    font-size: 0.72rem;
  }

  .mini-btn {
    padding: 2px 7px;
    font-size: 0.66rem;
  }

  .modal {
    padding: 12px;
  }

  .seat-grid {
    grid-template-columns: 1fr;
  }

  .waiting-actions .btn {
    min-width: 0;
    font-size: 0.78rem;
    padding: 9px 10px;
  }

  .gameover-actions {
    grid-template-columns: 1fr;
  }

  .toast-stack {
    top: 68px;
  }

  .auth-panel {
    padding: 16px;
  }

  .auth-card {
    padding: 22px 18px;
  }

  .auth-foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel {
    padding: 16px;
  }

  .room-card {
    gap: 9px;
    padding: 11px 10px;
  }

  .room-info small {
    display: none;
  }

  .room-join {
    padding: 6px 9px;
  }
}

@media (max-width: 420px) {
  .header-user .avatar {
    display: none;
  }

  .hero-actions {
    grid-template-columns: 1fr;
  }

  .hero-actions .btn-primary {
    grid-column: auto;
  }

  .choice-grid {
    gap: 5px;
  }

  .choice-card span {
    padding: 11px 4px;
  }

  .waiting-code-row {
    gap: 6px;
  }
}

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