* { box-sizing: border-box; }

:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  background: #070014;
  color: #404040;
  --bg: #070014;
  --foreground: #0f0f0f;
  --standard: #404040;
  --special: #5e02ff;
  --panel: var(--foreground);
  --panel-2: color-mix(in srgb, var(--foreground) 90%, #ffffff 10%);
  --line: color-mix(in srgb, var(--foreground) 72%, var(--standard) 28%);
  --body-text: var(--standard);
  --muted: color-mix(in srgb, var(--standard) 72%, var(--bg) 28%);
  --muted-strong: color-mix(in srgb, var(--standard) 88%, var(--bg) 12%);
  --text: var(--special);
  --accent: var(--special);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--body-text);
  font-size: 13px;
  line-height: 1.25;
}

button, textarea, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app {
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 7px 12px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  text-align: left;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-size: .92rem;
  font-weight: 800;
}

.brand strong,
.brand small { display: block; }

.brand strong {
  color: var(--accent);
  font-size: 13.5px;
  line-height: 1.05;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .02em;
}

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

.version-button {
  height: 32px;
  min-width: 42px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .08em;
}

.version-button:active {
  background: var(--panel);
  transform: scale(.98);
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
}

.view-root {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 14px 12px 28px;
}

.hero {
  padding: 4px 0 12px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.hero h1,
.page-head h1 {
  margin: 0;
  color: var(--accent);
  font-size: 34px;
  line-height: .98;
  letter-spacing: -.035em;
}

.hero p:last-child,
.page-head > p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.3;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.module-card {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--body-text);
  text-align: left;
  overflow: hidden;
}

button.module-card:active {
  transform: scale(.987);
  background: var(--panel-2);
}

.module-card strong,
.module-card small { display: block; }

.module-card strong {
  color: var(--accent);
  font-size: 15.5px;
  line-height: 1.05;
  letter-spacing: -.01em;
}

.module-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
}

.module-icon {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
}

.dormant { opacity: .48; }

.storage-status {
  margin: 11px 1px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.ui-settings-button {
  width: 100%;
  min-height: 34px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
}

.ui-settings-button:active {
  background: var(--panel);
  transform: scale(.995);
}

.page-head {
  padding: 0 0 10px;
}

.back-button {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.panel {
  margin-top: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--body-text);
}

.panel > strong {
  color: var(--body-text);
  font-size: 12px;
}

.subtle-panel { background: transparent; }

label {
  display: block;
  margin-bottom: 5px;
  color: var(--body-text);
  font-size: 11px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  background: var(--foreground);
  color: var(--body-text);
  outline: none;
  caret-color: var(--accent);
  font-size: 12px;
  line-height: 1.35;
}

textarea:focus { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 8px;
}

.primary-button,
.secondary-button {
  min-height: 36px;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 10.5px;
  font-weight: 750;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: var(--bg);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--body-text);
}

.compact {
  min-width: 76px;
  min-height: 34px;
}

.inline-status {
  margin: 8px 1px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.data-row strong {
  display: block;
  color: var(--body-text);
  font-size: 11.5px;
}

.data-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.divider {
  height: 1px;
  margin: 10px 0;
  background: var(--line);
}

.stat-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
}

.stat-line:last-child { border-bottom: 0; }
.stat-line span { color: var(--muted); }

.stat-line strong {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.color-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.color-setting-row label { margin-bottom: 2px; }

.setting-description {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.2;
}

.color-control {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.color-control input[type="color"] {
  width: 38px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.color-control code {
  min-width: 58px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ui-actions { margin-top: 12px; }

@media (max-width: 480px) {
  .view-root { padding-left: 11px; padding-right: 11px; }
  .module-card { min-height: 84px; padding: 9px; }
  .hero h1, .page-head h1 { font-size: 32px; }
}
