:root {
  color-scheme: light;
  --paper: #f5f0e6;
  --paper-deep: #ebe3d5;
  --surface: #fffdf8;
  --ink: #171713;
  --muted: #68645b;
  --line: #d8d0c2;
  --red: #e3472f;
  --red-dark: #b92f20;
  --red-soft: #f9ded6;
  --yellow: #efbc42;
  --green: #287b63;
  --green-soft: #dceee7;
  --shadow: 0 20px 50px rgba(44, 34, 22, 0.09);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --content: 1180px;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(38, 32, 24, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(38, 32, 24, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button,
input,
textarea {
  font: inherit;
}

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

button {
  color: inherit;
}

button:not(:disabled),
summary {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(227, 71, 47, 0.34);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.page-glow {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.page-glow--one {
  top: -240px;
  right: -120px;
  background: rgba(239, 188, 66, 0.24);
}

.page-glow--two {
  bottom: -300px;
  left: -170px;
  background: rgba(227, 71, 47, 0.09);
}

.topbar {
  width: min(calc(100% - 40px), var(--content));
  min-height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(23, 23, 19, 0.12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  background: var(--red);
  border: 2px solid var(--ink);
  border-radius: 50% 44% 50% 42%;
  box-shadow: 3px 3px 0 var(--ink);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 23px;
  font-weight: 800;
  transform: rotate(-5deg);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.brand-tagline {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.pre-badge {
  align-self: flex-start;
  margin-top: -4px;
  padding: 3px 6px;
  color: #fff;
  background: var(--ink);
  border-radius: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-status,
.name-button,
.secondary-button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot,
.online-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #9c978e;
}

.connection-status.is-online .status-dot,
.online-dot {
  background: #2a9a72;
  box-shadow: 0 0 0 4px rgba(42, 154, 114, 0.12);
}

.connection-status.is-connecting .status-dot {
  background: var(--yellow);
  animation: blink 1s ease-in-out infinite;
}

.name-button {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  width: min(calc(100% - 40px), var(--content));
  margin: 0 auto;
}

.welcome-card {
  min-height: calc(100vh - 170px);
  padding: 74px 0 90px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
  align-items: center;
  gap: clamp(48px, 9vw, 120px);
}

.overline,
.section-kicker,
.prompt-eyebrow {
  margin: 0 0 12px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.welcome-copy h1 {
  max-width: 700px;
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(48px, 7.2vw, 88px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.welcome-copy h1 em {
  position: relative;
  color: var(--red);
  font-style: normal;
  white-space: nowrap;
}

.welcome-copy h1 em::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -4px;
  left: 0;
  height: 8px;
  border-bottom: 3px solid var(--red);
  border-radius: 50%;
  transform: rotate(-1deg);
}

.welcome-lead {
  max-width: 560px;
  margin: 32px 0 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.9;
}

.welcome-points {
  margin: 36px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  list-style: none;
}

.welcome-points li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
}

.welcome-points span {
  color: var(--red);
  font-family: Georgia, serif;
  font-size: 13px;
}

.join-card {
  position: relative;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--surface);
  border: 1px solid rgba(23, 23, 19, 0.12);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow), 8px 8px 0 rgba(23, 23, 19, 0.06);
}

.join-card::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 38px;
  width: 72px;
  height: 17px;
  background: rgba(239, 188, 66, 0.7);
  transform: rotate(-3deg);
}

.join-card-head,
.field-meta,
.section-heading-row,
.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.live-mark {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.live-mark span {
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--red-soft);
}

.seat-copy,
.fine-print,
.field-meta,
.history-note {
  color: var(--muted);
  font-size: 11px;
}

.join-card h2,
.phase-panel h2,
.side-card h2,
.history-section h2,
.name-dialog h2 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 25px;
  line-height: 1.35;
}

.join-card > div > p:not(.section-kicker) {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

label {
  display: block;
  margin-bottom: -10px;
  font-size: 12px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input {
  min-height: 52px;
  padding: 0 15px;
}

textarea {
  min-height: 124px;
  padding: 15px;
  resize: vertical;
  line-height: 1.7;
}

input:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(227, 71, 47, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: #a19b91;
}

.primary-button {
  min-height: 50px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: #fff;
  background: var(--red);
  border: 1px solid var(--red-dark);
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--red-dark);
  font-weight: 800;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.primary-button:hover:not(:disabled) {
  background: #ed5138;
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--red-dark);
}

.primary-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--red-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.wide-button {
  width: 100%;
  margin-top: 18px;
}

.form-error {
  margin: -8px 0 0;
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 700;
}

.fine-print {
  margin: -4px 0 0;
  text-align: center;
  line-height: 1.5;
}

.app-shell {
  padding: 34px 0 80px;
}

.room-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 4vw, 48px);
  color: #fffdf8;
  background: var(--ink);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.room-hero::after {
  content: "笑";
  position: absolute;
  right: -12px;
  bottom: -80px;
  color: rgba(255, 255, 255, 0.035);
  font-family: "Yu Mincho", serif;
  font-size: 250px;
  font-weight: 900;
  line-height: 1;
  transform: rotate(-8deg);
  pointer-events: none;
}

.room-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.round-label,
.phase-label {
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.round-label {
  color: var(--ink);
  background: var(--paper);
}

.phase-label {
  color: #fff;
  background: var(--red);
}

.prompt-block {
  position: relative;
  z-index: 1;
  margin-top: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 44px;
}

.prompt-eyebrow {
  color: #efc65c;
}

.prompt-copy h1 {
  max-width: 820px;
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(27px, 4.2vw, 48px);
  line-height: 1.45;
  letter-spacing: 0.01em;
}

.phase-notice {
  margin: 18px 0 0;
  color: rgba(255, 253, 248, 0.68);
  font-size: 13px;
  line-height: 1.7;
}

.timer-card {
  width: 148px;
  min-height: 126px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
}

.timer-card.is-urgent {
  color: #fff;
  background: rgba(227, 71, 47, 0.24);
  border-color: rgba(227, 71, 47, 0.58);
  animation: timerPulse 1s ease-in-out infinite;
}

.timer-label,
.timer-caption {
  color: rgba(255, 255, 255, 0.55);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.timer-card strong {
  margin: 8px 0 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.room-stats {
  position: relative;
  z-index: 1;
  margin-top: 36px;
  padding-top: 20px;
  display: flex;
  align-items: center;
  gap: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.room-stats > div:not(.lead-badge) {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.stat-value {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
}

.stat-label {
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  font-weight: 800;
}

.lead-badge {
  margin-left: auto;
  padding: 7px 10px;
  color: #35290b;
  background: var(--yellow);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 900;
}

.room-layout {
  margin-top: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 24px;
}

.main-column,
.side-column {
  min-width: 0;
}

.main-column,
.side-column {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.answer-panel,
.voting-panel,
.results-panel,
.waiting-panel {
  order: 1;
}

.topic-panel {
  order: 2;
}

.history-section {
  order: 3;
}

.phase-panel,
.history-section,
.side-card {
  background: var(--surface);
  border: 1px solid rgba(23, 23, 19, 0.11);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(44, 34, 22, 0.05);
}

.phase-panel,
.history-section {
  padding: clamp(22px, 4vw, 36px);
}

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

.panel-number {
  color: var(--paper-deep);
  font-family: Georgia, serif;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

.permission-note,
.panel-intro {
  margin: -8px 0 24px;
  padding: 12px 14px;
  color: #5a4a21;
  background: #fff4cf;
  border-left: 3px solid var(--yellow);
  border-radius: 0 9px 9px 0;
  font-size: 12px;
  line-height: 1.7;
}

.phase-panel form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.field-meta {
  margin-top: -6px;
  align-items: flex-start;
  line-height: 1.5;
}

.answer-receipt {
  margin-top: 22px;
  padding: 16px;
  display: flex;
  gap: 12px;
  background: var(--green-soft);
  border: 1px solid rgba(40, 123, 99, 0.2);
  border-radius: 13px;
}

.check-mark {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: var(--green);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 900;
}

.answer-receipt strong {
  color: var(--green);
  font-size: 12px;
}

.answer-receipt p {
  margin: 5px 0 0;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.vote-budget {
  padding: 9px 12px;
  color: var(--red-dark);
  background: var(--red-soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.vote-budget strong {
  margin-right: 3px;
  font-family: Georgia, serif;
  font-size: 20px;
}

.vote-list,
.results-list,
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vote-item {
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 130ms ease, background 130ms ease;
}

.vote-item.has-vote {
  background: #fff9ed;
  border-color: var(--yellow);
}

.vote-answer-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.vote-answer-label .own-label {
  margin-left: 7px;
  padding: 2px 5px;
  color: #fff;
  background: var(--ink);
  border-radius: 4px;
  letter-spacing: 0;
}

.vote-answer-text {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.vote-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vote-stepper button {
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 18px;
  font-weight: 800;
}

.vote-stepper button:hover:not(:disabled) {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.vote-stepper button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.vote-stepper output {
  min-width: 24px;
  text-align: center;
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 800;
}

.winner-callout {
  margin: -8px 0 20px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 13px;
  background: #fff4cf;
  border: 1px solid rgba(239, 188, 66, 0.5);
  border-radius: 14px;
}

.winner-callout p {
  margin: 0;
  font-size: 13px;
}

.winner-callout strong {
  font-size: 17px;
}

.crown {
  padding: 7px 9px;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 900;
}

.result-item {
  padding: 17px 18px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.result-item.is-winner {
  background: #fff9e9;
  border-color: var(--yellow);
  box-shadow: inset 4px 0 0 var(--yellow);
}

.result-rank {
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 800;
}

.result-item.is-winner .result-rank {
  color: var(--red);
}

.result-answer {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.result-author {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.result-score {
  min-width: 58px;
  text-align: right;
  color: var(--red);
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 800;
}

.result-score small {
  margin-left: 2px;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
}

.waiting-panel {
  padding-block: 52px;
  text-align: center;
}

.waiting-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.loading-pulse {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.loading-pulse span {
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}

.loading-pulse span:nth-child(2) {
  animation-delay: 120ms;
}

.loading-pulse span:nth-child(3) {
  animation-delay: 240ms;
}

.history-section {
  margin-top: 4px;
}

.section-heading-row {
  margin-bottom: 22px;
  align-items: flex-end;
}

.history-item {
  padding: 16px 0;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.history-round {
  color: var(--red);
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.history-prompt,
.history-answer,
.history-winner {
  margin: 0;
  overflow-wrap: anywhere;
}

.history-prompt {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.history-answer {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.6;
}

.history-winner {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.history-score {
  color: var(--red);
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
}

.history-score small {
  color: var(--muted);
  font-size: 9px;
}

.empty-copy {
  margin: 0;
  padding: 24px 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.side-card {
  padding: 22px;
}

.progress-card h2 {
  font-size: 20px;
}

.phase-steps {
  position: relative;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  list-style: none;
}

.phase-steps::before {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 16px;
  width: 1px;
  background: var(--line);
}

.phase-steps li {
  position: relative;
  z-index: 1;
  padding: 9px 7px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
}

.phase-steps li > span {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: 800;
}

.phase-steps li div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.phase-steps strong {
  font-size: 12px;
}

.phase-steps small {
  color: var(--muted);
  font-size: 10px;
}

.phase-steps li.is-current {
  background: var(--red-soft);
}

.phase-steps li.is-current > span {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.phase-steps li.is-done > span {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.manners-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  color: #fff;
  background: var(--red);
  border-color: var(--red-dark);
}

.side-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--red);
  background: #fff;
  border-radius: 50%;
  font-family: "Yu Mincho", serif;
  font-weight: 900;
}

.manners-card h2 {
  font-family: inherit;
  font-size: 14px;
}

.manners-card p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
  line-height: 1.7;
}

.rules-card {
  padding: 0;
  overflow: hidden;
}

.rules-card summary {
  padding: 19px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}

.rules-card summary::-webkit-details-marker {
  display: none;
}

.rules-card[open] summary span {
  transform: rotate(45deg);
}

.rules-copy {
  padding: 0 22px 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.rules-copy ol {
  margin: 0;
  padding-left: 1.4em;
}

.rules-copy p {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.site-footer {
  width: min(calc(100% - 40px), var(--content));
  margin: 0 auto;
  padding: 30px 0 38px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  border-top: 1px solid rgba(23, 23, 19, 0.11);
  font-size: 10px;
}

.site-footer p {
  margin: 0;
}

.site-footer strong {
  color: var(--ink);
  font-family: "Yu Mincho", serif;
  font-size: 13px;
}

.site-footer span {
  margin-left: 5px;
  padding: 2px 5px;
  color: #fff;
  background: var(--ink);
  border-radius: 4px;
  font-size: 8px;
}

.name-dialog {
  width: min(calc(100% - 32px), 440px);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(23, 23, 19, 0.24);
}

.name-dialog::backdrop {
  background: rgba(23, 23, 19, 0.58);
  backdrop-filter: blur(4px);
}

.name-dialog form {
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.name-dialog h2 {
  font-size: 22px;
}

.dialog-close {
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 22px;
}

.dialog-actions {
  justify-content: flex-end;
}

.secondary-button {
  min-height: 48px;
  padding-inline: 18px;
}

.dialog-actions .primary-button {
  min-height: 48px;
}

.toast-region {
  position: fixed;
  z-index: 1100;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100% - 40px));
  padding: 13px 16px;
  color: #fff;
  background: var(--ink);
  border-radius: 11px;
  box-shadow: 0 14px 30px rgba(23, 23, 19, 0.22);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast-region.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.noscript-message {
  position: fixed;
  z-index: 2000;
  right: 20px;
  bottom: 20px;
  left: 20px;
  margin: 0;
  padding: 15px;
  color: #fff;
  background: var(--red-dark);
  border-radius: 12px;
  text-align: center;
}

@keyframes blink {
  50% { opacity: 0.35; }
}

@keyframes bounce {
  0%, 70%, 100% { transform: translateY(0); opacity: 0.4; }
  35% { transform: translateY(-5px); opacity: 1; }
}

@keyframes timerPulse {
  50% { border-color: rgba(227, 71, 47, 0.95); }
}

@media (max-width: 900px) {
  .welcome-card {
    padding-top: 54px;
    grid-template-columns: 1fr;
    gap: 54px;
  }

  .welcome-copy {
    text-align: center;
  }

  .welcome-copy h1,
  .welcome-lead {
    margin-right: auto;
    margin-left: auto;
  }

  .welcome-points {
    justify-content: center;
  }

  .join-card {
    width: min(100%, 520px);
    margin: 0 auto;
  }

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

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

  .rules-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .topbar,
  main,
  .site-footer {
    width: min(calc(100% - 24px), var(--content));
  }

  .topbar {
    min-height: 72px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

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

  .brand-tagline,
  .connection-status,
  .pre-badge {
    display: none;
  }

  .name-button {
    max-width: 112px;
    min-height: 36px;
    padding: 7px 11px;
  }

  .welcome-card {
    min-height: auto;
    padding: 46px 0 64px;
    gap: 42px;
  }

  .welcome-copy h1 {
    font-size: clamp(43px, 13vw, 64px);
  }

  .welcome-lead {
    margin-top: 24px;
    font-size: 14px;
  }

  .welcome-points {
    margin-top: 26px;
    gap: 10px 15px;
  }

  .join-card {
    padding: 22px;
    border-radius: 22px;
  }

  .app-shell {
    padding-top: 20px;
  }

  .room-hero {
    border-radius: 20px;
  }

  .prompt-block {
    margin-top: 28px;
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .timer-card {
    width: 100%;
    min-height: auto;
    padding: 12px 15px;
    flex-direction: row;
    justify-content: space-between;
    border-radius: 12px;
  }

  .timer-card strong {
    margin: 0;
    font-size: 31px;
  }

  .timer-caption {
    display: none;
  }

  .room-stats {
    margin-top: 26px;
    gap: 20px;
    flex-wrap: wrap;
  }

  .lead-badge {
    width: 100%;
    margin: 0;
    text-align: center;
  }

  .phase-panel,
  .history-section {
    padding: 22px 18px;
    border-radius: 18px;
  }

  .phase-panel h2,
  .history-section h2 {
    font-size: 21px;
  }

  .input-action-row {
    grid-template-columns: 1fr;
  }

  .input-action-row .primary-button {
    width: 100%;
  }

  .vote-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .vote-stepper {
    justify-content: flex-end;
  }

  .result-item {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .result-score {
    grid-column: 2;
    text-align: left;
  }

  .history-item {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }

  .history-round {
    grid-column: 1 / -1;
  }

  .side-column {
    display: flex;
  }

  .site-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
