:root {
  --bg: #ffffff;
  --ink: #191919;
  --muted: #767676;
  --line: #eeeeee;
  --bubble: #eef4ff;
  --soft: #f7f7f7;
  --accent: #2f65c8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.gate-shell {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(25, 25, 25, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(25, 25, 25, 0.035) 1px, transparent 1px),
    #fbfbf8;
  background-size: 26px 26px;
}

.gate-card {
  width: min(520px, 100%);
  border: 1px solid #e5e5e5;
  border-radius: 14px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.08);
}

.gate-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.gate-card h1 {
  margin: 0;
  font-size: clamp(28px, 8vw, 46px);
  line-height: 1.05;
}

.gate-copy {
  margin: 14px 0 20px;
  color: #4c4c4c;
  font-size: 15px;
  line-height: 1.8;
}

.gate-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
}

.gate-form input {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #f8f8f8;
  outline: none;
}

.gate-form input:focus {
  border-color: #c8d8ff;
  box-shadow: 0 0 0 4px rgba(47, 101, 200, 0.12);
}

.gate-form button {
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: #191919;
}

.gate-error {
  min-height: 22px;
  margin: 10px 0 0;
  color: #b42318;
  font-size: 14px;
}

.gate-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.gate-notes span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
}

.phone-shell {
  display: grid;
  grid-template-rows: 76px minmax(0, 1fr) auto;
  width: min(900px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  background: #fff;
}

.side-rail {
  position: fixed;
  left: 0;
  top: 92px;
  z-index: 5;
  display: grid;
  gap: 8px;
  place-items: center;
  width: 38px;
  min-height: 148px;
  border: 1px solid #d9e1d6;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #f8faf7;
  color: #596458;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.side-rail span {
  writing-mode: vertical-rl;
  font-size: 12px;
  letter-spacing: 0;
}

.side-rail strong {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #eaf1e7;
  color: #526050;
  font-size: 12px;
}

.side-rail:hover,
.side-rail:focus-visible {
  background: #eef5eb;
  outline: none;
}

.chat-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.chat-top h1 {
  margin: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(16px, 2.8vw, 20px);
  font-weight: 500;
}

.top-icon {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
}

.top-spacer {
  width: 54px;
}

.chat-feed {
  overflow-y: auto;
  padding: 18px clamp(18px, 5vw, 42px) 152px;
}

.message {
  margin-bottom: 18px;
  font-size: clamp(15px, 2.3vw, 18px);
  line-height: 1.72;
  scroll-margin-top: 88px;
  white-space: pre-wrap;
}

.message.player {
  width: fit-content;
  max-width: min(620px, 82%);
  margin-left: auto;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bubble);
}

.message.system {
  font-weight: 500;
}

.day-title {
  display: block;
  font-weight: 800;
}

.message.small {
  color: var(--muted);
  font-size: 13px;
}

.choice-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 24px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.choice-button {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: #fafafa;
  color: var(--ink);
  text-align: left;
  font-size: clamp(15px, 2.3vw, 18px);
  line-height: 1.62;
}

.choice-button:hover,
.choice-button:focus-visible {
  background: #f1f5ff;
  border-color: #d7e3ff;
  outline: none;
}

.choice-button strong {
  font-weight: 800;
}

.choice-button:active {
  opacity: 0.6;
}

.composer {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 3;
  width: min(900px, 100%);
  transform: translateX(-50%);
  padding: 10px clamp(12px, 4vw, 24px) 14px;
  border-top: 1px solid var(--line);
  border-radius: 30px 30px 0 0;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.08);
}

.composer form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 10px;
}

.composer input {
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  background: var(--soft);
  color: var(--ink);
  font-size: 15px;
  outline: none;
}

.composer input::placeholder {
  color: #b6b6b6;
}

.composer form button {
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--ink);
}

.quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.quick-actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
}

.quick-actions button:nth-child(2) {
  color: #b42318;
  background: #fff5f5;
}

.decoy {
  position: relative;
  min-height: 100dvh;
  padding: 28px;
  background: #fff;
  color: #263226;
}

.decoy-return {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  min-width: 64px;
  min-height: 34px;
  border: 1px solid #d5ded2;
  border-radius: 6px;
  background: #f7faf5;
  color: #526050;
  font-size: 13px;
}

.decoy-return:hover,
.decoy-return:focus-visible {
  background: #eef5eb;
  outline: none;
}

.sheet-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.sheet-toolbar span {
  width: 88px;
  height: 28px;
  border: 1px solid #d5ded2;
  border-radius: 6px;
  background: #f7faf5;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border: 1px solid #d8e0d4;
  padding: 10px;
  text-align: left;
}

th {
  background: #eef5eb;
}

@media (min-width: 901px) {
  body {
    background: #f5f5f5;
  }

  .phone-shell {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  .chat-feed {
    padding-left: 28px;
    padding-right: 28px;
  }

  .composer form {
    grid-template-columns: 1fr;
  }
}
