/* ==========================================================================
   文字转 ASCII 艺术生成器（本地复刻版）—— 样式
   视觉语言沿用原始 TAAG 页面：一条灰蓝顶栏托着一块深色卡片，下面是纯白的输出区。
   ========================================================================== */

:root {
  --bg: #ffffff;
  --fg: #18181b;
  --muted: #6b7280;
  --border: #d4d4d8;
  --panel: #ffffff;
  --panel-alt: #f4f4f5;
  --topbar: #a1a1aa;
  --card: #1e293b;
  --card-fg: #f8fafc;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

html.dark {
  --bg: #09090b;
  --fg: #e4e4e7;
  --muted: #a1a1aa;
  --border: #3f3f46;
  --panel: #09090b;
  --panel-alt: #18181b;
  --topbar: #27272a;
  --card: #3f3f46;
  --card-fg: #f8fafc;
  --accent: #60a5fa;
  --accent-soft: #1e3a8a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 15px;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- top bar */

.topbar {
  flex: 0 0 auto;
  background: var(--topbar);
  padding: 6px;
  display: flex;
  justify-content: center;
}

.topbar-card {
  background: var(--card);
  color: var(--card-fg);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.12),
    inset 0 -2px 6px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 900px;
}

.topbar-card h1 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 4px;
}

.topbar-card h1 .sub {
  font-weight: 400;
  opacity: 0.85;
}

.topbar-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.field-label {
  display: block;
  text-align: left;
  font-size: 11px;
  color: #e4e4e7;
  margin-bottom: 4px;
}

/* ------------------------------------------------------------ font picker */

.font-picker {
  position: relative;
  width: 260px;
  max-width: 60vw;
}

.combo {
  position: relative;
}

.combo-input {
  width: 100%;
  min-height: 26px;
  padding: 3px 26px 3px 8px;
  border: 1px solid #71717a;
  border-radius: 6px;
  background: #52525b;
  color: #fff;
  font: inherit;
  font-size: 13px;
  outline: none;
}

.combo-input:focus {
  border-color: #a5b4fc;
}

.combo-caret {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 10px;
  opacity: 0.8;
}

.combo-list {
  position: absolute;
  z-index: 60;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 340px;
  overflow-y: auto;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  padding: 4px 0;
}

.combo-list[hidden] {
  display: none;
}

.combo-group {
  padding: 6px 12px 4px;
  background: var(--panel-alt);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  position: sticky;
  top: 0;
}

.combo-option {
  padding: 3px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combo-option.active,
.combo-option:hover {
  background: var(--accent-soft);
}

html.dark .combo-option.active,
html.dark .combo-option:hover {
  background: #1e3a8a;
}

.combo-option.selected {
  font-weight: 700;
}

.combo-empty {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

/* ------------------------------------------------------------------ tabs */

.tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 118px;
  padding: 6px 10px;
  border: 1px solid #52525b;
  border-radius: 6px;
  background: #3f3f46;
  color: #fafafa;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.tab-btn:hover {
  background: #52525b;
}

.tab-btn[aria-current="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.tab-btn .tab-icon {
  font-size: 13px;
  opacity: 0.9;
}

.tab-btn .only-small {
  display: none;
}

/* --------------------------------------------------------------- panels */

.panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: var(--panel);
  padding: 10px 20px 24px;
}

.panel[hidden] {
  display: none;
}

.panel-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* ------------------------------------------------------------ output area */

.output-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.output-toolbar .spacer {
  flex: 1 1 auto;
}

.art-frame {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  min-height: 190px;
  max-height: 46vh;
  overflow: auto;
  padding: 10px;
}

.art {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.17;
  white-space: pre;
  text-align: left;
  color: var(--fg);
  margin: 0;
  tab-size: 8;
}

.art-empty {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 2px;
  font-family: var(--mono);
}

.input-row {
  margin-top: 14px;
}

.input-row textarea {
  width: 100%;
  max-width: 460px;
  height: 92px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
  resize: vertical;
  outline: none;
}

.input-row textarea:focus {
  border-color: var(--accent);
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.btn:hover {
  background: var(--panel-alt);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn-menu-wrap {
  position: relative;
}

.btn-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  min-width: 250px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  padding: 4px;
}

.btn-menu[hidden] {
  display: none;
}

.btn-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.btn-menu button:hover {
  background: var(--panel-alt);
}

.btn-menu .hint {
  padding: 6px 9px 2px;
  font-size: 11px;
  color: var(--muted);
}

select,
input[type='number'],
input[type='text'] {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  outline: none;
}

select:focus,
input:focus {
  border-color: var(--accent);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

/* ------------------------------------------------------ about / options */

.prose {
  max-width: 760px;
  line-height: 1.6;
}

.prose h2 {
  font-size: 17px;
  margin: 22px 0 6px;
}

.prose p {
  margin: 0 0 10px;
}

.prose ul {
  margin: 0 0 10px;
  padding-left: 20px;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--panel-alt);
  padding: 1px 4px;
  border-radius: 3px;
}

.note {
  max-width: 620px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg);
  margin: 10px 0;
}

html.dark .note {
  border-color: #1e40af;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.option-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.option-block > label:first-child {
  font-size: 13px;
  font-weight: 600;
}

.option-help {
  max-width: 620px;
  text-align: left;
  font-size: 13px;
  line-height: 1.55;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}

.option-help .sample {
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.17;
  margin: 8px 0;
}

.sample-head {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.17;
  white-space: pre;
  text-align: center;
  margin: 12px 0;
  color: var(--muted);
}

/* ------------------------------------------------------------- test all */

#testAllProgress {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0;
}

.testall-item {
  margin: 0 0 22px;
}

.testall-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
  font-family: var(--mono);
}

.testall-pre {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.17;
  white-space: pre;
  margin: 0;
  overflow-x: auto;
  border-left: 2px solid var(--border);
  padding-left: 8px;
}

.footer {
  flex: 0 0 auto;
  padding: 8px 20px 14px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  background: #18181b;
  color: #fafafa;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.16s, transform 0.16s;
  pointer-events: none;
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 720px) {
  .topbar-card h1 .sub {
    display: none;
  }
  .tab-btn .full-label {
    display: none;
  }
  .tab-btn .only-small {
    display: inline;
  }
  .tabs {
    flex-direction: row;
    margin-left: 0;
  }
  .font-picker {
    width: 100%;
    max-width: none;
  }
  .panel {
    padding: 10px 12px 20px;
  }
}
