:root {
  color: #16303a;
  background: #e7eef2;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  --bg: #e7eef2;
  --panel: #f7fbfc;
  --line: rgba(22, 72, 88, 0.16);
  --text: #16303a;
  --muted: #5d7580;
  --accent: #0e8ea3;
  --ink: #f4fbfc;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(880px 380px at 8% -12%, rgba(14, 142, 163, 0.16), transparent 62%),
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(14, 142, 163, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 142, 163, 0.07) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(#000, transparent 82%);
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.top {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: rgba(247, 251, 252, 0.92);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 2;
}
.mark { font-weight: 700; letter-spacing: 0.04em; text-decoration: none; }
.mark::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  background: var(--accent);
  vertical-align: 1px;
}
.top-actions { display: flex; gap: 10px; align-items: center; }
#maintain, #back, .top-actions a {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
}
#maintain:hover, #back:hover, .top-actions a:hover { border-color: var(--accent); color: var(--accent); }
#save, .text-button, .choice {
  border: 0;
  background: var(--accent);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 14px;
  font-weight: 650;
  cursor: pointer;
}
#save:hover, .text-button:hover { filter: brightness(1.08); }
#save:active, .text-button:active, .card:active { transform: scale(0.98); }
#status { color: var(--accent); font-size: 13px; }
.home { position: relative; padding: 28px 32px 48px; }
.gate {
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 28px 28px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(22, 72, 88, 0.1);
}
.gate-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.gate-card h1 { margin: 0 0 4px; font-size: 28px; }
.gate-card label { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.gate-card input {
  padding: 12px 14px;
  border: 1px solid #c5d4dc;
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-size: 16px;
}
.gate-card input:focus { outline: 2px solid rgba(14, 142, 163, 0.35); border-color: var(--accent); }
.gate-card .text-button { margin-top: 8px; padding: 12px 14px; }
.gate-card #login-error { min-height: 1.2em; margin: 4px 0 0; color: #b42318; }
.viewer {
  position: relative;
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 16px 24px 20px;
  overflow: hidden;
}
.page-head { margin-bottom: 28px; }
.home h1, .page-head h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: 0.02em; }
.brand { margin-bottom: 32px; }
.brand h2, .viewer-bar h1, .props h2, .tree h2 { margin: 0 0 14px; font-size: 16px; font-weight: 650; }
.cards { display: flex; flex-wrap: wrap; gap: 14px; }
.card {
  width: 240px;
  padding: 18px 18px 16px;
  background: linear-gradient(180deg, rgba(14, 142, 163, 0.08), transparent 46%), var(--panel);
  box-shadow: 0 10px 28px rgba(22, 72, 88, 0.08);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card span { display: block; color: var(--muted); margin-top: 8px; font-size: 13px; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; flex: none; }
.viewer-bar a { color: var(--accent); text-decoration: none; }
.fit { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.viewer .stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.viewer .stage.turn { transform: translate(-50%, -50%) rotate(90deg); }
.stage {
  position: relative;
  background: #d5e0e6;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(14, 142, 163, 0.35), 0 18px 40px rgba(22, 72, 88, 0.16);
}
.stage img { display: block; width: 100%; height: 100%; border-radius: 12px; }
.hotspot {
  position: absolute;
  border: 1px solid rgba(46, 196, 214, 0.75);
  background: rgba(46, 196, 214, 0.12);
  cursor: pointer;
  padding: 0;
}
.hotspot:hover, .hotspot.selected { background: rgba(46, 196, 214, 0.28); }
.viewer .hotspot, .viewer .hotspot:hover {
  border-color: transparent;
  background: transparent;
}
.menu {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: #f4f7f8;
  color: #14202b;
  border: 1px solid #6d8494;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.menu button {
  text-align: left;
  border: 0;
  border-bottom: 1px solid #d5dee6;
  background: #f4f7f8;
  color: #14202b;
  padding: 0 6px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.menu button:last-child { border-bottom: 0; }
.menu button:hover, .menu button.picked { background: #2ec4d6; color: #041418; }
.menu .empty { margin: 4px; color: #5c7080; }
.menu-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.menu-option { display: flex; flex-direction: column; gap: 6px; }
.menu-option .text-button { padding: 5px 10px; }
.editor {
  height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  position: relative;
}
.tree, .props { overflow: auto; background: rgba(247, 251, 252, 0.94); padding: 18px; }
.tree { border-right: 1px solid var(--line); }
.props { border-left: 1px solid var(--line); }
.board { overflow: hidden; padding: 18px; display: grid; place-items: center; }
.screen-list { display: flex; flex-direction: column; gap: 4px; }
.screen-list button, .adder {
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 7px 8px;
  cursor: pointer;
}
.screen-list button:hover { background: rgba(14, 142, 163, 0.08); }
.screen-list button.active { background: rgba(14, 142, 163, 0.14); box-shadow: inset 2px 0 0 var(--accent); }
.adder { color: var(--accent); padding-left: 0; }
.search, .props label, .create { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.create { flex-direction: row; align-items: center; }
.search input, .props input, .props select, .create input {
  padding: 8px 10px;
  border: 1px solid #c5d4dc;
  border-radius: 8px;
  background: #ffffff;
}
.create input { min-width: 220px; }
.search input:focus, .props input:focus, .props select:focus, .create input:focus {
  outline: 2px solid rgba(14, 142, 163, 0.35);
  border-color: var(--accent);
}
select option { background: #ffffff; color: var(--text); }
.handle {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 10px;
  height: 10px;
  background: var(--accent);
}
.empty { color: var(--muted); }
@media (max-width: 800px) {
  .viewer { padding: 8px 8px 12px; }
  .viewer-bar { margin-bottom: 6px; }
  .viewer-bar h1 { font-size: 14px; }
  .home { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, #save, .text-button { transition: none; }
  .card:hover, #save:active, .text-button:active, .card:active { transform: none; }
}
