:root {
  color-scheme: dark;
  --bg: #0e1216;
  --panel: #151b21;
  --panel-2: #1b232b;
  --line: #2a3640;
  --line-soft: #22303a;
  --text: #ecf2f6;
  --muted: #95a5b2;
  --teal: #46c7b0;
  --blue: #6fa8ff;
  --amber: #d4a74c;
  --rose: #dd6d6d;
  --green: #7ccf78;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(70, 199, 176, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(70, 199, 176, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 44px 44px;
  color: var(--text);
}

body.access-code-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  color: var(--text);
  cursor: pointer;
  transition:
    transform 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    opacity 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f151b;
  color: var(--text);
  outline: none;
}

input {
  min-height: 40px;
  padding: 0 12px;
}

textarea {
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(70, 199, 176, 0.12);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

label span,
.eyebrow,
.status-chip,
.result-meta,
.inline-note,
.empty-state,
.field-label,
.keyline {
  letter-spacing: 0;
}

.shell {
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 27, 33, 0.96);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(70, 199, 176, 0.4);
  border-radius: 8px;
  background: #0f1b1b;
  color: var(--teal);
  font-size: 20px;
  font-weight: 800;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.status-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.status-chip {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 8px 12px;
  background: #0f151b;
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

.status-chip.muted {
  color: var(--muted);
}

.status-chip.good {
  border-color: rgba(124, 207, 120, 0.35);
  color: var(--green);
}

.status-chip.warn {
  border-color: rgba(212, 167, 76, 0.35);
  color: var(--amber);
}

.status-chip.bad {
  border-color: rgba(221, 109, 109, 0.35);
  color: var(--rose);
}

.mode-tabs {
  display: flex;
  gap: 8px;
}

.tab {
  padding: 0 14px;
  min-height: 38px;
  border-color: var(--line-soft);
  background: #10161c;
  color: var(--muted);
}

.tab.active {
  border-color: rgba(70, 199, 176, 0.6);
  background: rgba(70, 199, 176, 0.12);
  color: var(--teal);
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 500px) minmax(560px, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 27, 33, 0.96);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.form-panel,
.result-panel {
  min-height: calc(100vh - 120px);
}

.form-stack {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.primary-btn {
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(70, 199, 176, 0.2), rgba(70, 199, 176, 0.12));
  border-color: rgba(70, 199, 176, 0.55);
  color: var(--teal);
  font-weight: 800;
}

.ghost-btn {
  padding: 0 14px;
  border-color: var(--line-soft);
  background: #10161c;
  color: var(--muted);
}

.icon-btn {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-color: var(--line-soft);
  background: #10161c;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.friends-toolbar {
  display: grid;
  gap: 12px;
}

.inline-note {
  display: flex;
  align-items: end;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.friend-list {
  display: grid;
  gap: 12px;
}

.friend-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0f151b;
}

.friend-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.friend-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.result-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #0f151b;
}

.section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0f151b;
}

.section h3 {
  font-size: 15px;
}

.stack {
  display: grid;
  gap: 10px;
}

.subgrid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #10161c;
}

.card h4 {
  margin: 0;
  font-size: 14px;
}

.card p,
.card li,
.card div {
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: #10161c;
  color: var(--muted);
  font-size: 12px;
}

.list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.list li {
  line-height: 1.55;
}

.access-code-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.access-code-modal[hidden] {
  display: none;
}

.access-code-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: rgba(5, 8, 11, 0.72);
  backdrop-filter: blur(4px);
}

.access-code-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 27, 33, 0.98);
  box-shadow: var(--shadow);
}

.access-code-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.access-code-hint {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

.access-code-error {
  margin-top: 8px;
  color: var(--rose);
  font-size: 12px;
}

.access-code-actions {
  margin-top: 14px;
}

@media (max-width: 1080px) {
  .topbar,
  .workspace {
    grid-template-columns: 1fr;
  }

  .status-group,
  .mode-tabs {
    justify-content: flex-start;
  }

  .form-panel,
  .result-panel {
    min-height: auto;
  }
}

@media (max-width: 700px) {
  .shell {
    padding: 12px;
  }

  .topbar {
    padding: 12px;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .result-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button,
  .panel-head button {
    width: 100%;
  }
}
