:root {
  color: #f4f2ed;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0b0b0c;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #0b0b0c;
}

button, input, select, textarea { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid #313136;
}

.eyebrow {
  margin: 0 0 12px;
  color: #aaa6b1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .22em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(34px, 5vw, 58px); line-height: .96; letter-spacing: -.055em; }
.lede { margin-bottom: 0; color: #aaa6b1; font-size: 15px; }

.service-state {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid #313136;
  border-radius: 999px;
  color: #c8c5cc;
  font-size: 12px;
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #77727d; }
.service-state.is-online .status-dot { background: #77d899; box-shadow: 0 0 0 4px rgba(119,216,153,.12); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr);
  gap: 24px;
  padding-top: 24px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(160px, .65fr) minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  padding: 18px 0 0;
}

.channel-control,
.key-control {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.channel-control label,
.key-control > span {
  color: #8f8a96;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}

.toolbar .button { white-space: nowrap; }
.button--quiet { color: #c7c2cc; background: #131316; }

.editor, .preview-panel, .history-panel {
  border: 1px solid #313136;
  background: #111113;
  border-radius: 18px;
  padding: 28px;
}

.side-column { display: grid; align-self: start; gap: 24px; }
.preview-panel { padding-bottom: 22px; }
.history-panel { padding: 24px; }

.section-heading { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 28px; }
.section-heading > span { color: #7e7985; font: 600 11px/1 monospace; padding-top: 5px; }
.section-heading h2 { margin-bottom: 5px; font-size: 19px; letter-spacing: -.02em; }
.section-heading p { margin-bottom: 0; color: #88848f; font-size: 12px; }
.section-heading--compact { margin-bottom: 18px; }

.field-grid { display: grid; gap: 16px; }
.field-grid--split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 9px; margin-bottom: 20px; min-width: 0; }
.field > span { display: flex; justify-content: space-between; color: #d6d3d9; font-size: 12px; font-weight: 650; }
.field b, .field i { color: #77727d; font-size: 10px; font-style: normal; font-weight: 500; }
.field small, .switch-row small { color: #77727d; font-size: 11px; line-height: 1.5; }

input, select, textarea {
  width: 100%;
  border: 1px solid #37373c;
  border-radius: 10px;
  outline: 0;
  background: #19191c;
  color: #f5f3f7;
  padding: 12px 13px;
  transition: border-color .16s ease, background-color .16s ease;
}

input:focus, select:focus, textarea:focus { border-color: #8c8793; background: #1d1d20; }
input[readonly] { color: #8d8992; }
textarea { min-height: 104px; resize: vertical; line-height: 1.6; }

.switch-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 16px;
  margin: 2px 0 22px;
  padding: 16px;
  border: 1px solid #313136;
  border-radius: 11px;
}
.switch-row > span:first-child { display: grid; gap: 4px; }
.switch-row strong { font-size: 13px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { grid-column: 2; grid-row: 1; width: 42px; height: 24px; border-radius: 999px; background: #454149; padding: 3px; transition: background .18s ease; }
.switch::after { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: #f6f4f8; transition: transform .18s ease; }
.switch-row input:checked + .switch { background: #f0eef3; }
.switch-row input:checked + .switch::after { background: #171719; transform: translateX(18px); }

.auth-box {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  margin-top: 8px;
  padding: 18px;
  border: 1px dashed #3e3c42;
  border-radius: 12px;
  background: #0e0e10;
}
.auth-box .field { margin: 0; }

.actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 24px; }
.feedback { margin: 0; color: #827e88; font-size: 12px; }
.feedback.is-error { color: #f29b9b; }
.feedback.is-success { color: #83d39e; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  min-height: 43px;
  border: 1px solid #454149;
  border-radius: 9px;
  padding: 0 16px;
  cursor: pointer;
  color: #e9e6ec;
  background: #1b1b1e;
}
.button:hover { background: #252529; }
.button:disabled { cursor: wait; opacity: .55; }
.button--primary { min-width: 154px; border-color: #f0edf3; color: #121214; background: #f0edf3; font-weight: 700; }
.button--primary:hover { background: #fff; }

.phone {
  width: min(100%, 320px);
  margin: 0 auto 28px;
  overflow: hidden;
  border: 7px solid #242427;
  border-radius: 34px;
  background: #050506;
  box-shadow: 0 20px 60px rgba(0,0,0,.32);
}
.phone-status { display: flex; justify-content: space-between; padding: 13px 20px 8px; color: #b7b4bc; font-size: 9px; }
.app-stage { position: relative; height: 500px; overflow: hidden; padding: 22px 18px; background: #111116; }
.app-stage::before { content: ""; position: absolute; inset: 0; opacity: .45; background: radial-gradient(circle at 85% 12%, #563c65 0, transparent 38%), linear-gradient(145deg, transparent 42%, rgba(125,89,139,.2) 43%, transparent 60%); }
.brand { position: relative; font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.brand span { color: #a781b4; }
.notice-preview { position: absolute; z-index: 2; top: 80px; left: 42px; right: 18px; height: 32px; display: flex; overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 5px; background: rgba(0,0,0,.58); }
.notice-preview.is-disabled { opacity: .28; }
.notice-viewport { display: flex; align-items: center; min-width: 0; flex: 1; overflow: hidden; padding-left: 12px; }
.notice-viewport span { white-space: nowrap; color: white; font-size: 10px; font-weight: 650; animation: marquee 9s linear infinite; }
.notice-arrow { display: grid; place-items: center; flex: 0 0 40px; color: white; font-size: 22px; background: rgba(0,0,0,.18); }

.mail-sheet {
  position: absolute;
  z-index: 3;
  top: 130px;
  right: 12px;
  bottom: 14px;
  left: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: rgba(15,13,18,.94);
  box-shadow: 0 18px 40px rgba(0,0,0,.32);
}

.mail-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 46px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
}

.mail-sheet-head span { color: #8d8792; font-size: 15px; }

.mail-row {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.025);
}

.mail-row i { width: 7px; height: 7px; border-radius: 50%; background: #bc83d0; box-shadow: 0 0 0 4px rgba(188,131,208,.1); }
.mail-row div { display: grid; min-width: 0; gap: 4px; }
.mail-row strong { overflow: hidden; color: #f7f4f9; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.mail-row small { color: #8c8792; font-size: 8px; }
.mail-row b { color: #aaa3af; font-size: 14px; }

.markdown-preview {
  height: calc(100% - 108px);
  overflow: auto;
  padding: 15px 17px 28px;
  color: #c8c3cc;
  font-size: 9px;
  line-height: 1.65;
  scrollbar-width: thin;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4 { margin: 12px 0 7px; color: #f7f4f9; line-height: 1.25; }
.markdown-preview h1 { font-size: 16px; }
.markdown-preview h2 { font-size: 14px; }
.markdown-preview h3, .markdown-preview h4 { font-size: 12px; }
.markdown-preview p { margin: 0 0 9px; }
.markdown-preview ul, .markdown-preview ol { margin: 0 0 10px; padding-left: 18px; }
.markdown-preview blockquote { margin: 8px 0; padding: 7px 10px; border: 1px solid rgba(188,131,208,.26); border-radius: 7px; color: #d9c8df; background: rgba(188,131,208,.07); }
.markdown-preview code { padding: 1px 4px; border-radius: 4px; color: #e3d3e9; background: #28232b; }
.markdown-preview a { color: #d4a3e4; }

.history-list { display: grid; gap: 8px; }

.history-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid #303034;
  border-radius: 10px;
  color: #ddd9e0;
  text-align: left;
  background: #17171a;
  cursor: pointer;
}

.history-item:hover { border-color: #54505a; background: #1c1c20; }
.history-item > span:nth-child(2) { display: grid; min-width: 0; gap: 5px; }
.history-item strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.history-item small { color: #817c87; font-size: 9px; }
.history-item b { color: #77717d; font-size: 15px; }
.history-state { width: 7px; height: 7px; border-radius: 50%; background: #5b575f; }
.history-state.is-live { background: #77d899; box-shadow: 0 0 0 4px rgba(119,216,153,.1); }

.empty-state {
  padding: 24px 16px;
  border: 1px dashed #38353c;
  border-radius: 10px;
  color: #77727d;
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

.release-meta { margin: 0; border-top: 1px solid #313136; }
.release-meta div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid #29292d; font-size: 11px; }
.release-meta dt { color: #77727d; }
.release-meta dd { margin: 0; color: #c5c2ca; text-align: right; }

@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-55%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 860px) {
  .shell { width: min(100% - 28px, 680px); padding-top: 28px; }
  .masthead { align-items: flex-start; flex-direction: column; }
  .workspace { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .shell { width: 100%; padding: 0; }
  .masthead { padding: 28px 20px 24px; }
  .workspace { padding: 0; gap: 0; }
  .toolbar { grid-template-columns: 1fr; padding: 18px 20px; }
  .editor, .preview-panel, .history-panel { border-left: 0; border-right: 0; border-radius: 0; padding: 22px 20px; }
  .side-column { gap: 0; }
  .field-grid--split { grid-template-columns: 1fr; gap: 0; }
  .auth-box { grid-template-columns: 1fr; }
  .actions { align-items: stretch; flex-direction: column; }
  .button--primary { width: 100%; }
}

.is-hidden { display: none !important; }

.ambient-mark {
  position: fixed;
  z-index: 0;
  top: -100px;
  right: -120px;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(167, 129, 180, .32);
  border-radius: 50%;
  box-shadow: 0 0 0 74px rgba(86, 60, 101, .22), 0 0 0 150px rgba(48, 36, 55, .2);
  pointer-events: none;
}

.access-gate {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
  min-height: 100vh;
  color: #f4f2ed;
}

.gate-intro {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 24px;
  min-height: 600px;
  padding: clamp(48px, 7vw, 112px);
  border-bottom: 1px solid #313136;
}

.gate-intro h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(48px, 7vw, 104px);
  font-weight: 520;
  letter-spacing: -.055em;
  line-height: .98;
}

.gate-copy { max-width: 58ch; margin: 0; color: #aaa6b1; font-size: 15px; }

.compatibility-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  color: #77727d;
  font-size: 12px;
}

.compatibility-line span::before { content: "·"; margin-right: 8px; color: #a781b4; }

.gate-form-wrap {
  position: relative;
  display: flex;
  align-items: center;
  padding: clamp(32px, 5vw, 80px);
  border-left: 1px solid #313136;
  background: #111113;
}

.gate-index {
  position: absolute;
  top: 28px;
  right: 32px;
  color: #454149;
  font: 600 54px/1 monospace;
}

.gate-form { display: grid; gap: 24px; width: min(100%, 420px); margin: auto; }
.section-kicker { margin: 0; color: #a781b4; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.gate-form h2 { margin: 8px 0 0; font-size: 28px; font-weight: 550; letter-spacing: -.025em; }

.login-field { display: grid; gap: 8px; min-width: 0; }
.login-field > span { color: #aaa6b1; font-size: 12px; font-weight: 650; }
.login-field input { min-height: 48px; padding: 0 16px; border-radius: 7px; }
.login-field input:hover { border-color: #54505a; }
.button--login { width: 100%; min-height: 48px; }
.form-error { min-height: 20px; margin: 0; color: #f29b9b; font-size: 12px; }
.masthead-actions { display: flex; align-items: center; gap: 12px; }
.operator-name { color: #aaa6b1; font-size: 12px; }

@media (max-width: 760px) {
  .access-gate { grid-template-columns: 1fr; }
  .gate-intro { min-height: 420px; padding: 48px 24px; }
  .gate-form-wrap { min-height: 520px; padding: 32px 24px; border-top: 1px solid #313136; border-left: 0; }
  .masthead-actions { align-items: flex-start; flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .gate-intro h1 { font-size: 45px; }
  .gate-intro { padding: 48px 20px; }
  .gate-form-wrap { padding: 32px 20px; }
  .operator-name { display: none; }
}
