/* =========================================================
   同频 · SAME WORD
   A small two-player word-matching game.
   ========================================================= */

:root {
  --paper: #f4efe5;
  --paper-deep: #ece5d8;
  --card: #fffdf8;
  --card-soft: #fbf6ed;
  --ink: #211c2f;
  --ink-soft: #322b43;
  --muted: #756d80;
  --muted-light: #948c9f;
  --line: rgba(33, 28, 47, 0.14);
  --line-strong: rgba(33, 28, 47, 0.24);
  --purple: #745de0;
  --purple-deep: #49359a;
  --purple-soft: #e7e0ff;
  --purple-faint: #f2edff;
  --mint: #3f9c7d;
  --mint-deep: #216c56;
  --mint-soft: #d9f0e5;
  --mint-faint: #eef9f4;
  --coral: #e96f50;
  --yellow: #f3d87c;
  --yellow-soft: #fbf1c9;
  --shadow-card: 0 28px 80px rgba(54, 42, 81, 0.13), 0 2px 0 rgba(255, 255, 255, 0.8) inset;
  --shadow-soft: 0 12px 36px rgba(54, 42, 81, 0.09);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", SimSun, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --ease-out: cubic-bezier(0.22, 0.8, 0.26, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(116, 93, 224, 0.45);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--purple-soft);
  color: var(--purple-deep);
}

/* ---------- Backdrop ---------- */

.backdrop {
  position: fixed;
  z-index: -2;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
}

.backdrop::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: -2%;
  background-image: url("/images/background.jpg");
  background-repeat: no-repeat;
  background-position: 56% 25%;
  background-size: cover;
  filter: saturate(0.95) contrast(1.02) brightness(1.01);
  transform: scale(1.015);
}

.backdrop::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(244, 239, 229, 0.97) 0%,
      rgba(244, 239, 229, 0.93) 28%,
      rgba(244, 239, 229, 0.76) 46%,
      rgba(244, 239, 229, 0.44) 64%,
      rgba(244, 239, 229, 0.24) 82%,
      rgba(244, 239, 229, 0.16) 100%
    ),
    linear-gradient(
      180deg,
      rgba(248, 243, 233, 0.68) 0%,
      rgba(248, 243, 233, 0.12) 30%,
      rgba(248, 243, 233, 0.4) 100%
    );
  pointer-events: none;
}

body[data-view="lobby"] .backdrop::after,
body[data-view="game"] .backdrop::after,
body[data-view="result"] .backdrop::after {
  background:
    linear-gradient(180deg, rgba(244, 239, 229, 0.9) 0%, rgba(244, 239, 229, 0.81) 52%, rgba(244, 239, 229, 0.92) 100%),
    radial-gradient(900px 600px at 8% 0%, rgba(233, 224, 255, 0.38), transparent 65%);
}

.backdrop-grid {
  position: absolute;
  z-index: 2;
  inset: 0;
  opacity: 0.24;
  background-image:
    linear-gradient(rgba(33, 28, 47, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 28, 47, 0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 45%, #000 20%, transparent 82%);
}

.backdrop-dots {
  position: absolute;
  z-index: 2;
  inset: 0;
  opacity: 0.24;
  background-image: radial-gradient(rgba(33, 28, 47, 0.14) 0.55px, transparent 0.55px);
  background-size: 4px 4px;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.backdrop-orbit {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(73, 53, 154, 0.11);
  border-radius: 50%;
  pointer-events: none;
}

.orbit-one {
  width: 720px;
  height: 720px;
  right: -300px;
  top: -280px;
}

.orbit-one::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  top: 51%;
  left: 6%;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 0 7px rgba(116, 93, 224, 0.08);
}

.orbit-two {
  width: 420px;
  height: 420px;
  left: -250px;
  bottom: -170px;
  border-style: dashed;
}

/* ---------- Header / footer ---------- */

.site-header {
  position: relative;
  z-index: 5;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 26px clamp(20px, 4vw, 44px) 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  user-select: none;
}

.brand-mark {
  width: 39px;
  height: 39px;
  color: var(--ink);
  flex: none;
}

.brand-type {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
}

.brand-sub {
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  line-height: 1.2;
}

.header-side {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 9px 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.36);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-tag {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--muted-light);
}

.site-footer {
  position: relative;
  z-index: 2;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 22px clamp(20px, 4vw, 44px) 26px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-shadow: 0 1px 12px rgba(244, 239, 229, 0.9);
}

.footer-rule {
  width: 28px;
  height: 1px;
  background: var(--line-strong);
}

body[data-view="game"] .site-footer,
body[data-view="result"] .site-footer {
  display: none;
}

/* ---------- Shared ---------- */

.app {
  position: relative;
  z-index: 2;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.17em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(63, 156, 125, 0.1);
  animation: breathe 2.4s ease-in-out infinite;
}

.eyebrow .rule {
  width: 34px;
  height: 1px;
  margin: 0 2px;
  background: var(--line-strong);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  font-weight: 650;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), background 0.25s ease, color 0.25s ease, border-color 0.25s ease, opacity 0.2s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

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

.btn:disabled {
  cursor: default;
  opacity: 0.5;
}

.btn-primary {
  min-height: 60px;
  padding: 0 15px 0 28px;
  background: var(--ink);
  color: var(--card);
  font-size: 15px;
  letter-spacing: 0.02em;
  box-shadow: 0 14px 30px rgba(33, 28, 47, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: var(--ink-soft);
  box-shadow: 0 18px 36px rgba(33, 28, 47, 0.24);
}

.btn-primary .arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-size: 17px;
  transition: transform 0.3s var(--ease-out);
}

.btn-primary:hover .arrow {
  transform: translateX(3px);
}

.btn-soft {
  background: var(--purple-soft);
  color: var(--purple-deep);
  border-color: transparent;
}

.btn-soft:hover:not(:disabled) {
  background: #ded4ff;
}

.btn-outline {
  background: rgba(255, 253, 248, 0.6);
  border-color: var(--line-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--card);
  border-color: var(--ink);
}

.text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.text-btn:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.form-error {
  min-height: 16px;
  margin-top: 7px;
  color: #b1462d;
  font-size: 11px;
  line-height: 1.5;
}

.view-enter {
  animation: viewIn 0.45s var(--ease-out) both;
}

/* ---------- Boot / loading ---------- */

.boot-screen,
.join-boot {
  min-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.boot-mark {
  width: 54px;
  height: 54px;
  border: 1px solid var(--line-strong);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.join-boot h1 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: -0.05em;
}

.join-boot .boot-code {
  color: var(--purple-deep);
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.2em;
}

.join-boot .boot-hint {
  color: var(--muted-light);
  font-size: 11px;
}

/* ---------- Home ---------- */

.home {
  width: min(1240px, 100%);
  min-height: calc(100vh - 168px);
  margin: 0 auto;
  padding: clamp(22px, 3.5vw, 48px) clamp(20px, 4vw, 44px) clamp(62px, 8vw, 110px);
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(370px, 0.84fr);
  gap: clamp(38px, 6vw, 88px);
  align-items: center;
}

.hero {
  padding-top: 8px;
}

.hero h1 {
  max-width: 680px;
  margin: 24px 0 25px;
  font-size: clamp(48px, 6.15vw, 86px);
  font-weight: 850;
  letter-spacing: -0.068em;
  line-height: 1.04;
}

.hero h1 .accent {
  position: relative;
  z-index: 0;
  display: inline-block;
  color: var(--purple-deep);
}

.hero h1 .accent::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -0.02em;
  bottom: 0.02em;
  left: -0.01em;
  height: 0.19em;
  border-radius: 999px;
  background: var(--yellow);
  opacity: 0.7;
  transform: rotate(-1deg);
}

.hero-lede {
  max-width: 520px;
  margin: 0;
  color: #615a6c;
  font-size: 15px;
  line-height: 1.95;
  letter-spacing: 0.01em;
}

.hero-lede strong {
  color: var(--ink);
  font-weight: 650;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 24px;
  margin-top: 34px;
}

.create-wrap {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.action-caption {
  padding-left: 6px;
  color: var(--muted-light);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.join-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.join-label {
  padding-left: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
}

.join-form {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 54px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.68);
  backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.join-form:focus-within {
  border-color: var(--purple);
  background: var(--card);
  box-shadow: 0 0 0 4px rgba(116, 93, 224, 0.09);
}

.join-form input {
  width: 126px;
  height: 100%;
  padding: 0 8px 0 17px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.join-form input::placeholder {
  color: #a49cac;
  font-weight: 500;
}

.join-form .join-submit {
  height: 42px;
  min-height: 42px;
  padding: 0 16px;
  background: var(--card);
  border-color: var(--line);
  font-size: 12px;
  gap: 5px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 31px;
  color: var(--muted-light);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.hero-meta strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
}

.hero-meta i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

.home-error {
  max-width: 390px;
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid rgba(177, 70, 45, 0.2);
  border-radius: 12px;
  background: rgba(255, 240, 235, 0.8);
  color: #9f3f28;
  font-size: 11px;
  line-height: 1.6;
}

/* ---------- Demo card ---------- */

.demo {
  position: relative;
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
}

.demo::before {
  content: "";
  position: absolute;
  width: 390px;
  height: 390px;
  border-radius: 50%;
  background: rgba(232, 221, 255, 0.56);
  filter: blur(50px);
  transform: translate(26px, 26px);
}

.demo-orbit {
  position: absolute;
  z-index: 0;
  width: 535px;
  height: 535px;
  border: 1px dashed rgba(73, 53, 154, 0.2);
  border-radius: 50%;
  transform: rotate(-14deg);
}

.demo-orbit::before,
.demo-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.demo-orbit::before {
  top: 40px;
  right: 70px;
  width: 8px;
  height: 8px;
  background: var(--coral);
  box-shadow: 0 0 0 6px rgba(233, 111, 80, 0.1);
}

.demo-orbit::after {
  bottom: 55px;
  left: 60px;
  width: 6px;
  height: 6px;
  background: var(--mint);
  box-shadow: 0 0 0 5px rgba(63, 156, 125, 0.1);
}

.demo-card {
  position: relative;
  z-index: 2;
  width: min(100%, 432px);
  padding: 25px 25px 19px;
  border: 1px solid rgba(33, 28, 47, 0.12);
  border-radius: 29px;
  background:
    radial-gradient(circle at 95% 2%, rgba(231, 224, 255, 0.62), transparent 38%),
    linear-gradient(160deg, rgba(255, 253, 248, 0.92) 0%, rgba(251, 247, 238, 0.86) 100%);
  box-shadow: 0 35px 80px rgba(54, 42, 81, 0.16), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  backdrop-filter: blur(16px) saturate(1.08);
  -webkit-backdrop-filter: blur(16px) saturate(1.08);
  transform: rotate(2.2deg);
  transition: transform 0.6s var(--ease-out), box-shadow 0.6s var(--ease-out);
}

.demo:hover .demo-card {
  transform: rotate(0) translateY(-6px);
  box-shadow: 0 42px 90px rgba(54, 42, 81, 0.19), 0 1px 0 #fff inset;
}

.demo-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.18;
  background-image: radial-gradient(rgba(33, 28, 47, 0.13) 0.5px, transparent 0.5px);
  background-size: 4px 4px;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.demo-note {
  position: absolute;
  z-index: 4;
  top: 13px;
  right: 19px;
  padding: 7px 11px;
  border: 1px solid rgba(33, 28, 47, 0.12);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  transform: rotate(3deg);
  box-shadow: 0 5px 16px rgba(54, 42, 81, 0.08);
}

.demo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 92px;
}

.mini-brand {
  color: var(--purple-deep);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.1em;
}

.demo-room {
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.demo-card h2 {
  margin: 17px 0 8px;
  font-size: 31px;
  font-weight: 850;
  letter-spacing: -0.06em;
  line-height: 1.1;
}

.demo-card h2 .dot {
  color: var(--coral);
}

.demo-sub {
  margin: 0 0 19px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.demo-sub b {
  color: var(--ink);
  font-weight: 700;
}

.demo-rounds {
  position: relative;
  z-index: 1;
}

.demo-round {
  margin-bottom: 11px;
  opacity: 0;
  animation: riseIn 0.55s var(--ease-out) forwards;
  animation-delay: calc(0.18s + var(--i) * 0.13s);
}

.demo-round-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  color: var(--muted-light);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.09em;
}

.demo-mark {
  font-size: 9px;
  font-weight: 700;
}

.demo-mark.miss {
  color: var(--muted-light);
}

.demo-mark.hit {
  color: var(--mint-deep);
}

.demo-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.demo-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 9px;
  overflow: hidden;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-chip.you {
  background: var(--purple-soft);
  color: var(--purple-deep);
}

.demo-chip.ta {
  background: var(--mint-soft);
  color: var(--mint-deep);
}

.demo-round.matched .demo-chip {
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(33, 28, 47, 0.04), 0 6px 16px rgba(63, 156, 125, 0.12);
}

.demo-round.matched .demo-chip.you {
  background: #dcd2ff;
}

.demo-round.matched .demo-chip.ta {
  background: #c9ebdc;
}

.demo-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted-light);
  font-size: 9px;
}

.demo-avatars {
  display: flex;
}

.demo-avatar {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: -7px;
  border: 2px solid var(--card);
  border-radius: 50%;
  font-size: 7px;
  font-weight: 700;
}

.demo-avatar.you {
  background: var(--purple);
  color: #fff;
}

.demo-avatar.ta {
  background: var(--mint-soft);
  color: var(--mint-deep);
}

.demo-footer .footer-copy {
  margin-left: 5px;
}

.sticker {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border: 1px solid rgba(33, 28, 47, 0.13);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 20px rgba(54, 42, 81, 0.1);
}

.sticker span {
  font-size: 11px;
}

.sticker-a {
  top: 55px;
  left: -7px;
  background: var(--yellow);
  transform: rotate(-8deg);
}

.sticker-b {
  right: -3px;
  bottom: 40px;
  background: var(--mint-soft);
  color: var(--mint-deep);
  transform: rotate(5deg);
}

/* ---------- Lobby ---------- */

.lobby {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 50px) clamp(20px, 4vw, 44px) 90px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: clamp(30px, 5vw, 62px);
  align-items: center;
}

.lobby-card {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 33px;
  background:
    radial-gradient(circle at 105% -5%, rgba(231, 224, 255, 0.9), transparent 38%),
    radial-gradient(circle at -10% 105%, rgba(217, 240, 229, 0.7), transparent 40%),
    var(--card);
  box-shadow: var(--shadow-card);
}

.lobby-card::before {
  content: "";
  position: absolute;
  top: 30px;
  right: 35px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 7px rgba(233, 111, 80, 0.08);
}

.panel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid rgba(63, 156, 125, 0.18);
  border-radius: 999px;
  background: var(--mint-faint);
  color: var(--mint-deep);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.live-pill i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
  animation: breathe 2s ease-in-out infinite;
}

.lobby-card h1 {
  margin: 22px 0 12px;
  font-size: clamp(34px, 4.2vw, 50px);
  font-weight: 850;
  letter-spacing: -0.06em;
  line-height: 1.12;
}

.lobby-card h1 .muted-word {
  color: var(--muted-light);
}

.lobby-intro {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.85;
}

.room-ticket {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 25px 0 17px;
  padding: 18px 20px;
  border: 1px dashed rgba(73, 53, 154, 0.25);
  border-radius: 22px;
  background:
    linear-gradient(120deg, rgba(242, 237, 255, 0.92), rgba(238, 249, 244, 0.8));
}

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

.ticket-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.room-code-value {
  display: block;
  overflow: hidden;
  color: var(--purple-deep);
  font-family: var(--mono);
  font-size: clamp(29px, 4.3vw, 42px);
  font-weight: 750;
  letter-spacing: 0.19em;
  line-height: 1.1;
  text-overflow: ellipsis;
}

.copy-code-btn {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(73, 53, 154, 0.18);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.78);
  color: var(--purple-deep);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.copy-code-btn:hover {
  background: #fff;
  transform: translateY(-1px);
}

.seats {
  display: flex;
  flex-direction: column;
}

.seat {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 67px;
  padding: 11px 2px;
  border-bottom: 1px dashed var(--line);
}

.seat:last-child {
  border-bottom: 0;
}

.seat-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  flex: none;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 750;
}

.seat-avatar.you {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 0 5px rgba(116, 93, 224, 0.09);
}

.seat-avatar.ta {
  border: 1px dashed rgba(33, 28, 47, 0.28);
  background: rgba(255, 253, 248, 0.75);
  color: var(--muted-light);
}

.seat-avatar.ta.is-present {
  border: 0;
  background: var(--mint-soft);
  color: var(--mint-deep);
  box-shadow: 0 0 0 5px rgba(63, 156, 125, 0.09);
}

.seat-avatar .online-pip {
  position: absolute;
  right: -1px;
  bottom: 0;
  width: 10px;
  height: 10px;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--mint);
}

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

.seat-name {
  margin: 0 0 3px;
  font-size: 13px;
  font-weight: 700;
}

.seat-name small {
  margin-left: 6px;
  color: var(--muted-light);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.seat-status {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.seat-status.waiting {
  color: var(--muted-light);
}

.seat-status.waiting::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 3px;
  margin-left: 5px;
  border-radius: 99px;
  background: currentColor;
  opacity: 0.35;
  animation: typing 1.5s ease-in-out infinite;
  vertical-align: middle;
}

.seat-status.ready {
  color: var(--mint-deep);
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
}

.lobby-actions .btn {
  width: 100%;
}

.lobby-hint {
  margin: 9px 0 0;
  color: var(--muted-light);
  font-size: 9px;
  line-height: 1.7;
  text-align: center;
}

.lobby-leave {
  align-self: center;
  margin-top: 13px;
}

.lobby-aside {
  padding: 8px 0;
}

.aside-kicker {
  margin: 0 0 22px;
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.how-step {
  display: flex;
  gap: 15px;
  padding: 17px 0;
  border-bottom: 1px solid rgba(33, 28, 47, 0.08);
}

.how-step:first-of-type {
  padding-top: 0;
}

.step-number {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--purple-deep);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
}

.how-step h3 {
  margin: 2px 0 5px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.how-step p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.aside-quote {
  position: relative;
  margin-top: 28px;
  padding: 19px 21px 18px;
  border-left: 2px solid var(--purple);
  background: rgba(255, 253, 248, 0.42);
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.8;
}

.aside-quote::before {
  content: "“";
  position: absolute;
  top: -17px;
  left: 8px;
  color: var(--purple);
  font-family: var(--serif);
  font-size: 42px;
  opacity: 0.28;
}

.aside-quote small {
  display: block;
  margin-top: 6px;
  color: var(--muted-light);
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.11em;
  text-align: right;
}

/* ---------- Game ---------- */

.game {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 4px clamp(16px, 3.4vw, 40px) 56px;
}

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 0 2px 15px;
  border-bottom: 1px solid var(--line);
}

.game-room {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.game-room code {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
}

.room-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--mint-deep);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.room-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
  animation: breathe 2.4s ease-in-out infinite;
}

.game-topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.round-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.round-count b {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.leave-game {
  white-space: nowrap;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.17fr) minmax(340px, 0.83fr);
  gap: 22px;
  align-items: start;
}

.board-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 438px;
  overflow: hidden;
  padding: clamp(22px, 3.4vw, 36px);
  border: 1px solid var(--line);
  border-radius: 31px;
  background:
    radial-gradient(circle at 103% 0%, rgba(231, 224, 255, 0.7), transparent 35%),
    linear-gradient(165deg, #fffdf8 0%, #fbf7ee 100%);
  box-shadow: var(--shadow-card);
}

.board-card::after {
  content: "“";
  position: absolute;
  z-index: 0;
  top: -32px;
  right: 19px;
  color: var(--purple);
  font-family: var(--serif);
  font-size: 180px;
  line-height: 1;
  opacity: 0.07;
  pointer-events: none;
}

.board-head {
  position: relative;
  z-index: 1;
}

.board-head h1 {
  margin: 15px 0 11px;
  font-size: clamp(30px, 3.5vw, 43px);
  font-weight: 850;
  letter-spacing: -0.06em;
  line-height: 1.12;
}

.board-head h1 .soft {
  color: var(--muted-light);
}

.board-head p {
  max-width: 490px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.board-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 17px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.board-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.you {
  background: var(--purple);
}

.legend-dot.ta {
  background: var(--mint);
}

.legend-rule {
  width: 1px;
  height: 13px;
  background: var(--line);
}

.rounds {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  max-height: min(46vh, 470px);
  margin-top: 23px;
  padding-right: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(33, 28, 47, 0.18) transparent;
}

.board-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 17px;
  border-top: 1px dashed var(--line);
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.rounds::-webkit-scrollbar {
  width: 5px;
}

.rounds::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(33, 28, 47, 0.14);
}

.round-item {
  margin-bottom: 17px;
}

.round-item:last-child {
  margin-bottom: 0;
}

.round-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.round-label {
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.round-label .current-word {
  margin-left: 6px;
  color: var(--purple);
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
}

.round-result {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.round-result.miss {
  background: rgba(33, 28, 47, 0.06);
  color: var(--muted);
}

.round-result.hit {
  background: var(--mint);
  color: #fff;
}

.round-result.live {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  animation: breathe 2.4s ease-in-out infinite;
}

.round-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
}

.word-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 9px 12px;
  overflow-wrap: anywhere;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  text-align: center;
}

.word-card.you {
  border-color: rgba(73, 53, 154, 0.05);
  background: var(--purple-soft);
  color: var(--purple-deep);
}

.word-card.ta {
  border-color: rgba(33, 108, 86, 0.04);
  background: var(--mint-soft);
  color: var(--mint-deep);
}

.word-card.empty {
  border: 1px dashed rgba(33, 28, 47, 0.18);
  background: rgba(255, 253, 248, 0.35);
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.word-card.empty.is-ready {
  border-color: rgba(63, 156, 125, 0.3);
  background: var(--mint-faint);
  color: var(--mint-deep);
}

.round-item.just-completed .word-card {
  animation: cardFlip 0.6s var(--ease-out) both;
}

.round-item.just-completed .word-card.ta {
  animation-delay: 0.08s;
}

.round-item.just-started {
  animation: riseIn 0.35s var(--ease-out) both;
}

/* Answer card */

.answer-card {
  position: sticky;
  top: 22px;
  overflow: hidden;
  padding: clamp(22px, 2.7vw, 30px);
  border-radius: 30px;
  background:
    radial-gradient(circle at 105% -10%, rgba(116, 93, 224, 0.42), transparent 38%),
    radial-gradient(circle at -10% 110%, rgba(63, 156, 125, 0.21), transparent 38%),
    var(--ink);
  color: var(--card);
  box-shadow: 0 28px 60px rgba(33, 28, 47, 0.26);
}

.answer-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: radial-gradient(rgba(255, 255, 255, 0.5) 0.5px, transparent 0.5px);
  background-size: 4px 4px;
  pointer-events: none;
}

.answer-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.round-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: #d9d0ff;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
}

.round-tag b {
  color: #fff;
  font-size: 10px;
}

.phase-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 253, 248, 0.56);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.phase-tag i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #84d7b8;
  animation: breathe 2s ease-in-out infinite;
}

.answer-card h2 {
  position: relative;
  z-index: 1;
  margin: 21px 0 9px;
  font-size: clamp(26px, 2.9vw, 33px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.18;
}

.answer-copy {
  position: relative;
  z-index: 1;
  margin: 0 0 19px;
  color: rgba(255, 253, 248, 0.54);
  font-size: 11px;
  line-height: 1.75;
}

.guess-form {
  position: relative;
  z-index: 1;
}

.word-field {
  position: relative;
  padding: 2px 13px 18px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 17px;
  background: var(--card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.word-field:focus-within {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(231, 224, 255, 0.12);
}

.word-field input {
  width: 100%;
  height: 59px;
  padding: 0 2px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.word-field input::placeholder {
  color: #a69eac;
  font-size: 18px;
  font-weight: 500;
}

.char-count {
  position: absolute;
  right: 12px;
  bottom: 7px;
  color: #9a919f;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.char-count.is-full {
  color: var(--coral);
}

.answer-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 52px;
  margin-top: 10px;
  padding: 0 8px 0 18px;
  border: 0;
  border-radius: 15px;
  background: var(--purple-soft);
  color: var(--purple-deep);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.answer-submit:hover:not(:disabled) {
  background: #fff;
  transform: translateY(-1px);
}

.answer-submit:disabled {
  cursor: default;
  opacity: 0.4;
}

.answer-submit kbd {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(73, 53, 154, 0.15);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}

.locked-answer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 126px;
  padding: 18px 19px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.045));
}

.locked-label {
  margin-bottom: 5px;
  color: rgba(255, 253, 248, 0.47);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.locked-word {
  overflow-wrap: anywhere;
  color: #eee8ff;
  font-family: var(--serif);
  font-size: clamp(28px, 3.3vw, 36px);
  font-weight: 700;
  line-height: 1.25;
}

.locked-hint {
  margin: 5px 0 0;
  color: rgba(255, 253, 248, 0.45);
  font-size: 10px;
  line-height: 1.6;
}

.answer-status {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 19px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 253, 248, 0.53);
  font-size: 9px;
}

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

.presence i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #84d7b8;
  box-shadow: 0 0 0 3px rgba(132, 215, 184, 0.08);
}

.presence.offline {
  color: rgba(255, 177, 159, 0.8);
}

.presence.offline i {
  background: #ee8e78;
  box-shadow: 0 0 0 3px rgba(238, 142, 120, 0.08);
}

.partner-progress {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.answer-foot {
  position: relative;
  z-index: 1;
  margin: 15px 0 0;
  color: rgba(255, 253, 248, 0.25);
  font-size: 8px;
  letter-spacing: 0.03em;
  line-height: 1.6;
}

.answer-card.is-revealing .phase-tag i {
  background: var(--yellow);
}

.answer-card.is-revealing .locked-word {
  color: var(--yellow);
}

/* ---------- Result ---------- */

.result {
  width: min(780px, 100%);
  margin: 0 auto;
  padding: 8px clamp(16px, 3.4vw, 30px) 85px;
}

.result-card {
  position: relative;
  overflow: hidden;
  padding: clamp(23px, 4.2vw, 42px);
  border: 1px solid var(--line);
  border-radius: 35px;
  background:
    radial-gradient(circle at 100% 0%, rgba(231, 224, 255, 0.9), transparent 37%),
    radial-gradient(circle at 0% 100%, rgba(217, 240, 229, 0.7), transparent 37%),
    var(--card);
  box-shadow: var(--shadow-card);
}

.result-card::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image: radial-gradient(rgba(33, 28, 47, 0.18) 0.5px, transparent 0.5px);
  background-size: 4px 4px;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.result-topline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.result-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--purple-deep);
  font-weight: 750;
  letter-spacing: 0.08em;
}

.result-brand .brand-dot {
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 50%;
  box-shadow: 7px 0 0 -1px var(--card), 7px 0 0 0 currentColor;
  margin-right: 6px;
}

.result-room {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
}

.result-main {
  position: relative;
  z-index: 1;
  padding-top: 20px;
}

.result-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--mint-deep);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-kicker i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 5px rgba(63, 156, 125, 0.09);
}

.result-main h1 {
  margin: 12px 0 10px;
  font-size: clamp(41px, 6.6vw, 58px);
  font-weight: 850;
  letter-spacing: -0.065em;
  line-height: 1.05;
}

.result-main h1:focus {
  outline: none;
}

.result-main h1 .soft {
  color: var(--muted-light);
}

.result-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.result-summary b {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
}

.match-word-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 126px;
  margin: 18px 0 20px;
}

.match-orbit {
  position: absolute;
  width: 230px;
  height: 130px;
  border: 1px dashed rgba(73, 53, 154, 0.22);
  border-radius: 50%;
  transform: rotate(-7deg);
}

.match-orbit::before,
.match-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.match-orbit::before {
  top: 3px;
  right: 30px;
  width: 6px;
  height: 6px;
  background: var(--coral);
}

.match-orbit::after {
  bottom: 8px;
  left: 35px;
  width: 5px;
  height: 5px;
  background: var(--mint);
}

.match-word {
  position: relative;
  z-index: 1;
  max-width: 100%;
  padding: 4px 10px;
  overflow-wrap: anywhere;
  color: var(--purple-deep);
  font-family: var(--serif);
  font-size: clamp(48px, 9vw, 72px);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.05;
  text-align: center;
}

.match-word::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 29%;
  right: 3%;
  bottom: 10%;
  left: 3%;
  border-radius: 999px;
  background: var(--yellow);
  opacity: 0.46;
  transform: rotate(-1.5deg);
}

.match-bracket {
  color: var(--purple);
  font-size: 0.48em;
  opacity: 0.6;
  vertical-align: 0.12em;
}

.result-divider {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 3px 0 12px;
  color: var(--muted-light);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.result-rounds {
  position: relative;
  z-index: 1;
  max-height: 302px;
  padding-right: 5px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(33, 28, 47, 0.18) transparent;
}

.result-rounds .round-item {
  margin-bottom: 11px;
}

.result-rounds .round-pair {
  gap: 7px;
}

.result-rounds .word-card {
  min-height: 39px;
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 12px;
}

.result-rounds .round-label {
  font-size: 7px;
}

.result-rounds .round-top {
  margin-bottom: 4px;
}

.result-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 19px;
}

.result-actions .btn {
  min-height: 51px;
  border-radius: 14px;
}

.result-actions .btn-primary {
  background: var(--ink);
  box-shadow: none;
  font-size: 13px;
}

.result-actions .btn-outline {
  font-size: 12px;
}

.rematch-note {
  position: relative;
  z-index: 1;
  min-height: 17px;
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.7;
  text-align: center;
}

.result-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.result-stamp {
  position: absolute;
  z-index: 2;
  top: 86px;
  right: 28px;
  display: grid;
  place-items: center;
  width: 75px;
  height: 75px;
  border: 1px solid rgba(73, 53, 154, 0.25);
  border-radius: 50%;
  color: var(--purple-deep);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-align: center;
  transform: rotate(9deg);
  opacity: 0.65;
}

.result-stamp b {
  display: block;
  font-size: 15px;
  line-height: 1.1;
}

.result-stamp::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(73, 53, 154, 0.3);
  border-radius: 50%;
}

.result-aside {
  margin: 20px auto 0;
  color: var(--muted-light);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.8;
  text-align: center;
}

/* ---------- Toast / confetti ---------- */

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: min(90vw, 440px);
  padding: 11px 17px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(33, 28, 47, 0.94);
  color: var(--card);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
  box-shadow: 0 12px 34px rgba(33, 28, 47, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s ease, transform 0.25s var(--ease-out);
  backdrop-filter: blur(10px);
}

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

.toast.is-error {
  background: #813a28;
}

.confetti {
  position: fixed;
  z-index: 40;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  left: var(--x);
  width: var(--w);
  height: var(--h);
  border-radius: var(--radius);
  background: var(--color);
  opacity: 0;
  transform: translate3d(0, -10vh, 0) rotate(var(--rotate));
  animation: confettiFall var(--duration) var(--delay) cubic-bezier(0.18, 0.65, 0.36, 1) forwards;
}

/* ---------- Animations ---------- */

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

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

@keyframes cardFlip {
  from {
    opacity: 0;
    transform: rotateX(72deg) translateY(4px);
    transform-origin: center bottom;
  }
  to {
    opacity: 1;
    transform: rotateX(0) translateY(0);
    transform-origin: center bottom;
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes typing {
  0%,
  100% {
    transform: scaleX(0.45);
    opacity: 0.25;
  }
  50% {
    transform: scaleX(1);
    opacity: 0.55;
  }
}

@keyframes confettiFall {
  0% {
    opacity: 0;
    transform: translate3d(0, -10vh, 0) rotate(var(--rotate));
  }
  8% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift), 108vh, 0) rotate(calc(var(--rotate) + 560deg));
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .home {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.82fr);
    gap: 34px;
  }

  .hero h1 {
    font-size: clamp(46px, 5.7vw, 72px);
  }

  .demo {
    min-height: 530px;
  }

  .demo-orbit {
    width: 490px;
    height: 490px;
  }

  .lobby {
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 34px;
  }
}

@media (max-width: 900px) {
  .home {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-top: 26px;
    gap: 38px;
  }

  .hero {
    padding-top: 0;
  }

  .hero h1 {
    max-width: 710px;
    font-size: clamp(48px, 9vw, 76px);
  }

  .hero-lede {
    max-width: 570px;
  }

  .demo {
    width: min(100%, 470px);
    min-height: 0;
    margin: 0 auto;
    padding: 22px 0 28px;
  }

  .demo-card {
    transform: rotate(1.4deg);
  }

  .demo-orbit {
    width: 520px;
    height: 520px;
    max-width: 108vw;
    max-height: 108vw;
  }

  .lobby {
    grid-template-columns: 1fr;
    max-width: 700px;
    gap: 33px;
    padding-top: 14px;
  }

  .lobby-aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 30px;
  }

  .aside-kicker {
    grid-column: 1 / -1;
    margin-bottom: 5px;
  }

  .how-step {
    padding: 14px 0;
  }

  .aside-quote {
    grid-column: 1 / -1;
    margin-top: 20px;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .answer-card {
    position: relative;
    top: auto;
    order: -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr);
    column-gap: 24px;
    align-items: center;
    padding: 20px 22px;
  }

  .answer-top {
    grid-column: 1 / -1;
  }

  .answer-card h2 {
    grid-column: 1;
    margin: 12px 0 6px;
    font-size: 27px;
  }

  .answer-copy {
    grid-column: 1;
    margin: 0;
    font-size: 10px;
  }

  .guess-form,
  .locked-answer {
    grid-column: 2;
    grid-row: 2 / span 3;
    align-self: center;
  }

  .guess-form {
    margin-top: 10px;
  }

  .locked-answer {
    margin-top: 10px;
    min-height: 114px;
  }

  .answer-status {
    grid-column: 1 / -1;
    margin-top: 14px;
    padding-top: 11px;
  }

  .answer-foot {
    display: none;
  }

  .word-field input {
    height: 51px;
    font-size: 20px;
  }

  .answer-submit {
    height: 45px;
  }

  .rounds {
    max-height: 380px;
  }
}

@media (max-width: 700px) {
  .backdrop::before {
    background-position: 58% 17%;
    filter: saturate(1) contrast(1.03) brightness(1.02);
  }

  .backdrop::after {
    background:
      linear-gradient(
        180deg,
        rgba(244, 239, 229, 0.84) 0%,
        rgba(244, 239, 229, 0.75) 38%,
        rgba(244, 239, 229, 0.84) 72%,
        rgba(244, 239, 229, 0.93) 100%
      ),
      linear-gradient(90deg, rgba(244, 239, 229, 0.45) 0%, rgba(244, 239, 229, 0.18) 52%, transparent 100%);
  }

  body[data-view="lobby"] .backdrop::after,
  body[data-view="game"] .backdrop::after,
  body[data-view="result"] .backdrop::after {
    background:
      linear-gradient(180deg, rgba(244, 239, 229, 0.93) 0%, rgba(244, 239, 229, 0.88) 55%, rgba(244, 239, 229, 0.95) 100%);
  }

  .site-header {
    padding-top: 18px;
    padding-bottom: 12px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-name {
    font-size: 19px;
  }

  .header-note {
    display: none;
  }

  .header-tag {
    font-size: 8px;
    padding: 5px 8px;
  }

  .site-footer {
    padding-bottom: 20px;
    font-size: 8px;
    gap: 9px;
    flex-wrap: wrap;
  }

  .home {
    padding-top: 19px;
    padding-bottom: 62px;
  }

  .hero h1 {
    margin-top: 19px;
    margin-bottom: 20px;
    font-size: clamp(43px, 12.2vw, 62px);
    line-height: 1.06;
  }

  .hero-lede {
    font-size: 13px;
    line-height: 1.85;
  }

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

  .create-wrap .btn-primary {
    width: 100%;
    justify-content: space-between;
  }

  .join-block {
    width: 100%;
  }

  .join-form {
    width: 100%;
  }

  .join-form input {
    width: auto;
    flex: 1;
    min-width: 0;
  }

  .join-form .join-submit {
    min-width: 83px;
  }

  .action-caption {
    display: none;
  }

  .hero-meta {
    margin-top: 22px;
    font-size: 9px;
  }

  .demo {
    width: 100%;
    padding: 16px 0 25px;
  }

  .demo-card {
    width: calc(100% - 10px);
    padding: 22px 19px 16px;
    border-radius: 25px;
    transform: rotate(0.9deg);
  }

  .demo-head {
    padding-right: 76px;
  }

  .demo-card h2 {
    font-size: 27px;
  }

  .demo-note {
    top: 8px;
    right: 10px;
    padding: 6px 8px;
    font-size: 7px;
  }

  .demo-room {
    display: none;
  }

  .demo-chip {
    min-height: 33px;
    font-size: 11px;
  }

  .demo-round {
    margin-bottom: 9px;
  }

  .sticker {
    display: none;
  }

  .demo-orbit {
    width: 112vw;
    height: 112vw;
    max-width: none;
    max-height: none;
  }

  .lobby {
    padding-top: 8px;
    padding-bottom: 62px;
  }

  .lobby-card {
    padding: 22px 19px 24px;
    border-radius: 27px;
  }

  .lobby-card h1 {
    font-size: clamp(31px, 9.3vw, 41px);
  }

  .lobby-intro {
    font-size: 12px;
  }

  .room-ticket {
    gap: 11px;
    padding: 15px 15px;
    margin-top: 20px;
  }

  .room-code-value {
    font-size: clamp(27px, 8.5vw, 36px);
  }

  .copy-code-btn {
    min-height: 37px;
    padding: 0 11px;
    font-size: 10px;
  }

  .seat-avatar {
    width: 39px;
    height: 39px;
  }

  .lobby-aside {
    display: block;
    padding: 0 3px;
  }

  .aside-kicker {
    margin-bottom: 10px;
  }

  .aside-quote {
    font-size: 15px;
  }

  .game {
    padding-top: 0;
    padding-bottom: 35px;
  }

  .game-topbar {
    margin-bottom: 12px;
    padding-bottom: 11px;
  }

  .room-status {
    display: none;
  }

  .leave-game {
    font-size: 10px;
  }

  .answer-card {
    display: block;
    padding: 18px 17px;
    border-radius: 25px;
  }

  .answer-card h2 {
    margin: 13px 0 6px;
    font-size: 24px;
  }

  .answer-copy {
    display: none;
  }

  .guess-form {
    margin-top: 13px;
  }

  .locked-answer {
    margin-top: 13px;
    min-height: 105px;
  }

  .answer-status {
    margin-top: 12px;
    padding-top: 10px;
  }

  .answer-top .round-tag {
    padding: 6px 8px;
  }

  .board-card {
    padding: 21px 17px 24px;
    border-radius: 26px;
  }

  .board-head h1 {
    margin-top: 12px;
    font-size: clamp(29px, 8.2vw, 36px);
  }

  .board-head p {
    font-size: 11px;
  }

  .board-legend {
    margin-top: 14px;
    gap: 12px;
  }

  .rounds {
    max-height: none;
    margin-top: 19px;
    overflow: visible;
    padding-right: 0;
  }

  .word-card {
    min-height: 47px;
    padding: 8px 9px;
    font-size: 13px;
  }

  .round-item {
    margin-bottom: 15px;
  }

  .result {
    padding-top: 0;
    padding-bottom: 50px;
  }

  .result-card {
    padding: 20px 17px 23px;
    border-radius: 27px;
  }

  .result-main {
    padding-top: 17px;
  }

  .result-main h1 {
    font-size: clamp(38px, 11.5vw, 49px);
  }

  .match-word-wrap {
    min-height: 106px;
    margin: 16px 0 16px;
  }

  .match-orbit {
    width: 200px;
    height: 110px;
  }

  .match-word {
    font-size: clamp(42px, 13vw, 60px);
  }

  .result-stamp {
    display: none;
  }

  .result-rounds {
    max-height: 270px;
  }

  .result-actions {
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 15px;
  }

  .result-actions .btn-primary {
    order: -1;
  }

  .result-aside {
    padding: 0 16px;
    font-size: 11px;
  }

  .toast {
    bottom: max(14px, env(safe-area-inset-bottom));
    font-size: 10px;
  }
}

@media (max-width: 380px) {
  .hero h1 {
    font-size: 40px;
  }

  .join-form input {
    font-size: 14px;
    letter-spacing: 0.12em;
  }

  .join-form .join-submit {
    min-width: 75px;
    padding: 0 11px;
  }

  .room-code-value {
    font-size: 25px;
    letter-spacing: 0.13em;
  }

  .copy-code-btn {
    padding: 0 9px;
  }

  .board-head h1 {
    font-size: 27px;
  }
}

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

  .demo-round {
    opacity: 1;
  }
}
