:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-soft: #eef0f3;
  --text: #111827;
  --text-soft: #6b7280;
  --text-faint: #9ca3af;
  --accent: #111827;
  --accent-hover: #1f2937;
  --danger: #b91c1c;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 8px 24px rgba(17, 24, 39, 0.05);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  line-height: 1.6;
  background: var(--bg);
}

.hidden {
  display: none !important;
}

button {
  font-family: inherit;
  cursor: pointer;
}

textarea {
  font-family: inherit;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 56px;
}

/* ---------- 身份选择 ---------- */
.identity-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.identity-inner {
  width: 100%;
  max-width: 620px;
}

.site-title {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 650;
  letter-spacing: 0.04em;
}

.site-subtitle {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 1rem;
}

.identity-prompt {
  margin: 42px 0 14px;
  color: var(--text-faint);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
}

.identity-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.identity-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.identity-card:hover {
  border-color: #c7cbd1;
  transform: translateY(-1px);
}

.identity-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.identity-footnote {
  margin: 26px 0 0;
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 60px;
  padding: 0 20px;
  margin: 0 -20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-title {
  font-size: 1rem;
  font-weight: 650;
}

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

.identity-badge {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.ghost-btn {
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 0.9rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.ghost-btn:hover {
  background: #f3f4f6;
  color: var(--text);
}

.topbar-back {
  white-space: nowrap;
}

/* ---------- 大厅 ---------- */
.lobby {
  padding-top: 28px;
}

.lobby-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.lobby-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 650;
}

.lobby-subtitle {
  margin: 3px 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.primary-btn {
  padding: 9px 16px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 9px;
  font-size: 0.92rem;
  transition: background 0.15s ease, transform 0.15s ease;
}

.primary-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.round-list {
  display: grid;
  gap: 10px;
}

.round-list .empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.round-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 15px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.round-card:hover {
  border-color: #c7cbd1;
  transform: translateY(-1px);
}

.round-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.round-number {
  font-size: 1rem;
  font-weight: 600;
}

.round-status {
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--text-soft);
  background: #f3f4f6;
}

.round-status.revealed {
  color: #166534;
  background: #ecfdf5;
}

.round-progress {
  margin-top: 7px;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.round-time {
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 0.8rem;
}

/* ---------- 写作 / 揭晓页 ---------- */
.round-view {
  padding-top: 26px;
}

.round-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.round-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 650;
}

.round-meta {
  color: var(--text-faint);
  font-size: 0.82rem;
}

.status-banner {
  margin: 14px 0 18px;
  padding: 10px 14px;
  text-align: center;
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--text-soft);
  background: #f3f4f6;
}

.status-banner.revealed {
  color: #166534;
  background: #ecfdf5;
  font-weight: 600;
}

.status-banner .sep {
  margin: 0 8px;
  color: #c2c7ce;
}

.reveal-hint {
  color: var(--text);
  font-weight: 600;
}

.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "myq othera"
    "otherq mya";
  gap: 16px;
}

.board-cell {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.cell-title {
  margin: 0 0 12px;
  padding-bottom: 9px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 650;
  border-bottom: 1px solid var(--border-soft);
}

.line-list {
  display: grid;
  gap: 10px;
}

.line-input {
  width: 100%;
  min-height: 62px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fbfcfd;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

.line-input:focus {
  outline: none;
  border-color: #9ca3af;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}

.covered-line {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 12px;
  border: 1px dashed #d7dbe0;
  border-radius: 9px;
  background: #f3f4f6;
  color: var(--text-faint);
  font-size: 0.86rem;
}

.covered-line.is-filled {
  border-color: #c7cbd1;
  color: var(--text-soft);
}

.covered-line.is-filled::after {
  content: "·";
  font-size: 1.4rem;
  line-height: 1;
  color: #6b7280;
}

.poem-line {
  min-height: 62px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-left: 3px solid #d1d5db;
  border-radius: 9px;
  background: #fbfcfd;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

.round-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

.reveal-btn {
  padding: 9px 22px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease;
}

.reveal-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.reveal-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.save-state {
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .app {
    padding: 0 14px 44px;
  }

  .topbar {
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .identity-cards {
    grid-template-columns: 1fr;
  }

  .lobby-head {
    flex-direction: column;
    align-items: stretch;
  }

  .lobby-head .primary-btn {
    width: 100%;
  }

  .board {
    grid-template-columns: 1fr;
    grid-template-areas:
      "myq"
      "othera"
      "otherq"
      "mya";
  }

  .round-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .round-actions {
    flex-wrap: wrap;
  }
}
