:root {
  --bg: #eef1f7;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #8a93a6;
  --line: #e6e9f1;
  --soft: #f6f7fb;
  --blue: #2E5BE0;
  --blue-2: #4a7cf7;
  --green: #1e9e5a;
  --red: #d93025;
  --amber: #b07800;
  --shadow: 0 12px 36px rgba(30, 50, 100, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { padding: 0 0 48px; }

.shell { width: min(880px, 100%); margin: 0 auto; padding: 22px 20px 0; }

.brand {
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 2px 2px 18px;
}
.brand span { color: #c3c9d6; }

.view { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

.hero { text-align: center; padding: 26px 0 30px; }
.hero-icon {
  width: 58px; height: 58px; margin: 0 auto 14px;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--blue-2), var(--blue));
  box-shadow: 0 12px 26px rgba(46, 91, 224, 0.32);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.hero h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: .02em; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid rgba(230, 233, 241, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.actions { display: flex; flex-direction: column; gap: 12px; }
.action {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 18px 18px;
  font: inherit; text-align: left; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.action:hover { transform: translateY(-1px); box-shadow: 0 16px 40px rgba(30, 50, 100, 0.12); }
.action:active { transform: scale(.99); }
.action-icon {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600;
}
.action-icon.create { background: #e8efff; color: var(--blue); }
.action-icon.join { background: #e9f7ef; color: var(--green); }
.action-body { flex: 1; min-width: 0; }
.action-body strong { display: block; font-size: 16px; font-weight: 650; margin-bottom: 3px; }
.action-body small { display: block; color: var(--muted); font-size: 12.5px; }
.chev { color: #c3c9d6; font-size: 22px; }

.last { margin-top: 22px; padding: 16px; }
.last-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.last-head span { font-size: 13px; font-weight: 600; color: #4a5568; }
.last-text {
  margin: 0 0 12px; padding: 12px;
  background: var(--soft); border-radius: 10px;
  color: #4a5568; font-size: 13px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all;
  max-height: 180px; overflow: auto;
  font-family: inherit;
}
.link { border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; padding: 4px; }
.link.danger { color: var(--red); }

.tips { list-style: none; margin: 24px 2px 0; padding: 0; }
.tips li { color: #9aa3b5; font-size: 12.5px; line-height: 1.9; }
.tips li::before { content: "· "; }

.back {
  border: 0; background: none; color: var(--blue);
  font: inherit; font-size: 14px; padding: 8px 4px; cursor: pointer;
}

.join-card { max-width: 460px; margin: 42px auto 0; padding: 30px 26px 24px; text-align: center; }
.join-card h2 { margin: 0 0 8px; font-size: 22px; }
.join-card p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.code-input {
  width: 100%; height: 78px;
  text-align: center;
  font-size: 38px; font-weight: 700; letter-spacing: 14px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  padding: 0 0 0 14px;
  margin-bottom: 16px;
}
.code-input:focus { border-color: #b9c8f6; box-shadow: 0 0 0 3px rgba(46, 91, 224, .10); }
.hint { display: block; color: #9aa3b5; font-size: 12px; margin-top: 12px; }

.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  font: inherit; font-weight: 600;
  height: 46px; padding: 0 18px;
  cursor: pointer;
  transition: filter .15s ease, transform .1s ease;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: scale(.99); }
.btn.primary {
  background: linear-gradient(135deg, var(--blue-2), var(--blue));
  color: #fff;
  box-shadow: 0 8px 20px rgba(46, 91, 224, .22);
}
.btn.ghost { background: var(--soft); color: #4a5568; border-color: var(--line); }
.btn.small { height: 38px; font-size: 13px; padding: 0 14px; }
.join-card .btn { width: 100%; }

.room-head {
  display: grid; grid-template-columns: 96px 1fr 96px;
  align-items: center;
  padding: 6px 2px 2px;
}
.room-head .back { justify-self: start; }
.room-code-wrap { text-align: center; }
.room-code { font-size: 44px; font-weight: 750; letter-spacing: .16em; line-height: 1.1; padding-left: .16em; }
.room-label { color: #9aa3b5; font-size: 11px; margin-top: 2px; }
.online { justify-self: end; color: var(--muted); font-size: 12.5px; }

.status { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 10px 0 14px; color: var(--muted); font-size: 12.5px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #c3c9d6; }
.status.ok i { background: var(--green); }
.status.busy i { background: var(--blue); }
.status.off i { background: var(--red); }
.status.warn i { background: var(--amber); }

.editor-card { padding: 14px 16px 30px; position: relative; }
.editor {
  width: 100%; min-height: 48vh;
  border: 0; outline: none; resize: vertical;
  font: inherit; font-size: 16px; line-height: 1.65;
  color: var(--ink); background: transparent;
}
.editor::placeholder { color: #b4bac8; }
.counter { position: absolute; right: 16px; bottom: 9px; color: #b4bac8; font-size: 11px; }

.conflict {
  margin-top: 14px; padding: 14px 16px;
  background: #fff8e6; border: 1px solid #f3dca8; border-radius: 14px;
}
.conflict strong { display: block; color: #8a5a00; font-size: 13.5px; margin-bottom: 5px; }
.conflict p { margin: 0 0 12px; color: #9a7420; font-size: 12.5px; line-height: 1.55; }
.conflict-actions { display: flex; gap: 10px; }
.conflict-actions .btn { flex: 1; }

.toolbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.tool {
  height: 44px; border-radius: 11px;
  background: var(--card); border: 1px solid #dde3f0;
  color: var(--blue); font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
}
.tool:hover { background: #f8faff; }
.tool.danger { color: var(--red); border-color: #f2d2cf; }
.foot { text-align: center; color: #a6aebd; font-size: 11px; margin: 18px 0 0; }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: rgba(26, 26, 26, .9); color: #fff;
  padding: 10px 16px; border-radius: 10px;
  font-size: 13px; max-width: 80vw; text-align: center;
  z-index: 50; pointer-events: none;
}

@media (max-width: 560px) {
  .shell { padding: 16px 14px 0; }
  .hero { padding: 18px 0 22px; }
  .hero h1 { font-size: 24px; }
  .room-head { grid-template-columns: 72px 1fr 72px; }
  .room-code { font-size: 38px; }
  .editor { min-height: 42vh; }
  .join-card { margin-top: 24px; }
}
