:root {
  --bg: #8cc9ef;
  --bg-dark: #5ea4d0;
  --ink: #0e1116;
  --card: #f6f2ea;
  --accent: #f3de59;
  --line: #101010;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Noto Sans SC", sans-serif;
  background: radial-gradient(circle at 10% 10%, #a8dbfa 0%, var(--bg) 45%, var(--bg-dark) 100%);
  color: var(--ink);
  min-height: 100vh;
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image: radial-gradient(#000 0.8px, transparent 0.8px);
  background-size: 4px 4px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
}

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

.user-badge {
  border: 2px solid #111;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  background: #fff;
}

.topbar h1 {
  margin: 0;
  font-family: "ZCOOL QingKe HuangYou", cursive;
  font-size: 38px;
  letter-spacing: 1px;
}

.topbar p { margin: 4px 0 0; font-size: 13px; }

.canvas {
  padding: 4px 18px 22px;
  display: grid;
  gap: 18px;
}

.flow-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.arrow {
  font-size: 30px;
  font-weight: 700;
  align-self: center;
  min-width: 26px;
  text-align: center;
}

.card, .platform-card {
  min-width: 290px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 10px;
  box-shadow: 5px 5px 0 #111;
  padding: 12px;
}

.card-title {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 16px;
}

textarea {
  width: 100%;
  min-height: 235px;
  resize: vertical;
  border: 2px solid #212121;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.platform-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.platform-card textarea {
  min-height: 300px;
}

.platform-head {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
  margin-bottom: 8px;
  padding: 8px;
}

.platform-head h2 { margin: 0; font-size: 20px; }
.platform-head small { color: #333; }

button {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 8px;
  height: 36px;
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.primary { background: var(--accent); }
.ghost { background: #e5eef8; }

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.hooks-list {
  min-height: 235px;
  border: 2px dashed #222;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  overflow: auto;
}

.hook-item {
  border: 1px solid #999;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.hook-item.active {
  border-color: #111;
  background: #fff6b8;
}

.hook-text {
  flex: 1;
  line-height: 1.45;
}

.hook-copy {
  height: 28px;
  min-width: 48px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  background: #f7f7f7;
}

.panel {
  position: fixed;
  right: 18px;
  top: 74px;
  width: min(560px, calc(100vw - 36px));
  background: #fff;
  border: 2px solid #0d0d0d;
  border-radius: 10px;
  box-shadow: 8px 8px 0 #111;
  padding: 12px;
  z-index: 10;
}

.hidden { display: none !important; }

.panel h3 { margin: 4px 0 10px; }
.panel label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.panel input, .panel textarea {
  width: 100%;
  margin-top: 4px;
  border: 2px solid #222;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
}

.panel select {
  width: 100%;
  margin-top: 4px;
  border: 2px solid #222;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  background: #fff;
}

.panel textarea { min-height: 240px; }
.panel-actions { display: flex; gap: 8px; margin-top: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.2s;
}

.toast.show { opacity: 1; }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 14, 28, 0.52);
  backdrop-filter: blur(4px);
}

.auth-card {
  width: min(420px, calc(100vw - 28px));
  background: #fff;
  border: 2px solid #111;
  border-radius: 12px;
  box-shadow: 8px 8px 0 #111;
  padding: 18px;
}

.auth-card h2 {
  margin: 0 0 6px;
}

.auth-card p {
  margin: 0 0 14px;
  font-size: 13px;
}

.auth-card label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

.auth-card input {
  width: 100%;
  margin-top: 4px;
  border: 2px solid #222;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
}

.auth-btn {
  width: 100%;
  margin-top: 6px;
}

.auth-card small {
  display: block;
  margin-top: 8px;
  color: #666;
  font-size: 12px;
}

#logoutConfirmGate .panel-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

@media (max-width: 1100px) {
  .platform-row {
    grid-template-columns: 1fr;
  }
}
