/* ==========================================================================
   CSS architecture map
   --------------------------------------------------------------------------
   This file still contains historical design passes. Current maintenance work
   should be staged: prefer comments, admin scoping, and final guards before
   deleting cross-media overrides. High-risk areas: brand header, mobile action
   bar, prompt output, privacy notices, legal pages, and admin visibility.

   Current sections:
   - Tokens and base reset
   - Layout and shell
   - Components and form controls
   - Historical design passes
   - First-run UX / accessibility helpers
   - Legal pages
   - Late product polish
   - Final production guards
   ========================================================================== */

/* Tokens and base reset */
:root {
  color-scheme: light;
  /* Base tokens. Later product-pass tokens intentionally refine this palette. */
  --brand-blue: #006d77;
  --brand-violet: #5b55c8;
  --brand-amber: #b86813;
  --brand-mint: #2f8f6f;
  --bg: #e8edf4;
  --surface: #ffffff;
  --surface-soft: #f2f6fb;
  --ink: #172033;
  --muted: #42526a;
  --line: #dadce0;
  --accent: #1a73e8;
  --accent-strong: #174ea6;
  --accent-soft: #e8f0fe;
  --danger: #b42318;
  --warning: #8a5a00;
  --shadow: 0 14px 34px rgba(23, 32, 51, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.055), transparent 34%),
    linear-gradient(315deg, rgba(255, 255, 255, 0.68), transparent 42%),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
  font-size: 16px;
}

input.uses-default,
textarea.uses-default {
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
}

input.uses-default::placeholder,
textarea.uses-default::placeholder {
  color: #64748b;
  opacity: 1;
}

.app-shell {
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.workspace {
  position: relative;
  min-height: calc(100vh - 48px);
  background: rgba(250, 252, 255, 0.96);
  border: 1px solid #b9c6d8;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.workspace::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--brand-blue) 0 25%,
    var(--brand-violet) 25% 50%,
    var(--brand-amber) 50% 75%,
    var(--brand-mint) 75% 100%
  );
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 252, 255, 0.96);
}

.eyebrow,
.label,
.section-title {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 4px 0 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 38px);
}

h2 {
  font-size: 21px;
}

.view-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f8;
}

/* Admin visibility button: final production guards decide whether it can appear. */
.admin-open-button {
  min-height: 34px;
  padding: 7px 10px;
  border-color: #dbe4f0;
  background: #f8fbff;
  color: #4b5f7a;
  font-size: 12px;
  opacity: 0.82;
  white-space: nowrap;
}

.admin-open-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  opacity: 1;
}

.output-jump-button {
  display: none;
  width: 100%;
}

.no-results {
  margin: 8px 0;
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.admin-lock-button {
  margin-top: 10px;
}

.admin-auth-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.admin-auth-modal.is-hidden {
  display: none;
}

.admin-auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
}

.admin-auth-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-auth-card h2 {
  margin: 0;
  font-size: 20px;
}

.admin-auth-card p {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.admin-auth-card label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}

.admin-auth-card input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
}

.admin-auth-error {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.admin-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.admin-auth-actions button {
  flex: 1 1 150px;
}

.detail-spec-panel {
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #f8fbff;
}

.detail-spec-panel.is-hidden {
  display: none;
}

.advanced-detail-fields {
  margin-top: 10px;
}

.detail-form-grid {
  margin-top: 10px;
}

.detail-form-grid input,
.detail-form-grid textarea {
  background: #fff;
}

.demo-badge {
  margin-left: auto;
  border: 2px solid #93c5fd;
  border-radius: 999px;
  padding: 6px 12px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 900;
}

.tab-button {
  min-width: 74px;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.tab-button.is-active {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.builder-layout {
  display: grid;
  grid-template-columns: 340px minmax(460px, 0.95fr) minmax(420px, 1.05fr);
  min-height: calc(100vh - 208px);
}

.admin-layout {
  display: grid;
  grid-template-columns: 300px minmax(560px, 1fr);
  min-height: calc(100vh - 142px);
}

.sidebar,
.editor,
.output,
.admin-editor {
  padding: 24px;
  outline: 1px solid rgba(217, 224, 217, 0.72);
  outline-offset: -1px;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}

.editor {
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.editor .panel-header {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid #dbe3ef;
}

.output,
.admin-editor {
  background: #fbfdff;
}

.search-box {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.search-box label {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.starter-guide {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  border: 2px solid #c7d2e3;
  border-radius: 8px;
  background: #ffffff;
}

.starter-guide ol {
  margin: 0;
  padding-left: 20px;
  color: #26364d;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 700;
}

.output-guide {
  margin: -6px 0 14px;
  background: #f8fbff;
}

.output-guide ol {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-left: 0;
  list-style: none;
  counter-reset: guide-step;
}

.output-guide li {
  counter-increment: guide-step;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #d7e0ec;
  border-radius: 8px;
  background: #ffffff;
  line-height: 1.35;
}

.output-guide li::before {
  content: counter(guide-step);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.shortcut-panel {
  margin-bottom: 16px;
}

.shortcut-heading {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 7px;
  margin-bottom: 8px;
  cursor: pointer;
  list-style: none;
}

.shortcut-heading::-webkit-details-marker,
.details-summary::-webkit-details-marker {
  display: none;
}

.shortcut-heading span {
  color: #26364d;
  font-size: 15px;
  font-weight: 800;
}

.shortcut-heading small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.shortcut-heading::before {
  content: "▸";
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-1px);
}

.shortcut-panel[open] .shortcut-heading::before {
  content: "▾";
}

.purpose-panel[open] .shortcut-heading::before {
  content: "▾";
}

.shortcut-list {
  display: grid;
  gap: 7px;
}

.shortcut-button {
  width: 100%;
  min-height: 40px;
  border: 2px solid #d7e0ec;
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.shortcut-button:hover,
.shortcut-button.is-active {
  border-color: var(--accent);
  background: #eff6ff;
}

.shortcut-button strong {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.shortcut-button span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.section-title {
  margin-bottom: 12px;
  color: #26364d;
  font-size: 15px;
}

.template-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 3px;
}

.category-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.category-button {
  min-height: 48px;
  border: 2px solid #d7e0ec;
  border-radius: 8px;
  padding: 7px 9px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.category-button[draggable="true"] {
  cursor: grab;
}

.category-button[draggable="true"]:active {
  cursor: grabbing;
}

.category-button strong {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.category-button span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.category-button:hover,
.category-button.is-active {
  border-color: var(--accent);
  background: #eff6ff;
}

.category-button.is-dragging {
  opacity: 0.58;
  transform: scale(0.98);
}

.category-button.is-drag-over {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.template-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 10px;
  padding-top: 10px;
  border-top: 2px solid #d9e2ee;
}

.template-heading h3 {
  margin: 2px 0 0;
  font-size: 16px;
  letter-spacing: 0;
}

.count-pill {
  flex: 0 0 auto;
  border: 2px solid #d9e2ee;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.template-button {
  width: 100%;
  display: grid;
  gap: 5px;
  text-align: left;
  border: 2px solid #d7e0ec;
  border-radius: 8px;
  padding: 13px;
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.template-button[draggable="true"] {
  cursor: grab;
}

.template-button[draggable="true"]:active {
  cursor: grabbing;
}

.template-button:hover,
.template-button.is-active {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.template-button strong {
  font-size: 15px;
}

.template-button span,
.template-button small {
  color: #4b5f7a;
  font-size: 13px;
  line-height: 1.5;
}

.template-button small {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.template-button small b {
  color: #94a3b8;
  font-size: 15px;
  letter-spacing: -1px;
}

.template-button.is-dragging {
  opacity: 0.55;
}

.template-button.is-drag-over {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.16);
}

.template-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.template-badges em {
  border: 1px solid #c7d2e3;
  border-radius: 999px;
  padding: 2px 7px;
  background: #ffffff;
  color: #334155;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.attachment-lead {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
  color: #1e3a8a;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.6;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-tools {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 168px;
}

.favorite-status {
  align-self: center;
  min-width: 0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
  text-align: right;
}

.builder-top {
  display: grid;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.demo-notice {
  margin: 7px 0 0;
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 800;
}

.intro-steps {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: intro-step;
}

.intro-steps li {
  counter-increment: intro-step;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid #d7e0ec;
  border-radius: 8px;
  background: #f8fbff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.intro-steps li::before {
  content: counter(intro-step);
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
}

.usage-help {
  position: relative;
  justify-self: end;
}

.usage-help > summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
}

.usage-help > summary::-webkit-details-marker {
  display: none;
}

.usage-help ul {
  position: absolute;
  right: 0;
  z-index: 10;
  width: 420px;
  max-width: min(420px, calc(100vw - 48px));
  margin: 8px 0 0;
  padding: 14px 18px 14px 30px;
  border: 2px solid #c7d2e3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(23, 32, 51, 0.14);
  color: #334155;
  font-size: 13px;
  line-height: 1.7;
}

.purpose-panel {
  margin: -4px 0 14px;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
}

.purpose-heading {
  cursor: pointer;
  align-items: center;
}

.purpose-heading small {
  display: inline;
  margin-top: 0;
  max-width: none;
  color: #64748b;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: normal;
}

.shortcut-heading small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.purpose-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.purpose-button {
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fbff;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.purpose-button:hover,
.purpose-button.is-active {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.12);
}

.purpose-button:active {
  transform: translateY(1px);
}

.purpose-button-wide {
  grid-column: 1 / -1;
}

.purpose-page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.purpose-page-links a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #d7e0ec;
  border-radius: 999px;
  padding: 5px 9px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  text-decoration: none;
}

.purpose-page-links a:hover,
.purpose-page-links a:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: #eff6ff;
}

.mode-panel {
  display: grid;
  grid-template-columns: minmax(430px, 480px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 0;
  width: min(1040px, 100%);
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid #d7e0ec;
  border-radius: 8px;
  background: var(--surface);
}

.mode-label {
  margin: 0 0 4px;
  color: #52637a;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.3;
}

.mode-help {
  margin: 0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  align-self: center;
}

.level-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr;
  gap: 6px;
  margin-top: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e8eef8;
}

.level-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
}

.level-button.is-active {
  background: var(--accent);
  color: #ffffff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.is-hidden {
  display: none !important;
}

.profile-hidden {
  display: none !important;
}

.icon-button {
  min-width: 40px;
  width: auto;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 20px;
  white-space: nowrap;
}

.text-icon-button {
  font-size: 15px;
  font-weight: 800;
  min-height: 40px;
  height: auto;
  max-width: 176px;
  white-space: normal;
}

.icon-button.is-active {
  border-color: #f1c96b;
  background: #fff8e6;
  color: #8a5a00;
}

.template-description {
  max-width: 560px;
  margin: 7px 0 0;
  color: #42526a;
  font-size: 13px;
  line-height: 1.55;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid > label,
.my-info-grid > label {
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 12px;
  border: 2px solid #cfd9e8;
  border-radius: 8px;
  background: #ffffff;
}

.form-grid label span {
  color: #334155;
  font-size: 15px;
  font-weight: 700;
}

.my-info-panel {
  margin-bottom: 14px;
  padding: 12px;
  border: 2px solid #d7e0ec;
  border-radius: 8px;
  background: #f8fbff;
}

.my-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.my-info-grid label span {
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.my-info-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.my-info-note {
  margin: 0 auto 0 0;
  color: #42526a;
  font-size: 12px;
  line-height: 1.6;
}

.my-info-toggle {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 2px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
}

.my-info-toggle small {
  display: block;
  color: #476282;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.template-type-line {
  display: grid;
  grid-template-columns: minmax(150px, 0.42fr) minmax(220px, 0.58fr);
  gap: 6px 12px;
  align-items: center;
  margin: 0 0 14px;
  padding: 11px 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.template-type-line > span {
  color: #1f2f46;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.template-type-line select {
  min-height: 42px;
  background: #fff;
}

.template-type-line small {
  grid-column: 1 / -1;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid #b8c5d8;
  border-radius: 8px;
  padding: 13px 14px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  min-height: 50px;
}

.custom-input {
  display: none;
  margin-top: 0;
  border-style: dashed;
  background: #f8fbff;
  min-height: 46px;
  padding: 10px 12px;
}

.custom-input.is-active {
  display: block;
}

select + .custom-input.is-active {
  margin-top: 3px;
}

textarea {
  resize: vertical;
  line-height: 1.75;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
}

button:focus {
  outline: none;
}

button:focus-visible,
.file-button:focus-visible,
.details-summary:focus-visible,
.shortcut-heading:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.control-band {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 2px solid #f1c96b;
  border-radius: 8px;
  background: #fff8e6;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--warning);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.switch-line input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.action-row,
.output-actions,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.example-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.output-actions {
  align-items: flex-end;
  justify-content: flex-end;
  margin: -8px 0 12px;
}

.generate-action-help {
  display: grid;
  gap: 5px;
  max-width: 360px;
}

.generate-action-help .primary-button {
  width: 100%;
  min-width: 180px;
}

.generate-action-help p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.save-area {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.save-status {
  min-width: 116px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.value-section {
  margin-top: 12px;
  padding: 10px;
  border: 2px solid #d7e0ec;
  border-radius: 8px;
  background: #ffffff;
}

.after-guide {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 11px;
  border: 2px solid #d7e0ec;
  border-radius: 8px;
  background: #f8fbff;
}

.after-guide ol {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: after-step;
}

.after-guide li {
  counter-increment: after-step;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid #d7e0ec;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.after-guide li::before {
  content: counter(after-step);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
}

.followup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.followup-chips button {
  min-height: 34px;
  border: 1px solid #c7d2e3;
  border-radius: 999px;
  padding: 0 12px;
  background: #ffffff;
  color: #1e3a8a;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.followup-chips button:hover {
  border-color: var(--accent);
  background: #eff6ff;
}

.followup-chips button:focus-visible {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.followup-area {
  padding-top: 2px;
}

.followup-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.followup-heading p:last-child {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.followup-copy-status {
  min-width: 86px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.5;
  text-align: right;
}

.details-summary {
  cursor: pointer;
  color: #26364d;
  font-size: 14px;
  font-weight: 800;
  list-style: none;
}

.details-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.details-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 7px;
  color: var(--accent-strong);
  font-size: 12px;
}

details[open] > .details-summary::before {
  content: "▾";
}

details[open] > .details-summary {
  margin-bottom: 10px;
}

.example-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.example-box {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.example-box h4 {
  margin: 0;
  color: #26364d;
  font-size: 12px;
}

.example-box p {
  margin: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.7;
}

.example-box pre {
  height: 180px;
  min-height: 160px;
  max-height: 260px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid #d7e0ec;
  border-radius: 8px;
  background: #f8fbff;
  color: #172033;
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 12.5px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 46px;
  min-width: 92px;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  border: 2px solid var(--accent);
  background: var(--surface);
  color: var(--accent-strong);
}

.compact-button {
  min-width: auto;
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 700;
}

.category-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: -2px 0 12px;
}

.admin-guide {
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-guide h2,
.admin-card h3 {
  margin: 3px 0 0;
  letter-spacing: 0;
}

.admin-guide p:last-child,
.card-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.admin-sections {
  display: grid;
  gap: 14px;
}

.admin-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.card-heading {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.card-heading > span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.history-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.compact-heading {
  margin: 0 0 10px;
  padding-top: 0;
  border-top: 0;
}

.history-list {
  display: grid;
  gap: 7px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.history-button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.history-delete {
  min-width: 58px;
  border: 1px solid #e5b6ae;
  border-radius: 8px;
  background: #fff1f0;
  color: var(--danger);
  cursor: pointer;
  font-weight: 800;
}

.history-button span {
  color: var(--muted);
  font-size: 11px;
}

.danger-button {
  border: 1px solid #e5b6ae;
  background: #fff1f0;
  color: var(--danger);
}

.copy-status {
  min-width: 78px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

pre {
  height: clamp(320px, 46vh, 520px);
  min-height: 320px;
  max-height: 520px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 2px solid #cfd9e8;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  line-height: 1.7;
}

#promptOutput {
  scrollbar-gutter: stable;
}

.hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.admin-storage-note {
  padding: 12px 14px;
  border: 2px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  color: #1e3a8a;
  font-weight: 700;
}

.admin-preview {
  height: 260px;
  min-height: 220px;
  max-height: 260px;
  border-width: 1px;
  background: #f8fbff;
  font-size: 12px;
}

.edit-tip {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 2px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 14px;
  line-height: 1.6;
}

/* Final product polish: keep the first view quiet and make the 3-step workflow obvious. */
.workspace {
  border-color: #dde6f2;
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}

.brand-block h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
}

.brand-logo {
  display: inline-flex;
  align-items: baseline;
  font-weight: 900;
}

.brand-logo-text {
  display: inline-flex;
  align-items: baseline;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-logo-text span {
  display: inline-block;
}

.brand-block p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.demo-badge {
  margin-left: 0;
  border-width: 1px;
  padding: 5px 10px;
  font-size: 12px;
}

.mode-panel {
  width: min(430px, 100%);
  min-height: 0;
  grid-template-columns: 160px minmax(150px, 1fr);
  gap: 10px;
  padding: 8px;
  border: 1px solid #d7e0ec;
  background: #f8fbff;
}

.level-buttons {
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 3px;
  border-color: #d7e0ec;
}

.level-button {
  min-height: 32px;
  font-size: 13px;
}

.mode-help {
  color: #52637a;
  font-size: 11px;
  text-align: left;
}

.view-tabs {
  border-color: #d7e0ec;
}

.tab-button {
  min-height: 36px;
  min-width: 68px;
  font-size: 13px;
}

.builder-layout {
  grid-template-columns: 320px minmax(430px, 0.98fr) minmax(420px, 1.02fr);
  min-height: calc(100vh - 92px);
}

.admin-layout {
  min-height: calc(100vh - 92px);
}

.sidebar,
.editor,
.output,
.admin-editor {
  padding: 18px;
  outline-color: #e3eaf4;
}

.column-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e4ebf5;
}

.column-heading > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
}

.column-heading h2 {
  margin: 0;
  font-size: 18px;
}

.column-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.search-box {
  margin-bottom: 12px;
}

.search-box label,
.section-title {
  font-size: 13px;
}

.purpose-panel {
  margin: 0 0 14px;
  padding: 11px;
  border-color: #d7e0ec;
  background: #ffffff;
}

.shortcut-heading {
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 7px;
}

.shortcut-heading span {
  font-size: 14px;
}

.shortcut-heading small {
  max-width: 260px;
  font-size: 11px;
}

.purpose-grid {
  gap: 7px;
}

.purpose-button {
  min-height: 38px;
  border-color: #d7e0ec;
  background: #fbfdff;
  text-align: left;
}

.purpose-button.is-active {
  border-color: var(--accent);
  background: #eaf2ff;
  color: #1d4ed8;
}

.category-list {
  gap: 6px;
  margin-bottom: 12px;
}

.category-button {
  min-height: 36px;
  border-width: 1px;
  padding: 6px 8px;
}

.category-button strong {
  font-size: 12px;
}

.category-button span {
  display: none;
}

.template-heading {
  margin-top: 8px;
  border-top: 1px solid #e4ebf5;
}

.template-list {
  gap: 7px;
  max-height: 430px;
  margin-bottom: 14px;
}

.template-button {
  gap: 4px;
  border-width: 1px;
  padding: 10px;
}

.template-button strong {
  font-size: 14px;
}

.template-button span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  font-size: 12px;
  line-height: 1.45;
}

.template-button small {
  display: none;
}

.template-badges em {
  padding: 1px 6px;
  font-size: 10px;
}

.panel-header {
  margin-bottom: 14px;
  padding-bottom: 0;
  border-bottom: 0;
}

.editor .panel-header {
  border-bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.editor .favorite-status {
  grid-column: 1 / -1;
}

.template-description {
  max-width: none;
  font-size: 12px;
}

.my-info-panel {
  border-width: 1px;
  background: #fbfdff;
}

.my-info-panel.is-mail-mode {
  border-color: #93c5fd;
  background: #f5f9ff;
}

.form-grid {
  gap: 16px;
}

.form-grid > label,
.my-info-grid > label {
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}

.form-grid label[data-field="goal"],
.form-grid label[data-field="source"],
.form-grid label[data-field="replyIntent"],
.form-grid label[data-field="constraints"] {
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
}

input,
select,
textarea {
  min-height: 46px;
  border-width: 1px;
  border-color: #cdd8e7;
  padding: 11px 12px;
}

input.uses-default,
textarea.uses-default {
  background: #f8fafc;
  color: #8a97aa;
  border-color: #e0e7f0;
}

.control-band {
  border-width: 1px;
}

.output .panel-header {
  margin-bottom: 10px;
}

.output-actions {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}

.ai-service-links {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 44px;
  margin-left: auto;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
}

.ai-service-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #d7e0ec;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-strong);
  text-decoration: none;
  font-size: 12px;
  font-weight: 850;
}

.ai-service-links a:hover,
.ai-service-links a:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.generate-action-help {
  max-width: none;
}

.generate-action-help p {
  font-size: 11px;
}

.primary-button,
.secondary-button,
.danger-button,
.file-button {
  min-height: 44px;
  border-radius: 8px;
  max-width: 100%;
  white-space: normal;
  line-height: 1.25;
  text-align: center;
}

.secondary-button,
.file-button {
  border-width: 1px;
}

#promptOutput {
  height: clamp(430px, 58vh, 680px);
  min-height: 430px;
  max-height: 680px;
  border-width: 1px;
  background: #ffffff;
  font-size: 13px;
  box-shadow: inset 0 1px 0 rgba(37, 99, 235, 0.04);
}

.copy-status {
  max-width: 240px;
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1.45;
}

.after-guide,
.phrasebook-panel,
.value-section,
.history-panel {
  margin-top: 10px;
  padding: 10px 11px;
  border-width: 1px;
  background: #ffffff;
}

.after-guide[open] {
  background: #f8fbff;
}

.phrasebook-panel[open] {
  background: #fbfdff;
}

.after-guide ol {
  grid-template-columns: 1fr;
}

.after-guide li {
  min-height: 30px;
}

.followup-chips {
  gap: 7px;
}

.followup-chips button {
  min-height: 32px;
  max-width: 100%;
  white-space: normal;
  text-align: center;
}

.admin-action-group,
.danger-zone {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
}

.danger-zone {
  border-color: #f1c4bd;
  background: #fff8f7;
}

.danger-zone p:not(.section-title) {
  margin: 6px 0 0;
  color: #8f2a20;
  font-size: 12px;
  line-height: 1.6;
}

.admin-action-group .admin-actions,
.danger-zone .admin-actions {
  margin-top: 10px;
}

.admin-actions {
  align-items: stretch;
}

.admin-actions .secondary-button,
.admin-actions .danger-button,
.admin-actions .file-button {
  flex: 1 1 118px;
  min-width: 0;
  padding-inline: 12px;
}

#exportLibraryButton {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 900;
}

/* Typography pass: align text hierarchy, paragraph rhythm, and wrapping across the app. */
body {
  font-size: 15px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font-size: 15px;
  line-height: 1.45;
}

.label,
.section-title {
  color: #52637a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.brand-block h1 {
  font-size: clamp(24px, 2.3vw, 30px);
  font-weight: 900;
  line-height: 1.15;
}

.brand-block p,
.mode-help,
.hint,
.template-description,
.details-note,
.my-info-note,
.followup-heading p:last-child,
.admin-guide p:last-child,
.card-heading p,
.danger-zone p:not(.section-title),
.edit-tip,
.admin-storage-note {
  max-width: 68ch;
  color: #5a6b82;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.column-heading {
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 15px;
  padding-bottom: 12px;
}

.column-heading > span {
  flex: 0 0 auto;
  margin-top: 1px;
}

.column-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
}

.column-heading p {
  margin: 5px 0 0;
  max-width: 46ch;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.search-box label,
.form-grid label span,
.my-info-grid label span {
  color: #2f3f55;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.shortcut-heading {
  align-items: flex-start;
  margin-bottom: 9px;
}

.shortcut-heading span,
.details-summary {
  color: #26364d;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.4;
}

.shortcut-heading small {
  margin-top: 4px;
  max-width: 30ch;
  color: #6b7b91;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.purpose-button {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.category-button {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 68px;
  line-height: 1.35;
}

.category-button strong {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.category-button span {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.category-button em {
  color: #7a8aa0;
  font-size: 10px;
  font-style: normal;
  font-weight: 750;
  line-height: 1.2;
}

.template-heading {
  align-items: flex-start;
}

.template-heading h3 {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.3;
}

.template-button {
  gap: 6px;
  padding: 10px 11px;
}

.template-button strong {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.template-button span {
  -webkit-line-clamp: 2;
  color: #52637a;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
}

.template-button small {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.template-badges {
  margin-top: 1px;
}

.template-badges em {
  color: #52637a;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.35;
}

.panel-header {
  gap: 12px;
}

.panel-header h2 {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
}

.template-description {
  margin-top: 6px;
}

.favorite-status,
.copy-status,
.followup-copy-status,
.save-status {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.my-info-panel {
  padding: 11px 12px;
}

.details-note {
  margin: 4px 0 10px 19px;
}

.my-info-note {
  margin-right: auto;
}

.my-info-toggle {
  align-items: flex-start;
}

.my-info-toggle span {
  line-height: 1.35;
}

.my-info-toggle small {
  margin-top: 3px;
  color: #64748b;
  font-weight: 600;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
  color: #8a97aa;
  opacity: 1;
}

textarea {
  line-height: 1.65;
}

.primary-button,
.secondary-button,
.danger-button,
.file-button,
.tab-button,
.level-button,
.compact-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.compact-button,
.icon-button {
  font-size: 12px;
}

.level-button,
.tab-button {
  font-size: 13px;
}

.mode-panel {
  align-items: center;
}

.mode-help {
  margin: 0;
  max-width: 32ch;
  line-height: 1.45;
}

#promptOutput,
pre {
  font-size: 13.5px;
  line-height: 1.75;
}

.after-guide ol {
  gap: 8px;
  margin-top: 4px;
}

.after-guide li {
  align-items: flex-start;
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.55;
}

.after-guide li::before {
  margin-top: 1px;
}

.followup-area {
  margin-top: 10px;
}

.followup-heading {
  align-items: flex-start;
}

.followup-heading .label {
  margin-bottom: 4px;
}

.followup-chips {
  gap: 8px;
}

.followup-chips button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.example-box h4 {
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}

.example-box p {
  font-size: 12px;
  line-height: 1.6;
}

.example-box pre,
.admin-preview {
  font-size: 12px;
  line-height: 1.6;
}

.admin-guide h2,
.admin-card h3 {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.35;
}

.card-heading {
  align-items: flex-start;
}

.card-heading > span {
  flex: 0 0 auto;
  margin-top: 1px;
}

.admin-action-group,
.danger-zone,
.admin-storage-note,
.edit-tip {
  line-height: 1.6;
}

/* Final UI review: reduce visual noise while keeping level, type, detail, lead, and output connected. */
.topbar {
  grid-template-columns: minmax(260px, 1fr) auto minmax(330px, 430px) auto auto;
  gap: 10px;
}

.usage-help ul {
  max-width: min(420px, calc(100vw - 32px));
}

.mode-panel {
  justify-self: end;
  grid-template-columns: minmax(150px, 168px) minmax(120px, 1fr);
  border: 1px solid #d7e0ec;
  box-shadow: none;
}

.mode-help {
  color: #41536a;
  font-weight: 750;
}

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

.purpose-button {
  justify-content: flex-start;
  min-height: 40px;
  text-align: left;
  overflow-wrap: anywhere;
}

.purpose-heading {
  align-items: center;
  gap: 6px;
}

.purpose-heading small {
  display: inline;
  margin-top: 0;
  max-width: none;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
  overflow-wrap: normal;
}

.category-button {
  min-height: 64px;
  padding: 8px 9px;
}

.category-button em {
  justify-self: end;
}

.template-list {
  max-height: min(46vh, 440px);
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.template-button {
  position: relative;
  padding-right: 34px;
}

.template-button[data-scope="builder"] {
  padding-right: 12px;
}

.template-button > span {
  -webkit-line-clamp: 2;
}

.template-button small {
  display: block;
  min-height: 14px;
  color: #728196;
  font-size: 10px;
}

.template-button small span {
  display: inline;
  color: inherit;
  font-size: inherit;
  font-weight: 750;
  line-height: 1.2;
}

.template-button small b {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 15px;
  letter-spacing: -2px;
}

.template-button.is-active small b,
.template-button:hover small b {
  color: var(--accent);
}

.template-type-line {
  grid-template-columns: minmax(128px, 0.34fr) minmax(0, 0.66fr);
  align-items: center;
  margin: 0 0 14px;
  padding: 13px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--accent);
  background: #f8fbff;
}

.template-type-line > span {
  color: #1e3a8a;
  font-size: 14px;
  font-weight: 900;
}

.template-type-line select {
  min-width: 0;
  font-weight: 800;
}

.template-type-line small {
  grid-column: 1 / -1;
  margin: 0 0 0 calc(34% + 8px);
  color: #52637a;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.55;
}

.selected-type-summary {
  display: block;
  color: #1d4ed8 !important;
}

.detail-spec-panel {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #fbfdff;
}

.detail-spec-panel .template-type-line {
  margin-bottom: 8px;
  border-color: #d7e0ec;
  border-left-color: #60a5fa;
  background: #ffffff;
}

.detail-type-note {
  margin: 2px 0 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.55;
}

.advanced-detail-fields {
  margin-top: 8px;
}

.detail-form-grid {
  gap: 12px 14px;
  margin-top: 12px;
}

.detail-group-title {
  grid-column: 1 / -1;
  margin: 4px 0 -4px;
  padding-top: 8px;
  border-top: 1px solid #e4ebf5;
  color: #41536a;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.detail-group-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.attachment-lead {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #60a5fa;
  border-radius: 8px;
  background: #f8fbff;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.6;
}

#promptOutput {
  border-color: #cdd8e7;
  line-height: 1.72;
}

.admin-guide {
  border-left: 4px solid var(--accent);
}

.admin-guide .label {
  color: #1d4ed8;
}

.admin-catalog-note,
.admin-lock-note {
  margin: 8px 0 10px;
  padding: 9px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
  color: #1e3a8a !important;
}

.admin-lock-note {
  border-color: #e5e7eb;
  background: #f9fafb;
  color: #475569 !important;
}

.admin-auth-card {
  border: 1px solid #dbe3ef;
}

.admin-auth-actions {
  gap: 10px;
}

.phrasebook-panel {
  margin-top: 10px;
  padding: 10px 11px;
  border: 1px solid #d7e0ec;
  border-radius: 8px;
  background: #ffffff;
}

.phrasebook-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
}

.phrasebook-heading h3 {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.3;
}

.phrasebook-copy-status {
  min-width: 92px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.5;
  text-align: right;
}

.phrasebook-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.phrasebook-guide div {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 36px;
  padding: 7px 8px;
  border: 1px solid #d7e0ec;
  border-radius: 8px;
  background: #ffffff;
}

.phrasebook-guide b {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  line-height: 1;
}

.phrasebook-guide span {
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.phrasebook-list {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.phrasebook-group {
  border: 1px solid #d7e0ec;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.phrasebook-group-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  cursor: pointer;
  list-style: none;
}

.phrasebook-group-summary::-webkit-details-marker {
  display: none;
}

.phrasebook-group-summary::before {
  content: "▸";
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.phrasebook-group[open] > .phrasebook-group-summary::before {
  content: "▾";
}

.phrasebook-group-summary span {
  flex: 1 1 auto;
  min-width: 0;
}

.phrasebook-group-summary strong {
  display: block;
  color: #26364d;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}

.phrasebook-group-summary small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.phrasebook-group-summary em {
  flex: 0 0 auto;
  border: 1px solid #d7e0ec;
  border-radius: 999px;
  padding: 2px 7px;
  background: #f8fbff;
  color: #52637a;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  line-height: 1.35;
}

.phrasebook-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 8px;
  padding: 0 10px 10px;
}

.phrasebook-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #d7e0ec;
  border-radius: 8px;
  background: #fbfdff;
}

.phrasebook-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.phrasebook-card strong {
  color: #26364d;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}

.phrasebook-copy-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11px;
}

.phrasebook-phrase,
.phrasebook-effect,
.phrasebook-when {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.phrasebook-phrase {
  padding: 8px 9px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  color: #1e3a8a;
  font-weight: 750;
}

.phrasebook-effect {
  color: #41536a;
  font-weight: 650;
}

.phrasebook-when {
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
}

@media (max-width: 1220px) {
  .topbar {
    grid-template-columns: minmax(240px, 1fr) auto auto;
  }

  .mode-panel {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }

  .mode-help {
    white-space: normal;
  }

  .builder-layout {
    grid-template-columns: 300px 1fr;
  }

  .output {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  pre {
    height: clamp(300px, 42vh, 460px);
    min-height: 300px;
    max-height: 460px;
  }
}

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

  .workspace {
    min-height: calc(100vh - 24px);
  }

  .topbar {
    align-items: flex-start;
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .brand-block h1 {
    font-size: 24px;
  }

  .brand-block p,
  .column-heading p,
  .mode-help,
  .hint,
  .template-description,
  .details-note,
  .my-info-note,
  .followup-heading p:last-child,
  .admin-guide p:last-child,
  .card-heading p,
  .danger-zone p:not(.section-title),
  .edit-tip,
  .admin-storage-note {
    max-width: none;
  }

  .column-heading {
    margin-bottom: 14px;
  }

  .purpose-button {
    min-height: 40px;
  }

  .purpose-heading small {
    white-space: normal;
  }

  .view-tabs {
    width: 100%;
  }

  .tab-button {
    flex: 1;
  }

  .builder-layout,
  .admin-layout,
  .form-grid,
  .my-info-grid,
  .template-type-line,
  .mode-panel {
    grid-template-columns: 1fr;
  }

  .template-type-line small {
    margin-left: 0;
  }

  .detail-form-grid {
    grid-template-columns: 1fr;
  }

  .builder-top {
    padding: 16px 20px;
  }

  .purpose-panel,
  .intro-steps {
    grid-template-columns: 1fr;
  }

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

  .usage-help {
    justify-self: stretch;
  }

  .usage-help ul {
    position: static;
    width: auto;
  }

  .category-list {
    grid-template-columns: 1fr;
  }

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

  .output-guide ol {
    grid-template-columns: 1fr;
  }

  .after-guide ol {
    grid-template-columns: 1fr;
  }

  .my-info-actions {
    align-items: stretch;
    flex-direction: column;
  }

  pre {
    height: 320px;
    min-height: 320px;
    max-height: 320px;
  }

  .sidebar,
  .editor {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar,
  .editor,
  .output,
  .admin-editor {
    padding: 20px;
  }

  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
    min-width: 0;
  }

  .editor .panel-header {
    grid-template-columns: 1fr;
  }

  .output-actions,
  .followup-heading,
  .phrasebook-heading {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .phrasebook-guide,
  .phrasebook-card-grid {
    grid-template-columns: 1fr;
  }

  .ai-service-links {
    justify-content: flex-start;
    min-height: 0;
  }

  .output-jump-button {
    display: block;
    margin-top: 16px;
  }

  .generate-action-help {
    max-width: none;
  }

  .followup-copy-status {
    min-width: 0;
    text-align: left;
  }

  .template-description {
    max-width: none;
  }
}

select option {
  background: #ffffff;
  color: var(--ink);
}

/* Historical design pass: design tokens, layout, and component system.
   Token overrides below are intentionally left in cascade order for this stage. */
:root {
  color-scheme: light;
  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-soft: #f6f8f5;
  --surface-tint: #f0f6f4;
  --ink: #1d211f;
  --muted: #616d67;
  --muted-strong: #424d48;
  --line: #d9e0db;
  --line-strong: #bac8c0;
  --accent: #006d77;
  --accent-strong: #004d56;
  --accent-soft: #e2f3f1;
  --accent-2: #5b55c8;
  --accent-2-soft: #ecebff;
  --accent-3: #b86813;
  --accent-3-soft: #fff1df;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --warning: #855300;
  --focus: #f6b73c;
  --topbar: #151a17;
  --topbar-2: #21302d;
  --topbar-text: #f8fbf7;
  --topbar-muted: #c8d3cd;
  --shadow: 0 24px 70px rgba(29, 33, 31, 0.15);
  --shadow-soft: 0 12px 32px rgba(29, 33, 31, 0.09);
  --inner-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

* {
  letter-spacing: 0;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  font-size: 15px;
  line-height: 1.62;
  background:
    linear-gradient(135deg, rgba(0, 109, 119, 0.1) 0 20%, transparent 20% 100%),
    linear-gradient(315deg, rgba(91, 85, 200, 0.09) 0 18%, transparent 18% 100%),
    repeating-linear-gradient(90deg, rgba(29, 33, 31, 0.035) 0 1px, transparent 1px 82px),
    repeating-linear-gradient(0deg, rgba(29, 33, 31, 0.028) 0 1px, transparent 1px 82px),
    var(--bg);
  color: var(--ink);
}

body,
button,
input,
select,
textarea {
  font-family: "Segoe UI", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

button,
input,
select,
textarea {
  font-size: 15px;
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: anywhere;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  transform: translateY(-150%);
  border: 2px solid var(--focus);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--topbar);
  color: #ffffff;
  font-weight: 900;
  text-decoration: none;
  transition: transform 0.18s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1560px, 100%);
  padding: 20px;
}

.workspace {
  min-height: calc(100vh - 40px);
  border: 1px solid rgba(103, 118, 110, 0.34);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace::before {
  height: 6px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 52%, var(--accent-3) 100%);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto minmax(360px, 450px) auto auto;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 36%),
    linear-gradient(120deg, var(--topbar) 0%, var(--topbar-2) 58%, #10383d 100%);
  color: var(--topbar-text);
}

.brand-block {
  min-width: 0;
}

.brand-logo,
.brand-block h1 {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  margin: 0;
  color: var(--topbar-text);
  font-size: 28px;
  font-weight: 950;
  line-height: 1.1;
}

.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), transparent 34%),
    conic-gradient(from 210deg, var(--accent-3), var(--accent), var(--accent-2), var(--accent-3));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-left-color: transparent;
  border-radius: 6px;
}

.brand-logo-text {
  display: block;
  min-width: 0;
  color: var(--topbar-text);
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.brand-block p {
  margin: 6px 0 0;
  max-width: 56ch;
  color: var(--topbar-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.demo-badge {
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff4df;
}

.usage-help {
  justify-self: end;
}

.usage-help > summary.secondary-button {
  min-height: 40px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--topbar-text);
}

.usage-help > summary.secondary-button:hover,
.usage-help[open] > summary.secondary-button {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
}

.usage-help ul {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
}

.mode-panel {
  justify-self: stretch;
  grid-template-columns: minmax(170px, 190px) minmax(0, 1fr);
  min-height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.level-buttons {
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.level-button {
  min-height: 34px;
  border-radius: 6px;
  color: var(--topbar-muted);
  font-size: 12px;
  font-weight: 900;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.level-button:hover {
  color: #ffffff;
}

.level-button.is-active {
  background: #ffffff;
  color: var(--accent-strong);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.mode-help {
  display: none !important;
}

.view-tabs {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.tab-button {
  min-height: 38px;
  border-radius: 6px;
  color: var(--topbar-muted);
  font-size: 13px;
  font-weight: 900;
}

.tab-button:hover {
  color: #ffffff;
}

.tab-button.is-active {
  background: #ffffff;
  color: var(--accent-strong);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

.admin-open-button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--topbar-text);
  opacity: 1;
}

.admin-open-button:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(286px, 330px) minmax(430px, 1fr) minmax(430px, 1.02fr);
  gap: 1px;
  min-height: calc(100vh - 112px);
  background: var(--line);
}

.admin-layout {
  grid-template-columns: minmax(286px, 340px) minmax(560px, 1fr);
  gap: 1px;
  min-height: calc(100vh - 112px);
  background: var(--line);
}

.sidebar,
.editor,
.output,
.admin-editor {
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 22px;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(0, 109, 119, 0.065), transparent 220px),
    var(--surface-soft);
}

.editor,
.admin-editor {
  background: var(--surface);
}

.output {
  background:
    linear-gradient(180deg, rgba(91, 85, 200, 0.055), transparent 260px),
    #fbfcfb;
}

.column-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding: 0;
  border: 0;
}

.column-heading > span {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-top: 1px;
  border: 1px solid rgba(0, 109, 119, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #10848d);
  color: #ffffff;
  font-size: 14px;
  font-weight: 950;
  box-shadow: 0 10px 22px rgba(0, 109, 119, 0.18);
}

.column-heading h2,
.panel-header h2,
.template-heading h3,
.phrasebook-heading h3,
.admin-guide h2,
.admin-card h3 {
  color: var(--ink);
  font-weight: 950;
}

.column-heading h2 {
  font-size: 18px;
  line-height: 1.3;
}

.column-heading p {
  max-width: 44ch;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.62;
}

.label,
.section-title {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  text-transform: uppercase;
}

.search-box {
  gap: 8px;
  margin-bottom: 16px;
}

.search-control {
  position: relative;
}

.search-control input {
  padding-right: 46px;
}

.search-clear-button {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 16px;
  font-weight: 950;
  line-height: 1;
  transform: translateY(-50%);
}

.search-clear-button:hover {
  border-color: rgba(0, 109, 119, 0.42);
  color: var(--accent-strong);
}

.search-box label,
.form-grid label span,
.my-info-grid label span {
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 900;
}

input,
select,
textarea {
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 12px 13px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--inner-shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
  line-height: 1.72;
}

input::placeholder,
textarea::placeholder {
  color: #7a8781;
}

input.uses-default,
textarea.uses-default {
  border-color: #dce4df;
  background: #f8faf8;
  color: #7a8781;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 109, 119, 0.14), var(--inner-shadow);
}

button:focus-visible,
.file-button:focus-visible,
.details-summary:focus-visible,
.shortcut-heading:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(246, 183, 60, 0.72);
  outline-offset: 2px;
}

.purpose-panel,
.my-info-panel,
.detail-spec-panel,
.after-guide,
.phrasebook-panel,
.value-section,
.history-panel,
.admin-card,
.admin-action-group,
.danger-zone {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--inner-shadow);
}

.purpose-panel {
  margin: 0 0 16px;
  padding: 12px;
}

.shortcut-heading,
.details-summary {
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
}

.shortcut-heading::before,
.details-summary::before,
.phrasebook-group-summary::before {
  color: var(--accent);
}

.purpose-heading {
  align-items: center;
}

.purpose-heading small,
.shortcut-heading small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.purpose-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.purpose-button,
.category-button,
.template-button,
.shortcut-button,
.history-button,
.followup-chips button,
.ai-service-links a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--inner-shadow);
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.purpose-button {
  justify-content: flex-start;
  gap: 8px;
  min-height: 42px;
  padding: 9px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 900;
}

.purpose-button::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(184, 104, 19, 0.12);
}

.purpose-button:hover,
.purpose-button.is-active,
.category-button:hover,
.category-button.is-active,
.template-button:hover,
.template-button.is-active,
.shortcut-button:hover,
.shortcut-button.is-active,
.history-button:hover,
.followup-chips button:hover,
.ai-service-links a:hover,
.ai-service-links a:focus-visible {
  border-color: rgba(0, 109, 119, 0.48);
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: 0 10px 24px rgba(0, 109, 119, 0.1), var(--inner-shadow);
  transform: translateY(-1px);
}

.purpose-button.is-active::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 109, 119, 0.16);
}

.category-list {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.category-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
  gap: 4px 10px;
  padding: 10px 11px;
}

.category-button strong {
  grid-column: 1 / 2;
  justify-self: start;
  color: inherit;
  font-size: 13px;
  font-weight: 950;
}

.category-button span {
  display: block;
  grid-column: 1 / 2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.42;
}

.category-button em,
.count-pill,
.template-badges em,
.phrasebook-group-summary em {
  border: 1px solid rgba(0, 109, 119, 0.16);
  border-radius: 8px;
  background: #f8fbf9;
  color: var(--muted-strong);
  font-style: normal;
  font-weight: 900;
}

.category-button em {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  justify-self: end;
  padding: 4px 7px;
  font-size: 10px;
}

.template-heading {
  align-items: flex-start;
  margin: 12px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.template-heading h3 {
  margin-top: 3px;
  font-size: 16px;
}

.count-pill {
  padding: 5px 8px;
  font-size: 11px;
}

.template-list {
  gap: 8px;
  max-height: min(44vh, 480px);
  padding-right: 5px;
  scrollbar-gutter: stable;
}

.template-button {
  position: relative;
  gap: 7px;
  padding: 12px;
}

.template-button strong {
  color: inherit;
  font-size: 14px;
  font-weight: 950;
  line-height: 1.35;
}

.template-button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.55;
}

.template-button small {
  color: #6f7e77;
  font-size: 10px;
  font-weight: 800;
}

.template-badges {
  gap: 5px;
}

.template-badges em {
  padding: 2px 6px;
  font-size: 10px;
  line-height: 1.3;
}

.panel-header {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.editor .panel-header {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfcfb);
}

.panel-header h2 {
  margin: 3px 0 0;
  font-size: 19px;
  line-height: 1.3;
}

.template-description {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.panel-tools {
  gap: 8px;
}

.icon-button {
  min-width: 40px;
  min-height: 40px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent-strong);
  box-shadow: var(--inner-shadow);
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.icon-button:hover {
  border-color: rgba(0, 109, 119, 0.46);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.icon-button.is-active {
  border-color: rgba(184, 104, 19, 0.38);
  background: var(--accent-3-soft);
  color: var(--warning);
}

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

.form-grid > label,
.my-info-grid > label {
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
  box-shadow: var(--inner-shadow);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.form-grid > label:focus-within,
.my-info-grid > label:focus-within {
  border-color: rgba(0, 109, 119, 0.52);
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(0, 109, 119, 0.08), var(--inner-shadow);
}

.form-grid label[data-field="goal"],
.form-grid label[data-field="source"],
.form-grid label[data-field="replyIntent"],
.form-grid label[data-field="constraints"] {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.wide {
  grid-column: 1 / -1;
}

.template-type-line {
  grid-template-columns: minmax(132px, 0.32fr) minmax(0, 0.68fr);
  gap: 8px 12px;
  margin-bottom: 16px;
  border: 1px solid rgba(0, 109, 119, 0.28);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(0, 109, 119, 0.08), #ffffff 52%);
}

.template-type-line > span {
  color: var(--accent-strong);
}

.template-type-line small {
  color: var(--muted);
}

.detail-spec-panel {
  padding: 13px;
  background: linear-gradient(180deg, #ffffff, #f8fbf9);
}

.detail-group-title {
  border-top: 1px solid var(--line);
  color: var(--accent-strong);
}

.control-band {
  border: 1px solid rgba(184, 104, 19, 0.24);
  border-radius: 8px;
  background: var(--accent-3-soft);
}

.switch-line {
  color: #5f400d;
  font-weight: 850;
}

.switch-line input {
  accent-color: var(--accent);
}

.primary-button,
.secondary-button,
.danger-button,
.file-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 10px 15px;
  font-weight: 950;
  line-height: 1.3;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.primary-button {
  border: 1px solid rgba(0, 77, 86, 0.2);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(0, 109, 119, 0.23);
}

.primary-button:hover {
  background: linear-gradient(135deg, #087b85, #003f46);
  box-shadow: 0 18px 36px rgba(0, 109, 119, 0.28);
  transform: translateY(-1px);
}

.secondary-button,
.file-button {
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--accent-strong);
  box-shadow: var(--inner-shadow);
}

.secondary-button:hover,
.file-button:hover {
  border-color: rgba(0, 109, 119, 0.42);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.danger-button {
  border: 1px solid rgba(180, 35, 24, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-button:hover {
  background: #ffe2dc;
  transform: translateY(-1px);
}

.output .panel-header {
  margin-bottom: 12px;
}

.output-actions {
  align-items: stretch;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}

#copyButton {
  min-width: 148px;
}

.ai-service-links {
  justify-content: flex-end;
  gap: 7px;
  min-height: 44px;
  color: var(--muted);
}

.ai-service-links a {
  min-height: 34px;
  padding: 0 11px;
  background: #ffffff;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 950;
  text-decoration: none;
}

.attachment-lead {
  border: 1px solid rgba(91, 85, 200, 0.22);
  border-left: 5px solid var(--accent-2);
  background: var(--accent-2-soft);
  color: #343082;
}

#promptOutput,
pre {
  font-family: Consolas, "Cascadia Mono", "SFMono-Regular", "Yu Gothic UI", monospace;
  font-size: 13px;
  line-height: 1.76;
}

#promptOutput {
  height: clamp(440px, 56vh, 720px);
  min-height: 440px;
  max-height: 720px;
  border: 1px solid var(--line-strong);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 16px 17px;
  background:
    linear-gradient(90deg, rgba(0, 109, 119, 0.055), transparent 28px),
    #fefffe;
  color: #1b2420;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 12px 30px rgba(29, 33, 31, 0.07);
  white-space: pre-wrap;
}

.copy-status,
.favorite-status,
.draft-status,
.followup-copy-status,
.phrasebook-copy-status,
.save-status {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.draft-status {
  grid-column: 1 / -1;
  min-height: 18px;
  color: var(--muted);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none !important;
}

button[aria-busy="true"] {
  cursor: wait;
}

.primary-button:disabled {
  border-color: #d8e2de;
  background: #edf4f2;
  color: #667570;
  box-shadow: none;
}

.mobile-action-bar {
  display: none;
}

.after-guide,
.phrasebook-panel,
.value-section,
.history-panel {
  margin-top: 12px;
  padding: 12px;
}

.after-guide[open],
.phrasebook-panel[open] {
  background: #ffffff;
}

.after-guide ol {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.after-guide li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted-strong);
}

.after-guide li::before,
.phrasebook-guide b {
  background: var(--accent);
}

.followup-chips button {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 850;
}

.phrasebook-guide {
  gap: 8px;
}

.phrasebook-guide div,
.phrasebook-group,
.phrasebook-card,
.example-box,
.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.phrasebook-group-summary strong,
.phrasebook-card strong {
  color: var(--ink);
}

.phrasebook-phrase {
  border: 1px solid rgba(0, 109, 119, 0.18);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.phrasebook-effect {
  color: var(--muted-strong);
}

.phrasebook-when {
  color: var(--muted);
}

.example-box {
  box-shadow: var(--inner-shadow);
}

.example-box pre,
.admin-preview {
  border-color: var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
}

.my-info-panel {
  background: #fbfcfb;
}

.my-info-panel.is-mail-mode {
  border-color: rgba(0, 109, 119, 0.3);
  background: var(--accent-soft);
}

.my-info-toggle {
  border: 1px solid rgba(0, 109, 119, 0.22);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.admin-guide,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--inner-shadow);
}

.admin-guide {
  border-left: 5px solid var(--accent);
}

.card-heading > span {
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.admin-catalog-note,
.admin-lock-note {
  border-radius: 8px;
}

.danger-zone {
  border-color: rgba(180, 35, 24, 0.24);
  background: var(--danger-soft);
}

.admin-auth-modal {
  backdrop-filter: blur(8px);
}

.admin-auth-backdrop {
  background: rgba(21, 26, 23, 0.54);
}

.admin-auth-card {
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: #edf2ef;
}

::-webkit-scrollbar-thumb {
  border: 2px solid #edf2ef;
  border-radius: 8px;
  background: #9aa9a1;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

@media (min-width: 1221px) {
  .sidebar,
  .editor,
  .output,
  .admin-editor {
    max-height: calc(100vh - 112px);
    overflow: auto;
    scrollbar-gutter: stable;
  }
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: minmax(240px, 1fr) auto auto;
  }

  body.is-admin-mode .admin-open-button {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    width: auto;
  }

  .mode-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  }

  .builder-layout {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  }

  .output {
    grid-column: 1 / -1;
  }

  .after-guide ol {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  html {
    scroll-behavior: auto;
  }

  .app-shell {
    padding: 10px;
  }

  .workspace {
    min-height: calc(100vh - 20px);
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 18px;
  }

  .brand-logo,
  .brand-block h1 {
    font-size: 24px;
  }

  .brand-logo-text {
    white-space: normal;
  }

  .usage-help,
  .mode-panel {
    justify-self: stretch;
    width: 100%;
    min-width: 0;
  }

  .usage-help ul {
    position: static;
    width: auto;
    max-width: none;
  }

  .mode-panel,
  .builder-layout,
  .admin-layout,
  .form-grid,
  .my-info-grid,
  .template-type-line {
    grid-template-columns: 1fr;
  }

  .view-tabs {
    width: 100%;
    min-width: 0;
  }

  .tab-button {
    flex: 1;
    min-width: 0;
    white-space: normal;
  }

  .sidebar,
  .editor,
  .output,
  .admin-editor {
    max-height: none;
    overflow: visible;
    padding: 18px;
  }

  .builder-layout,
  .admin-layout {
    min-height: 0;
  }

  .category-list,
  .purpose-grid,
  .phrasebook-guide,
  .phrasebook-card-grid,
  .example-grid,
  .after-guide ol {
    grid-template-columns: 1fr;
  }

  .editor .panel-header,
  .panel-header,
  .output-actions,
  .followup-heading,
  .phrasebook-heading {
    display: grid;
    grid-template-columns: 1fr;
  }

  .panel-tools,
  .ai-service-links {
    justify-content: flex-start;
  }

  #copyButton,
  .output-actions .primary-button {
    width: 100%;
  }

  #promptOutput {
    height: 360px;
    min-height: 360px;
    max-height: 360px;
  }

  .template-type-line small {
    margin-left: 0;
  }

  .output-jump-button {
    display: block;
    margin-top: 16px;
  }

  body {
    padding-bottom: 76px;
  }

  .mobile-action-bar {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 8px;
    background: rgba(21, 26, 23, 0.92);
    box-shadow: 0 18px 46px rgba(21, 26, 23, 0.28);
    backdrop-filter: blur(10px);
  }

  .mobile-action-bar .primary-button,
  .mobile-action-bar .secondary-button {
    width: 100%;
    min-height: 46px;
  }

  .mobile-action-bar .secondary-button {
    border-color: rgba(255, 255, 255, 0.26);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .topbar {
    padding: 16px;
  }

  .topbar > * {
    min-width: 0;
    max-width: calc(100vw - 72px);
  }

  .usage-help,
  .usage-help > summary,
  .mode-panel,
  .view-tabs {
    justify-self: start;
    width: calc(100vw - 72px);
    max-width: 100%;
  }

  body.is-admin-mode .admin-open-button {
    justify-self: end;
    width: auto;
    min-width: 72px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand-logo,
  .brand-block h1 {
    font-size: 22px;
  }

  .level-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
    width: 100%;
  }

  .level-button {
    min-width: 0;
    padding-inline: 6px;
    font-size: 11px;
    white-space: normal;
  }

  .sidebar,
  .editor,
  .output,
  .admin-editor {
    padding: 16px;
  }

  .column-heading {
    gap: 10px;
  }

  .column-heading > span {
    width: 32px;
    height: 32px;
  }

  .panel-tools,
  .admin-actions,
  .my-info-actions,
  .example-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .file-button,
  .icon-button {
    width: 100%;
  }

  .panel-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel-tools .icon-button {
    width: auto;
  }

  #promptOutput {
    height: 320px;
    min-height: 320px;
    max-height: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.mode-panel {
  grid-template-columns: minmax(260px, 360px);
  width: auto;
}

.topbar {
  grid-template-columns: minmax(280px, 1fr) auto auto auto auto;
}

.mode-panel > div {
  min-width: 0;
}

.column-heading p,
.brand-block p,
.mode-help {
  max-width: 28ch;
}

.template-description,
.template-type-line small,
.selected-type-summary,
.detail-type-note,
.details-note,
.my-info-note,
.my-info-toggle small,
.followup-heading p:last-child,
.phrasebook-guide,
.card-heading p,
.admin-storage-note,
.edit-tip {
  display: none !important;
}

.category-button {
  min-height: 46px;
}

.category-button span {
  display: none;
}

.template-button {
  gap: 5px;
}

.template-button span {
  -webkit-line-clamp: 1;
}

.template-badges em {
  padding: 1px 6px;
}

.panel-header h2 {
  margin-top: 0;
}

.editor .panel-header {
  align-items: center;
  padding: 11px 13px;
}

.template-type-line {
  grid-template-columns: minmax(96px, 0.24fr) minmax(0, 0.76fr);
  margin-bottom: 14px;
}

.purpose-panel {
  padding: 11px;
}

.purpose-grid {
  gap: 7px;
}

.after-guide,
.phrasebook-panel,
.value-section,
.history-panel {
  padding: 10px 12px;
}

.admin-guide p:not(.label):not(.admin-catalog-note):not(.admin-lock-note),
.danger-zone p:not(.section-title) {
  font-size: 12px;
  line-height: 1.5;
}

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

  .usage-help,
  .usage-help > summary,
  .mode-panel,
  .view-tabs {
    justify-self: stretch;
    width: 100%;
    max-width: 100%;
  }

  .brand-block p,
  .column-heading p,
  .mode-help {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .topbar {
    position: relative;
  }

  .brand-block {
    padding-right: 76px;
  }

  body.is-admin-mode .admin-open-button {
    display: inline-flex;
    position: fixed;
    top: 22px;
    right: 16px;
    z-index: 80;
    width: auto;
    min-width: 56px;
    min-height: 34px;
    border-color: rgba(255, 255, 255, 0.54);
    padding: 7px 10px;
    background: #ffffff;
    color: var(--accent-strong);
    font-size: 12px;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    opacity: 1;
  }
}

/* Full-canvas pass: use the whole viewport for the work surface. */
@media (min-width: 901px) {
  html,
  body {
    min-height: 100%;
  }

  body {
    overflow: hidden;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .workspace {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .workspace::before {
    height: 4px;
  }

  .topbar {
    min-height: 88px;
    padding: 16px 26px;
  }

  .builder-layout {
    grid-template-columns: minmax(310px, 23vw) minmax(470px, 37vw) minmax(470px, 1fr);
    min-height: calc(100vh - 92px);
  }

  .admin-layout {
    grid-template-columns: minmax(310px, 24vw) minmax(620px, 1fr);
    min-height: calc(100vh - 92px);
  }

  .sidebar,
  .editor,
  .output,
  .admin-editor {
    max-height: calc(100vh - 92px);
    padding: clamp(20px, 1.55vw, 28px);
  }

  .template-list {
    max-height: min(50vh, 560px);
  }

  #promptOutput {
    height: clamp(500px, calc(100vh - 330px), 760px);
    min-height: 500px;
    max-height: none;
  }
}

/* Product-grade pass: remove leftover mobile header bulk and keep controls inside the viewport. */
@media (max-width: 900px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px 16px;
  }

  .topbar > * {
    max-width: none;
  }

  .brand-block {
    grid-column: 1 / 2;
  }

  .usage-help {
    display: none;
  }

  .mode-panel {
    grid-column: 1 / -1;
    width: 100%;
    padding: 7px;
  }

  .brand-logo,
  .brand-block h1 {
    font-size: 22px;
  }

  .brand-block p {
    margin-top: 3px;
    font-size: 12px;
  }

  .builder-layout {
    background: var(--line);
  }

  .sidebar,
  .editor,
  .output,
  .admin-editor {
    padding: 18px 16px;
  }
}

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .usage-help,
  .usage-help > summary,
  .mode-panel,
  .view-tabs {
    width: auto;
    max-width: none;
  }

  .mode-panel,
  .view-tabs {
    width: 100%;
  }

  .brand-logo,
  .brand-block h1 {
    font-size: 21px;
  }

  .level-button {
    min-height: 32px;
  }
}

/* Final UX pass: trim duplicate actions and make mobile selection faster. */
.output-jump-button {
  display: none !important;
}

@media (max-width: 900px) {
  .purpose-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purpose-button {
    min-height: 44px;
    padding: 9px 10px;
    font-size: 12px;
    line-height: 1.25;
  }

  .category-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 1px 2px 8px;
    scrollbar-width: none;
  }

  .category-list::-webkit-scrollbar {
    display: none;
  }

  .category-button {
    flex: 0 0 auto;
    min-width: 128px;
    min-height: 44px;
    padding: 9px 11px;
  }

  .category-button strong {
    white-space: nowrap;
  }

  .category-button em {
    margin-left: 6px;
  }
}

@media (max-width: 560px) {
  .brand-block p {
    display: none;
  }

  .purpose-panel {
    padding: 10px;
  }

  .purpose-grid {
    gap: 7px;
  }

  .category-button {
    min-width: 112px;
  }
}

/* Product polish pass: subtle motion, stronger visual hierarchy, and clearer feedback. */
:root {
  --motion-fast: 0.16s;
  --motion-medium: 0.28s;
  --motion-slow: 0.72s;
  --ease-standard: cubic-bezier(0.2, 0.8, 0.2, 1);
  --glow-accent: 0 18px 46px rgba(0, 109, 119, 0.16);
  --glow-violet: 0 18px 46px rgba(91, 85, 200, 0.13);
}

body {
  background:
    linear-gradient(135deg, rgba(0, 109, 119, 0.09) 0 18%, transparent 18% 100%),
    linear-gradient(315deg, rgba(91, 85, 200, 0.08) 0 16%, transparent 16% 100%),
    repeating-linear-gradient(116deg, rgba(0, 109, 119, 0.035) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(29, 33, 31, 0.028) 0 1px, transparent 1px 82px),
    var(--bg);
}

.workspace {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  animation: deskAppear var(--motion-slow) var(--ease-standard) both;
}

.workspace::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 0 18%, rgba(0, 109, 119, 0.045) 18% 18.6%, transparent 18.6% 100%),
    linear-gradient(300deg, transparent 0 76%, rgba(184, 104, 19, 0.05) 76% 76.7%, transparent 76.7% 100%);
}

.topbar {
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.46), transparent);
  transform: translateX(-100%);
  animation: headerSweep 5.8s var(--ease-standard) 0.8s infinite;
}

.brand-mark {
  overflow: hidden;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: -38%;
  background: conic-gradient(from 0deg, transparent 0 30%, rgba(255, 255, 255, 0.78) 42%, transparent 54% 100%);
  animation: brandSheen 7.2s linear infinite;
}

.brand-mark::after {
  z-index: 1;
}

.sidebar,
.editor,
.output,
.admin-editor {
  animation: columnRise 0.48s var(--ease-standard) both;
}

.editor,
.admin-editor {
  animation-delay: 0.05s;
}

.output {
  animation-delay: 0.1s;
}

.purpose-button,
.category-button,
.template-button,
.shortcut-button,
.history-button,
.followup-chips button,
.ai-service-links a,
.primary-button,
.secondary-button,
.danger-button,
.file-button,
.icon-button {
  will-change: transform;
}

.purpose-button,
.category-button,
.template-button,
.shortcut-button,
.history-button {
  position: relative;
  overflow: hidden;
}

.purpose-button::after,
.category-button::after,
.template-button::after,
.shortcut-button::after,
.history-button::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0 34%, rgba(255, 255, 255, 0.58) 48%, transparent 62% 100%);
  opacity: 0;
  transform: translateX(-100%);
}

.purpose-button:hover::after,
.category-button:hover::after,
.template-button:hover::after,
.shortcut-button:hover::after,
.history-button:hover::after {
  opacity: 1;
  transform: translateX(100%);
  transition: transform 0.72s var(--ease-standard), opacity 0.24s ease;
}

.purpose-button.is-active,
.category-button.is-active,
.template-button.is-active,
.shortcut-button.is-active {
  box-shadow: var(--glow-accent), var(--inner-shadow);
}

.template-button.is-active::before,
.category-button.is-active::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.level-button.is-active {
  animation: selectedPop 0.24s var(--ease-standard) both;
}

.primary-button {
  position: relative;
  overflow: hidden;
}

.primary-button::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0 30%, rgba(255, 255, 255, 0.34) 48%, transparent 66% 100%);
  opacity: 0;
  transform: translateX(-100%);
}

.primary-button:hover::before,
.primary-button.is-copy-confirmed::before {
  opacity: 1;
  transform: translateX(100%);
  transition: transform 0.68s var(--ease-standard), opacity 0.18s ease;
}

.primary-button.is-copy-confirmed {
  animation: copyButtonPulse 0.9s var(--ease-standard) both;
}

.output.is-copy-confirmed #promptOutput {
  animation: outputCopied 1.1s var(--ease-standard) both;
}

#promptOutput {
  position: relative;
  background:
    linear-gradient(90deg, rgba(0, 109, 119, 0.07), transparent 30px),
    linear-gradient(180deg, rgba(91, 85, 200, 0.035), transparent 210px),
    #fefffe;
}

.copy-status:not(:empty),
.favorite-status:not(:empty),
.draft-status:not(:empty),
.followup-copy-status:not(:empty),
.phrasebook-copy-status:not(:empty),
.save-status:not(:empty) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  border: 1px solid rgba(0, 109, 119, 0.16);
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(226, 243, 241, 0.82);
  color: var(--accent-strong);
  animation: statusAppear 0.24s var(--ease-standard) both;
}

.copy-status:not(:empty)::before,
.favorite-status:not(:empty)::before,
.draft-status:not(:empty)::before,
.followup-copy-status:not(:empty)::before,
.phrasebook-copy-status:not(:empty)::before,
.save-status:not(:empty)::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 109, 119, 0.12);
}

.admin-auth-card {
  animation: modalEnter 0.24s var(--ease-standard) both;
}

.mobile-action-bar {
  animation: mobileDockIn 0.34s var(--ease-standard) both;
}

@keyframes deskAppear {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes columnRise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes headerSweep {
  0%,
  58% {
    transform: translateX(-100%);
  }
  78%,
  100% {
    transform: translateX(100%);
  }
}

@keyframes brandSheen {
  to {
    transform: rotate(360deg);
  }
}

@keyframes selectedPop {
  0% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes copyButtonPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 109, 119, 0.24), 0 14px 30px rgba(0, 109, 119, 0.23);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(0, 109, 119, 0), 0 18px 40px rgba(0, 109, 119, 0.29);
  }
  100% {
    box-shadow: 0 14px 30px rgba(0, 109, 119, 0.23);
  }
}

@keyframes outputCopied {
  0% {
    border-color: var(--accent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 0 0 0 rgba(0, 109, 119, 0.24);
  }
  55% {
    border-color: var(--accent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 0 0 6px rgba(0, 109, 119, 0.09), var(--glow-accent);
  }
  100% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 12px 30px rgba(29, 33, 31, 0.07);
  }
}

@keyframes statusAppear {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mobileDockIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .workspace,
  .topbar::after,
  .brand-mark::before,
  .sidebar,
  .editor,
  .output,
  .admin-editor,
  .level-button.is-active,
  .primary-button.is-copy-confirmed,
  .output.is-copy-confirmed #promptOutput,
  .copy-status:not(:empty),
  .favorite-status:not(:empty),
  .draft-status:not(:empty),
  .followup-copy-status:not(:empty),
  .phrasebook-copy-status:not(:empty),
  .save-status:not(:empty),
  .admin-auth-card,
  .mobile-action-bar {
    animation: none !important;
  }
}

/* Logo polish pass: sharper product mark and premium wordmark. */
.brand-logo,
.brand-block h1 {
  gap: 13px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 13px;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.95), transparent 0 18%, transparent 36%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent 38%),
    conic-gradient(from 212deg, var(--accent-3), var(--accent), var(--accent-2), #2a9d8f, var(--accent-3));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.brand-mark::before {
  content: "AI";
  position: absolute;
  right: 4px;
  bottom: 4px;
  inset: auto 4px 4px auto;
  min-width: 17px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 5px;
  padding: 1px 3px 2px;
  background: rgba(21, 26, 23, 0.72);
  color: #ffffff;
  font-size: 8px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.22);
  transform: none;
  animation: none;
}

.brand-mark::after {
  content: "G";
  position: static;
  inset: auto;
  border: 0;
  border-radius: 0;
  color: #ffffff;
  font-size: 25px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.brand-logo-text {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  width: fit-content;
  max-width: 100%;
  color: var(--topbar-text);
  font-family: "Segoe UI Variable Display", "Segoe UI", "Arial Black", "Yu Gothic UI", sans-serif;
  font-size: clamp(25px, 2.35vw, 34px);
  font-weight: 950;
  font-variation-settings: "wght" 950;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16),
    0 3px 12px rgba(0, 0, 0, 0.38),
    0 12px 28px rgba(0, 109, 119, 0.28);
}

.brand-logo-text::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: -7px;
  left: 1px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  opacity: 0.82;
  transform-origin: left center;
  animation: logoLineIn 0.7s var(--ease-standard) 0.15s both;
}

.brand-word {
  position: relative;
  display: inline-block;
  color: inherit;
}

.brand-logo .brand-logo-text .brand-good {
  background: linear-gradient(180deg, #ffffff 0%, #f8fffd 42%, #d6eee7 100%);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.brand-logo .brand-logo-text .brand-ai {
  margin-inline: 1px 2px;
  padding-inline: 2px;
  background: linear-gradient(135deg, #79fff3 0%, #fff2a8 46%, #f0ebff 100%);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(126, 243, 231, 0.24));
}

.brand-logo .brand-logo-text .brand-desk {
  background: linear-gradient(180deg, #ffffff 0%, #e8f5f0 52%, #bdd5cd 100%);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  font-weight: 900;
  font-variation-settings: "wght" 900;
}

.brand-logo .brand-logo-text .brand-desk::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: -1px;
  left: 1px;
  height: 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
}

.brand-logo .brand-logo-text .brand-version {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  border: 1px solid rgba(129, 221, 211, 0.32);
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(120, 242, 225, 0.08);
  color: #8beee3;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: lowercase;
  vertical-align: middle;
  transform: translateY(-2px);
}

.brand-version-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: rgba(220, 255, 251, 0.78);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-version-note::before {
  content: "";
  width: 1px;
  height: 9px;
  background: rgba(129, 221, 211, 0.32);
}

.brand-block p {
  margin-top: 8px;
  width: fit-content;
  background: linear-gradient(90deg, #f8fffd 0%, #b9fff6 42%, #ffe8a3 100%);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  font-family: "Segoe UI Variable Display", "Segoe UI", "Yu Gothic UI", sans-serif;
  font-size: 13px;
  font-weight: 900;
  font-variation-settings: "wght" 900;
  line-height: 1.2;
  text-shadow: 0 8px 20px rgba(0, 109, 119, 0.26);
}

@keyframes logoLineIn {
  from {
    opacity: 0;
    transform: scaleX(0.24);
  }
  to {
    opacity: 0.82;
    transform: scaleX(1);
  }
}

@media (max-width: 900px) {
  .brand-logo,
  .brand-block h1 {
    gap: 10px;
  }

  .brand-logo-text {
    font-size: clamp(21px, 6vw, 25px);
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .brand-mark::after {
    font-size: 21px;
  }

  .brand-mark::before {
    right: 3px;
    bottom: 3px;
    min-width: 14px;
    padding: 1px 2px;
    font-size: 7px;
  }

  .brand-logo-text {
    font-size: 20px;
  }

  .brand-logo-text::after {
    bottom: -5px;
    height: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-logo-text::after {
    animation: none !important;
  }
}

/* Hotel dusk theme pass: keep the current teal identity, with warmer and darker surfaces. */
:root {
  --bg: #d7ddd3;
  --surface: #f7f3ea;
  --surface-soft: #e8ede4;
  --surface-tint: #eef1e8;
  --ink: #1b211d;
  --muted: #59635c;
  --muted-strong: #3f4a44;
  --line: #c7d0c3;
  --line-strong: #a8b5aa;
  --accent: #006d77;
  --accent-strong: #004b52;
  --accent-soft: #d9ebe6;
  --accent-2: #5b55b0;
  --accent-2-soft: #e9e7fb;
  --accent-3: #a76f24;
  --accent-3-soft: #f6ead5;
  --topbar: #101714;
  --topbar-2: #22322d;
  --topbar-text: #fff8ed;
  --topbar-muted: #d6cfbd;
  --shadow: 0 28px 80px rgba(24, 30, 27, 0.22);
  --shadow-soft: 0 14px 36px rgba(24, 30, 27, 0.14);
  --inner-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  --glow-accent: 0 18px 44px rgba(0, 109, 119, 0.18);
  --glow-violet: 0 18px 44px rgba(91, 85, 176, 0.14);
}

body {
  background:
    linear-gradient(140deg, rgba(16, 23, 20, 0.18) 0 18%, transparent 18% 100%),
    linear-gradient(315deg, rgba(167, 111, 36, 0.14) 0 15%, transparent 15% 100%),
    repeating-linear-gradient(116deg, rgba(0, 77, 82, 0.04) 0 1px, transparent 1px 76px),
    repeating-linear-gradient(0deg, rgba(27, 33, 29, 0.035) 0 1px, transparent 1px 88px),
    var(--bg);
}

.workspace {
  border-color: rgba(74, 86, 78, 0.36);
  background: #f3f0e8;
  box-shadow: var(--shadow);
}

.workspace::before {
  background: linear-gradient(90deg, #005d63 0%, #5b55b0 48%, #a76f24 100%);
}

.workspace::after {
  background:
    linear-gradient(120deg, transparent 0 18%, rgba(0, 77, 82, 0.055) 18% 18.6%, transparent 18.6% 100%),
    linear-gradient(300deg, transparent 0 76%, rgba(167, 111, 36, 0.07) 76% 76.8%, transparent 76.8% 100%);
}

.topbar {
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 238, 190, 0.12), transparent 0 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 36%),
    linear-gradient(120deg, var(--topbar) 0%, var(--topbar-2) 58%, #0f3b40 100%);
}

.sidebar,
.admin-sidebar {
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.32), transparent 32%),
    var(--surface-soft);
}

.editor,
.admin-editor {
  background: #faf7ef;
}

.output {
  background: linear-gradient(180deg, #f3f0e8, #ece9df);
}

.panel-header,
.editor .panel-header,
.template-type-line,
.detail-spec-panel,
.my-info-panel,
.control-band,
.after-guide,
.phrasebook-panel,
.value-section,
.history-panel,
.admin-auth-card,
.admin-guide,
.admin-storage-note,
.edit-tip {
  border-color: rgba(168, 181, 170, 0.74);
  background: rgba(255, 250, 240, 0.82);
}

.purpose-panel,
.shortcut-panel {
  border-color: rgba(168, 181, 170, 0.74);
  background: rgba(255, 250, 240, 0.72);
}

.purpose-button,
.category-button,
.template-button,
.shortcut-button,
.history-button,
.followup-chips button,
.ai-service-links a {
  border-color: #ccd4c8;
  background: #fffaf0;
  color: var(--ink);
}

.purpose-button:hover,
.purpose-button.is-active,
.category-button:hover,
.category-button.is-active,
.template-button:hover,
.template-button.is-active,
.shortcut-button:hover,
.shortcut-button.is-active,
.history-button:hover,
.followup-chips button:hover,
.ai-service-links a:hover,
.ai-service-links a:focus-visible {
  border-color: rgba(0, 109, 119, 0.5);
  background: #e4f0eb;
  color: var(--accent-strong);
  box-shadow: 0 12px 28px rgba(31, 48, 42, 0.12), var(--inner-shadow);
}

input,
select,
textarea,
#promptOutput,
pre {
  border-color: #bcc8bc;
  background: #fffaf2;
  color: var(--ink);
}

input.uses-default,
textarea.uses-default {
  border-color: #c2cbbf;
  background: #eeeade;
  color: #667064;
}

input::placeholder,
textarea::placeholder {
  color: #7a8379;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 109, 119, 0.14);
}

.primary-button {
  border-color: rgba(0, 75, 82, 0.28);
  background: linear-gradient(135deg, #007680, #004b52);
  box-shadow: 0 16px 34px rgba(0, 77, 82, 0.28);
}

.primary-button:hover {
  background: linear-gradient(135deg, #0b858c, #003f45);
}

.secondary-button,
.file-button,
.icon-button {
  border-color: rgba(167, 111, 36, 0.28);
  background: #fffaf0;
  color: var(--accent-strong);
}

.secondary-button:hover,
.file-button:hover,
.icon-button:hover {
  border-color: rgba(0, 109, 119, 0.42);
  background: var(--accent-soft);
}

.level-buttons,
.view-tabs {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.22);
}

.level-button.is-active,
.tab-button.is-active {
  background: #fff8ed;
  color: var(--accent-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.brand-mark {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.96), transparent 0 18%, transparent 36%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 38%),
    conic-gradient(from 212deg, #a76f24, var(--accent), var(--accent-2), #2f8f6f, #a76f24);
}

.brand-logo-text::after,
.workspace::before {
  box-shadow: 0 0 18px rgba(167, 111, 36, 0.18);
}

.brand-block p {
  background: linear-gradient(90deg, #fff8ed 0%, #bff8ee 46%, #f4d38a 100%);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

/* Deep jewel refinement: less yellow, darker surfaces, cleaner vivid icons. */
:root {
  --bg: #becac4;
  --surface: #eaeee6;
  --surface-soft: #d3ddd6;
  --surface-tint: #dfe7e0;
  --line: #b8c5be;
  --line-strong: #95a69e;
  --accent: #007f86;
  --accent-strong: #003f45;
  --accent-soft: #d4ebe7;
  --accent-2: #4e56c4;
  --accent-2-soft: #e3e5fb;
  --accent-3: #7d6b4f;
  --accent-3-soft: #ece6da;
  --topbar: #0c1412;
  --topbar-2: #182823;
  --topbar-text: #f8fff9;
  --topbar-muted: #c6d2ca;
  --shadow: 0 30px 84px rgba(12, 20, 18, 0.26);
  --shadow-soft: 0 14px 36px rgba(12, 20, 18, 0.16);
  --glow-accent: 0 18px 48px rgba(0, 127, 134, 0.2);
  --glow-violet: 0 18px 48px rgba(78, 86, 196, 0.15);
}

body {
  background:
    radial-gradient(circle at 8% 0%, rgba(0, 127, 134, 0.13), transparent 0 30%),
    linear-gradient(140deg, rgba(12, 20, 18, 0.24) 0 18%, transparent 18% 100%),
    linear-gradient(315deg, rgba(78, 86, 196, 0.12) 0 14%, transparent 14% 100%),
    repeating-linear-gradient(116deg, rgba(0, 63, 69, 0.045) 0 1px, transparent 1px 76px),
    var(--bg);
}

.workspace {
  background: #e6ebe3;
}

.workspace::before {
  background: linear-gradient(90deg, #005f66 0%, #007f86 36%, #4e56c4 72%, #2f8f83 100%);
  box-shadow: 0 0 20px rgba(0, 127, 134, 0.18);
}

.workspace::after {
  background:
    linear-gradient(120deg, transparent 0 18%, rgba(0, 127, 134, 0.058) 18% 18.6%, transparent 18.6% 100%),
    linear-gradient(300deg, transparent 0 76%, rgba(78, 86, 196, 0.052) 76% 76.7%, transparent 76.7% 100%);
}

.topbar {
  background:
    radial-gradient(circle at 8% 0%, rgba(0, 176, 178, 0.14), transparent 0 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.065), transparent 36%),
    linear-gradient(120deg, var(--topbar) 0%, var(--topbar-2) 58%, #063a40 100%);
}

.sidebar,
.admin-sidebar {
  background:
    linear-gradient(180deg, rgba(247, 252, 248, 0.28), transparent 32%),
    var(--surface-soft);
}

.editor,
.admin-editor {
  background: #edf1e9;
}

.output {
  background: linear-gradient(180deg, #e3e9e0, #dce4da);
}

.panel-header,
.editor .panel-header,
.template-type-line,
.detail-spec-panel,
.my-info-panel,
.control-band,
.after-guide,
.phrasebook-panel,
.value-section,
.history-panel,
.admin-auth-card,
.admin-guide,
.admin-storage-note,
.edit-tip,
.purpose-panel,
.shortcut-panel {
  border-color: rgba(149, 166, 158, 0.76);
  background: rgba(239, 242, 233, 0.84);
}

.purpose-button,
.category-button,
.template-button,
.shortcut-button,
.history-button,
.followup-chips button,
.ai-service-links a,
input,
select,
textarea,
#promptOutput,
pre {
  border-color: #b8c5be;
  background: #f2f4ec;
}

input.uses-default,
textarea.uses-default {
  border-color: #b4bfb8;
  background: #e5e7de;
}

.secondary-button,
.file-button,
.icon-button {
  border-color: rgba(0, 127, 134, 0.28);
  background: #eef2ea;
}

.level-button.is-active,
.tab-button.is-active,
body.is-admin-mode .admin-open-button {
  background: #f5f7ef;
  color: var(--accent-strong);
}

.brand-mark {
  border-color: rgba(180, 255, 247, 0.24);
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.96), transparent 0 18%, transparent 36%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent 38%),
    conic-gradient(from 212deg, #00a9a8, #4e56c4, #2f8f83, #007f86, #00a9a8);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34), 0 0 26px rgba(0, 127, 134, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.brand-mark::before {
  border-color: rgba(180, 255, 247, 0.38);
  background: rgba(12, 20, 18, 0.78);
}

.brand-logo-text::after {
  background: linear-gradient(90deg, #00a9a8, #4e56c4, #2f8f83);
  box-shadow: 0 0 18px rgba(0, 127, 134, 0.24);
}

.brand-logo .brand-logo-text .brand-ai {
  background: linear-gradient(135deg, #83fff6 0%, #d9f8f1 44%, #c9ccff 100%);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.brand-block p {
  background: linear-gradient(90deg, #f8fff9 0%, #9ff7ee 48%, #c8cbff 100%);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.column-heading > span {
  border: 1px solid rgba(184, 255, 246, 0.24);
  background: linear-gradient(145deg, #008990, #005d66 58%, #4e56c4 100%);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(0, 95, 102, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.purpose-button::before {
  border-radius: 3px;
  background: linear-gradient(145deg, #00a9a8, #4e56c4);
  box-shadow: 0 0 0 3px rgba(0, 127, 134, 0.12), 0 0 14px rgba(0, 127, 134, 0.24);
}

.purpose-button.is-active::before {
  background: linear-gradient(145deg, #00c6bc, #4e56c4);
  box-shadow: 0 0 0 3px rgba(0, 127, 134, 0.18), 0 0 18px rgba(78, 86, 196, 0.22);
}

.category-button em,
.count-pill,
.template-badges em,
.phrasebook-group-summary em {
  border-color: rgba(0, 127, 134, 0.2);
  background: #e8f2ed;
  color: #005d66;
}

.template-button.is-active::before,
.category-button.is-active::before {
  background: linear-gradient(180deg, #00a9a8, #4e56c4);
}

.purpose-button:hover,
.purpose-button.is-active,
.category-button:hover,
.category-button.is-active,
.template-button:hover,
.template-button.is-active,
.shortcut-button:hover,
.shortcut-button.is-active,
.history-button:hover {
  border-color: rgba(0, 127, 134, 0.5);
  background: #dceee9;
  box-shadow: 0 12px 28px rgba(0, 63, 69, 0.13), var(--inner-shadow);
}

/* Heavy dark inversion: dark shell, white work surfaces, vivid animated edges. */
:root {
  --bg: #07100e;
  --surface: #fbfbf6;
  --surface-soft: #101b18;
  --surface-tint: #f0f4ee;
  --ink: #121815;
  --muted: #5d6761;
  --muted-strong: #39443e;
  --line: #243b36;
  --line-strong: #3c5a52;
  --accent: #00a7a6;
  --accent-strong: #00676c;
  --accent-soft: #d9f2ef;
  --accent-2: #5862d6;
  --accent-2-soft: #e5e7ff;
  --accent-3: #26c6b7;
  --accent-3-soft: #d9f2ef;
  --topbar: #08100e;
  --topbar-2: #13221e;
  --topbar-text: #f7fff9;
  --topbar-muted: #b9c9c2;
  --shadow: 0 34px 94px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 18px 42px rgba(0, 0, 0, 0.28);
  --inner-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
  --glow-accent: 0 18px 46px rgba(0, 167, 166, 0.22);
  --glow-violet: 0 18px 46px rgba(88, 98, 214, 0.18);
}

body {
  background:
    radial-gradient(circle at 12% 0%, rgba(0, 167, 166, 0.22), transparent 0 32%),
    radial-gradient(circle at 88% 8%, rgba(88, 98, 214, 0.16), transparent 0 28%),
    linear-gradient(145deg, #07100e 0%, #101b18 48%, #08110f 100%);
  color: var(--ink);
}

.workspace {
  border-color: rgba(111, 154, 145, 0.26);
  background: #08100e;
  box-shadow: var(--shadow);
}

.workspace::before {
  height: 6px;
  background: linear-gradient(90deg, #00d6c8, #5862d6, #00a7a6, #2fe0cf, #00d6c8);
  background-size: 260% 100%;
  box-shadow: 0 0 28px rgba(0, 214, 200, 0.34);
  animation: edgeColorRun 7s linear infinite;
}

.workspace::after {
  background:
    linear-gradient(120deg, transparent 0 18%, rgba(0, 214, 200, 0.07) 18% 18.45%, transparent 18.45% 100%),
    linear-gradient(300deg, transparent 0 76%, rgba(88, 98, 214, 0.07) 76% 76.45%, transparent 76.45% 100%);
}

.topbar {
  border-bottom-color: rgba(0, 214, 200, 0.2);
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 214, 200, 0.16), transparent 0 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 38%),
    linear-gradient(120deg, #08100e 0%, #13221e 58%, #062d31 100%);
}

.topbar::after {
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 214, 200, 0.78), rgba(88, 98, 214, 0.72), transparent);
}

.builder-layout,
.admin-layout {
  background: linear-gradient(180deg, rgba(0, 214, 200, 0.28), rgba(88, 98, 214, 0.24));
}

.sidebar,
.editor,
.output,
.admin-sidebar,
.admin-editor {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 18%),
    #0d1714;
  color: #edf8f3;
}

.editor,
.output,
.admin-editor {
  box-shadow: inset 1px 0 0 rgba(0, 214, 200, 0.12);
}

.column-heading h2,
.search-box label,
.section-title,
.shortcut-heading,
.details-summary,
.output .panel-header h2 {
  color: #f5fff9;
}

.column-heading p,
.label,
.hint,
.template-type-line small,
.selected-type-summary,
.detail-type-note,
.details-note,
.my-info-note,
.admin-storage-note,
.edit-tip {
  color: #b9c9c2;
}

.column-heading > span {
  border: 1px solid rgba(162, 255, 247, 0.28);
  background: linear-gradient(145deg, #00b7b3, #006f76 55%, #5862d6 100%);
  color: #ffffff;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.32), 0 0 22px rgba(0, 214, 200, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.panel-header,
.editor .panel-header,
.output-actions,
.template-type-line,
.detail-spec-panel,
.advanced-detail-fields,
.my-info-panel,
.control-band,
.after-guide,
.phrasebook-panel,
.value-section,
.history-panel,
.admin-auth-card,
.admin-guide,
.admin-storage-note,
.edit-tip,
.purpose-panel,
.shortcut-panel,
.form-grid > label,
.detail-form-grid > label {
  border-color: rgba(184, 201, 194, 0.72);
  background: #fbfbf6;
  color: var(--ink);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2), var(--inner-shadow);
}

.panel-header h2,
.form-grid label span,
.template-type-line > span,
.detail-group-title,
.purpose-heading span,
.shortcut-heading span,
.card-heading h2,
.admin-guide h2,
.admin-auth-card h2 {
  color: var(--ink);
}

.panel-header p,
.purpose-heading small,
.shortcut-heading small,
.template-description,
.template-type-line small,
.details-note,
.my-info-note,
.admin-storage-note,
.edit-tip {
  color: var(--muted);
}

input,
select,
textarea,
#promptOutput,
pre {
  border-color: #c9d2cc;
  background: #ffffff;
  color: #111815;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

input.uses-default,
textarea.uses-default {
  border-color: #c1cac4;
  background: #f2f5f1;
  color: #5e6963;
}

input::placeholder,
textarea::placeholder {
  color: #808b85;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 167, 166, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.purpose-button,
.category-button,
.template-button,
.shortcut-button,
.history-button,
.followup-chips button,
.ai-service-links a {
  border-color: #c9d2cc;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12), var(--inner-shadow);
}

.purpose-button:hover,
.purpose-button.is-active,
.category-button:hover,
.category-button.is-active,
.template-button:hover,
.template-button.is-active,
.shortcut-button:hover,
.shortcut-button.is-active,
.history-button:hover,
.followup-chips button:hover,
.ai-service-links a:hover,
.ai-service-links a:focus-visible {
  border-color: rgba(0, 167, 166, 0.58);
  background: #edf9f7;
  color: var(--accent-strong);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 214, 200, 0.12), var(--inner-shadow);
}

.purpose-button::before {
  border-radius: 4px;
  background: linear-gradient(145deg, #00d6c8, #5862d6);
  box-shadow: 0 0 0 3px rgba(0, 214, 200, 0.14), 0 0 18px rgba(0, 214, 200, 0.32);
}

.purpose-button.is-active::before {
  background: linear-gradient(145deg, #32f3e2, #5862d6);
  box-shadow: 0 0 0 3px rgba(0, 214, 200, 0.2), 0 0 22px rgba(88, 98, 214, 0.28);
}

.template-button.is-active::before,
.category-button.is-active::before {
  background: linear-gradient(180deg, #00d6c8, #5862d6);
  box-shadow: 0 0 18px rgba(0, 214, 200, 0.22);
}

.category-button em,
.count-pill,
.template-badges em,
.phrasebook-group-summary em {
  border-color: rgba(0, 167, 166, 0.24);
  background: #e7f6f3;
  color: var(--accent-strong);
}

.primary-button {
  border-color: rgba(0, 214, 200, 0.28);
  background: linear-gradient(135deg, #00888d, #00555e);
  color: #ffffff;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.26), 0 0 24px rgba(0, 214, 200, 0.16);
}

.primary-button:hover {
  background: linear-gradient(135deg, #00a0a2, #004a52);
}

.secondary-button,
.file-button,
.icon-button {
  border-color: rgba(0, 167, 166, 0.26);
  background: #ffffff;
  color: var(--accent-strong);
}

.level-buttons,
.view-tabs,
.mode-panel {
  border-color: rgba(172, 220, 211, 0.22);
  background: rgba(255, 255, 255, 0.055);
}

.level-button,
.tab-button {
  color: #c5d7d0;
}

.level-button.is-active,
.tab-button.is-active,
body.is-admin-mode .admin-open-button {
  background: #ffffff;
  color: var(--accent-strong);
}

.brand-logo-text::after {
  background: linear-gradient(90deg, #00d6c8, #5862d6, #00a7a6);
  box-shadow: 0 0 24px rgba(0, 214, 200, 0.34);
}

.brand-mark {
  border-color: rgba(172, 255, 247, 0.28);
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.98), transparent 0 18%, transparent 36%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent 38%),
    conic-gradient(from 212deg, #00d6c8, #5862d6, #00979a, #2fe0cf, #00d6c8);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.38), 0 0 30px rgba(0, 214, 200, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.brand-block p {
  background: linear-gradient(90deg, #f7fff9 0%, #8bf5eb 48%, #c8cbff 100%);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.output .panel-header h2,
.details-summary,
.my-info-panel .details-summary,
.advanced-detail-fields .details-summary,
.after-guide h2,
.phrasebook-panel h2,
.value-section h2,
.history-panel h2 {
  color: var(--ink);
}

.mobile-action-bar {
  border-color: rgba(0, 214, 200, 0.24);
  background: rgba(8, 16, 14, 0.94);
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.36), 0 0 26px rgba(0, 214, 200, 0.12);
}

@keyframes edgeColorRun {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 260% 50%;
  }
}

/* Refined gray correction: soften the heavy dark shell into elegant charcoal. */
:root {
  --bg: #303a36;
  --surface-soft: #313c38;
  --line: #526961;
  --line-strong: #74877f;
  --topbar: #27322f;
  --topbar-2: #34423d;
  --topbar-text: #f7faf4;
  --topbar-muted: #ced8d2;
  --shadow: 0 30px 78px rgba(22, 28, 26, 0.34);
  --shadow-soft: 0 16px 38px rgba(22, 28, 26, 0.22);
}

body {
  background:
    radial-gradient(circle at 12% 0%, rgba(0, 167, 166, 0.14), transparent 0 32%),
    radial-gradient(circle at 88% 8%, rgba(88, 98, 214, 0.1), transparent 0 28%),
    linear-gradient(145deg, #303a36 0%, #3a4540 48%, #27312e 100%);
}

.workspace {
  border-color: rgba(150, 173, 164, 0.3);
  background: #303a36;
  box-shadow: var(--shadow);
}

.workspace::before {
  background: linear-gradient(90deg, #35cfc5, #6570df, #2fb8b0, #56ddd2, #35cfc5);
  background-size: 240% 100%;
  box-shadow: 0 0 22px rgba(53, 207, 197, 0.24);
}

.topbar {
  border-bottom-color: rgba(117, 155, 147, 0.28);
  background:
    radial-gradient(circle at 10% 0%, rgba(53, 207, 197, 0.1), transparent 0 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 38%),
    linear-gradient(120deg, #27322f 0%, #34423d 58%, #27484a 100%);
}

.topbar::after {
  background: linear-gradient(90deg, transparent, rgba(53, 207, 197, 0.58), rgba(101, 112, 223, 0.5), transparent);
}

.builder-layout,
.admin-layout {
  background: linear-gradient(180deg, rgba(53, 207, 197, 0.2), rgba(101, 112, 223, 0.16));
}

.sidebar,
.editor,
.output,
.admin-sidebar,
.admin-editor {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 20%),
    #313c38;
  color: #f2f7f3;
}

.column-heading h2,
.search-box label,
.section-title,
.shortcut-heading,
.details-summary {
  color: #f4f8f3;
}

.column-heading p,
.label,
.hint {
  color: #d1dcd6;
}

.mobile-action-bar {
  border-color: rgba(53, 207, 197, 0.22);
  background: rgba(47, 58, 54, 0.95);
  box-shadow: 0 -16px 38px rgba(22, 28, 26, 0.3), 0 0 22px rgba(53, 207, 197, 0.1);
}

/* Light executive gray: brighter shell, pure white work surfaces. */
:root {
  --bg: #b9c3be;
  --surface: #ffffff;
  --surface-soft: #747f79;
  --surface-tint: #f4f7f4;
  --ink: #121715;
  --muted: #56625c;
  --muted-strong: #34413c;
  --line: #aebbb5;
  --line-strong: #7f9189;
  --accent: #00999b;
  --accent-strong: #005f64;
  --accent-soft: #e2f6f4;
  --accent-2: #626bd2;
  --accent-2-soft: #eaecff;
  --topbar: #66736d;
  --topbar-2: #7d8a84;
  --topbar-text: #ffffff;
  --topbar-muted: #eef4f0;
  --shadow: 0 30px 78px rgba(42, 52, 48, 0.28);
  --shadow-soft: 0 16px 38px rgba(42, 52, 48, 0.18);
}

body {
  background:
    radial-gradient(circle at 12% 0%, rgba(0, 153, 155, 0.13), transparent 0 32%),
    radial-gradient(circle at 88% 8%, rgba(98, 107, 210, 0.1), transparent 0 28%),
    linear-gradient(145deg, #bac5bf 0%, #aeb9b3 48%, #c7d0ca 100%);
}

.workspace {
  border-color: rgba(96, 116, 108, 0.36);
  background: #77827c;
  box-shadow: var(--shadow);
}

.workspace::before {
  height: 5px;
  background: linear-gradient(90deg, #36c7c1, #626bd2, #00999b, #72d8d0, #36c7c1);
  background-size: 240% 100%;
  box-shadow: 0 0 18px rgba(54, 199, 193, 0.2);
}

.workspace::after {
  background:
    linear-gradient(120deg, transparent 0 18%, rgba(255, 255, 255, 0.08) 18% 18.5%, transparent 18.5% 100%),
    linear-gradient(300deg, transparent 0 76%, rgba(0, 153, 155, 0.055) 76% 76.5%, transparent 76.5% 100%);
}

.topbar {
  border-bottom-color: rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(circle at 10% 0%, rgba(54, 199, 193, 0.12), transparent 0 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 38%),
    linear-gradient(120deg, #5f6c66 0%, #76837d 58%, #597a7b 100%);
}

.topbar::after {
  background: linear-gradient(90deg, transparent, rgba(54, 199, 193, 0.58), rgba(98, 107, 210, 0.42), transparent);
}

.builder-layout,
.admin-layout {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(54, 199, 193, 0.16));
}

.sidebar,
.editor,
.output,
.admin-sidebar,
.admin-editor {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 22%),
    #727d77;
  color: #ffffff;
}

.editor,
.output,
.admin-editor {
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.22);
}

.column-heading h2,
.search-box label,
.section-title,
.shortcut-heading,
.details-summary {
  color: #ffffff;
}

.column-heading p,
.label,
.hint {
  color: #eef4f0;
}

.panel-header,
.editor .panel-header,
.output-actions,
.template-type-line,
.detail-spec-panel,
.advanced-detail-fields,
.my-info-panel,
.control-band,
.after-guide,
.phrasebook-panel,
.value-section,
.history-panel,
.admin-auth-card,
.admin-guide,
.admin-storage-note,
.edit-tip,
.purpose-panel,
.shortcut-panel,
.form-grid > label,
.detail-form-grid > label,
.purpose-button,
.category-button,
.template-button,
.shortcut-button,
.history-button,
.followup-chips button,
.ai-service-links a {
  border-color: #d8dfda;
  background: #ffffff;
  color: var(--ink);
}

input,
select,
textarea,
#promptOutput,
pre {
  border-color: #c7d1cc;
  background: #ffffff;
  color: #111715;
}

input.uses-default,
textarea.uses-default {
  border-color: #c9d1cc;
  background: #ffffff;
  color: #4f5b55;
}

.panel-header h2,
.form-grid label span,
.template-type-line > span,
.detail-group-title,
.purpose-heading span,
.shortcut-heading span,
.output .panel-header h2,
.details-summary {
  color: var(--ink);
}

.panel-header p,
.purpose-heading small,
.shortcut-heading small,
.template-description,
.template-type-line small,
.details-note,
.my-info-note {
  color: var(--muted);
}

.level-buttons,
.view-tabs,
.mode-panel {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.1);
}

.level-button,
.tab-button {
  color: #f6fbf8;
}

.level-button.is-active,
.tab-button.is-active,
body.is-admin-mode .admin-open-button,
.secondary-button,
.file-button,
.icon-button {
  background: #ffffff;
  color: var(--accent-strong);
}

.primary-button {
  background: linear-gradient(135deg, #00999b, #006b70);
  box-shadow: 0 16px 34px rgba(42, 52, 48, 0.24), 0 0 20px rgba(0, 153, 155, 0.13);
}

.mobile-action-bar {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(103, 116, 109, 0.96);
  box-shadow: 0 -16px 38px rgba(42, 52, 48, 0.26), 0 0 18px rgba(54, 199, 193, 0.08);
}

/* Final designer pass: black title bar, refined pale gray workspace, pure white inputs. */
:root {
  --bg: #eef1f2;
  --surface: #ffffff;
  --surface-soft: #eef2f2;
  --surface-tint: #f6f8f8;
  --ink: #141a18;
  --muted: #5b6763;
  --muted-strong: #36413d;
  --line: #d5ddda;
  --line-strong: #b7c3bf;
  --accent: #008b8f;
  --accent-strong: #005c61;
  --accent-soft: #e2f5f4;
  --accent-2: #5862c8;
  --accent-2-soft: #eceeff;
  --accent-3: #2aa89e;
  --accent-3-soft: #e2f5f4;
  --topbar: #111615;
  --topbar-2: #1d2523;
  --topbar-text: #f8fbf9;
  --topbar-muted: #c9d4d0;
  --shadow: 0 24px 70px rgba(37, 46, 43, 0.14);
  --shadow-soft: 0 14px 34px rgba(37, 46, 43, 0.1);
  --inner-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  --glow-accent: 0 16px 40px rgba(0, 139, 143, 0.14);
  --glow-violet: 0 16px 40px rgba(88, 98, 200, 0.1);
}

html {
  background: var(--bg);
}

body {
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 139, 143, 0.08), transparent 0 28%),
    radial-gradient(circle at 86% 6%, rgba(88, 98, 200, 0.06), transparent 0 24%),
    linear-gradient(145deg, #f3f5f6 0%, #e7ecec 52%, #f6f7f7 100%);
  color: var(--ink);
}

.workspace {
  border-color: #d8dfdd;
  background: #edf1f2;
  box-shadow: var(--shadow);
}

.workspace::before {
  height: 4px;
  background: linear-gradient(90deg, #00a6a6, #5862c8, #008b8f, #00a6a6);
  background-size: 220% 100%;
  box-shadow: none;
  animation: edgeColorRun 9s linear infinite;
}

.workspace::after {
  background:
    linear-gradient(120deg, transparent 0 18%, rgba(0, 139, 143, 0.034) 18% 18.45%, transparent 18.45% 100%),
    linear-gradient(300deg, transparent 0 76%, rgba(88, 98, 200, 0.032) 76% 76.45%, transparent 76.45% 100%);
}

.topbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 166, 166, 0.14), transparent 0 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 40%),
    linear-gradient(120deg, var(--topbar) 0%, var(--topbar-2) 64%, #102f31 100%);
  color: var(--topbar-text);
}

.topbar::after {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 166, 166, 0.58), rgba(88, 98, 200, 0.42), transparent);
}

.brand-logo,
.brand-block h1 {
  color: var(--topbar-text);
}

.brand-block p {
  background: linear-gradient(90deg, #f8fbf9 0%, #a5f2ed 48%, #cbd0ff 100%);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.brand-logo-text::after {
  background: linear-gradient(90deg, #00a6a6, #5862c8, #008b8f);
  box-shadow: 0 0 18px rgba(0, 166, 166, 0.24);
}

.brand-mark {
  border-color: rgba(255, 255, 255, 0.26);
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.98), transparent 0 18%, transparent 36%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent 38%),
    conic-gradient(from 212deg, #00a6a6, #5862c8, #008b8f, #2fc8bd, #00a6a6);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.builder-layout,
.admin-layout {
  background: #d8dfdd;
}

.sidebar,
.editor,
.output,
.admin-sidebar,
.admin-editor {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 28%),
    #eef2f2;
  color: var(--ink);
  box-shadow: none;
}

.editor,
.output,
.admin-editor {
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.7);
}

.column-heading h2,
.search-box label,
.section-title,
.shortcut-heading,
.details-summary,
.output .panel-header h2 {
  color: var(--ink);
}

.column-heading p,
.label,
.hint,
.template-description,
.template-type-line small,
.details-note,
.my-info-note,
.selected-type-summary,
.detail-type-note,
.admin-storage-note,
.edit-tip {
  color: var(--muted);
}

.column-heading > span {
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: linear-gradient(145deg, #008b8f, #00686d 58%, #5862c8 100%);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(0, 139, 143, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.panel-header,
.editor .panel-header,
.output-actions,
.template-type-line,
.detail-spec-panel,
.advanced-detail-fields,
.my-info-panel,
.control-band,
.after-guide,
.phrasebook-panel,
.value-section,
.history-panel,
.admin-auth-card,
.admin-guide,
.admin-storage-note,
.edit-tip,
.purpose-panel,
.shortcut-panel,
.form-grid > label,
.detail-form-grid > label,
.purpose-button,
.category-button,
.template-button,
.shortcut-button,
.history-button,
.followup-chips button,
.ai-service-links a {
  border-color: #d7dfdc;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(37, 46, 43, 0.08), var(--inner-shadow);
}

input,
select,
textarea,
#promptOutput,
pre {
  border-color: #cfd8d4;
  background: #ffffff;
  color: #101715;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

input.uses-default,
textarea.uses-default {
  border-color: #cfd8d4;
  background: #ffffff;
  color: #4f5b56;
}

input::placeholder,
textarea::placeholder {
  color: #7c8782;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 139, 143, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.purpose-button:hover,
.purpose-button.is-active,
.category-button:hover,
.category-button.is-active,
.template-button:hover,
.template-button.is-active,
.shortcut-button:hover,
.shortcut-button.is-active,
.history-button:hover,
.followup-chips button:hover,
.ai-service-links a:hover,
.ai-service-links a:focus-visible {
  border-color: rgba(0, 139, 143, 0.46);
  background: #f0fbfa;
  color: var(--accent-strong);
  box-shadow: 0 14px 32px rgba(37, 46, 43, 0.1), 0 0 0 1px rgba(0, 139, 143, 0.08), var(--inner-shadow);
}

.purpose-button::before {
  border-radius: 4px;
  background: linear-gradient(145deg, #00b7b5, #5862c8);
  box-shadow: 0 0 0 3px rgba(0, 139, 143, 0.1);
}

.purpose-button.is-active::before,
.template-button.is-active::before,
.category-button.is-active::before {
  background: linear-gradient(180deg, #00a6a6, #5862c8);
}

.category-button em,
.count-pill,
.template-badges em,
.phrasebook-group-summary em {
  border-color: rgba(0, 139, 143, 0.18);
  background: #e8f7f5;
  color: var(--accent-strong);
}

.primary-button {
  border-color: rgba(0, 139, 143, 0.24);
  background: linear-gradient(135deg, #008b8f, #00646a);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(0, 139, 143, 0.2);
}

.primary-button:hover {
  background: linear-gradient(135deg, #009b9d, #005a60);
}

.secondary-button,
.file-button,
.icon-button,
body.is-admin-mode .admin-open-button {
  border-color: #cfd8d4;
  background: #ffffff;
  color: var(--accent-strong);
}

.level-buttons,
.view-tabs,
.mode-panel {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.level-button,
.tab-button {
  color: #dce6e2;
}

.level-button.is-active,
.tab-button.is-active {
  background: #ffffff;
  color: var(--accent-strong);
}

.mobile-action-bar {
  border-color: #cfd8d4;
  background: rgba(238, 242, 242, 0.96);
  box-shadow: 0 -14px 36px rgba(37, 46, 43, 0.16);
}

.mobile-action-bar .secondary-button {
  background: #ffffff;
  color: var(--accent-strong);
}

.output .output-actions {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.output .copy-status {
  margin-left: 8px;
}

.site-info-switch {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex: 1 1 320px;
  flex-direction: column;
  max-width: 430px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.07);
  color: #f4f7f6;
  cursor: pointer;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

.site-info-switch span {
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.site-info-switch small {
  margin-top: 2px;
  color: rgba(244, 247, 246, 0.68);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.site-info-switch:hover,
.site-info-switch:focus-visible,
.site-info-switch.is-active {
  border-color: rgba(0, 183, 181, 0.54);
  background: rgba(0, 139, 143, 0.18);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 183, 181, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.info-view {
  padding: clamp(18px, 3vw, 30px);
}

.info-view-inner {
  display: grid;
  gap: 18px;
  width: min(1080px, 100%);
  margin: 0 auto;
}

.info-hero,
.info-grid section,
.info-faq {
  border: 1px solid #d7dfdc;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(37, 46, 43, 0.08), var(--inner-shadow);
}

.info-hero {
  padding: clamp(22px, 4vw, 38px);
}

.info-eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.info-hero h2 {
  margin: 0;
  color: #111615;
  font-size: clamp(24px, 3.2vw, 38px);
  line-height: 1.3;
}

.info-hero p,
.info-faq p {
  margin: 12px 0 0;
  color: #41504b;
  line-height: 1.85;
}

.info-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.info-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid #d7dfdc;
  border-radius: 8px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--accent-strong);
  font-weight: 900;
  text-decoration: none;
}

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

.info-grid section,
.info-faq {
  padding: 18px;
}

.info-grid h3,
.info-faq h3 {
  margin: 0 0 10px;
  color: #111615;
  font-size: 18px;
}

.info-grid ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.2em;
  color: #41504b;
  line-height: 1.65;
}

.info-faq {
  display: grid;
  gap: 8px;
}

.info-faq details {
  border: 1px solid #dbe3e0;
  border-radius: 8px;
  background: #ffffff;
}

.info-faq summary {
  min-height: 44px;
  padding: 12px 14px;
  cursor: pointer;
  color: #111615;
  font-weight: 900;
}

.info-faq details p {
  margin: 0;
  border-top: 1px solid #e5ece9;
  padding: 0 14px 14px;
}

@media (max-width: 1180px) {
  .site-info-switch {
    order: 2;
    flex: 1 1 100%;
    max-width: none;
  }
}

@media (max-width: 760px) {
  .site-info-switch {
    min-height: 44px;
    padding: 8px 12px;
  }

  .info-view {
    padding: 14px;
  }

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

.legal-body {
  min-height: 100vh;
  overflow: auto;
  background:
    radial-gradient(circle at 12% 0%, rgba(0, 139, 143, 0.08), transparent 0 28%),
    linear-gradient(145deg, #f3f5f6 0%, #e7ecec 52%, #f6f7f7 100%);
}

.legal-page {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.legal-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-bottom: 14px;
  border: 1px solid #cfd8d4;
  border-radius: 8px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--accent-strong);
  font-weight: 900;
  text-decoration: none;
  box-shadow: var(--inner-shadow);
}

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.legal-actions .legal-back-link {
  margin-bottom: 0;
}

input::placeholder,
textarea::placeholder {
  color: #aab4ae !important;
  font-weight: 400;
  opacity: 1;
}

input.uses-default::placeholder,
textarea.uses-default::placeholder {
  color: #b8c1bb !important;
  font-style: italic;
}

.brand-logo,
.brand-block h1 {
  min-width: 0;
  max-width: 100%;
}

.brand-mark {
  flex: 0 0 auto;
}

.brand-logo-text {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: normal !important;
  text-overflow: ellipsis;
  white-space: nowrap !important;
  word-break: keep-all;
  letter-spacing: 0;
}

.brand-word {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .site-info-switch {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
  }

  .brand-block {
    min-width: 0;
  }

  .brand-logo,
  .brand-block h1 {
    width: 100%;
  }

  .brand-logo-text {
    flex: 1 1 auto;
    max-width: calc(100vw - 104px);
    font-size: clamp(18px, 5.4vw, 22px);
  }
}

@media (max-width: 560px) {
  .brand-block {
    padding-right: 0;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand-logo,
  .brand-block h1 {
    gap: 8px;
  }

  .brand-logo-text {
    max-width: calc(100vw - 86px);
    font-size: clamp(17px, 5.15vw, 20px);
  }
}

@media (max-width: 360px) {
  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .brand-logo,
  .brand-block h1 {
    gap: 7px;
  }

  .brand-logo-text {
    max-width: calc(100vw - 78px);
    font-size: 17px;
  }
}

/* First-run UX helpers. */
.level-descriptions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.level-descriptions li {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 6px 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef7f4;
  line-height: 1.35;
}

.level-descriptions b,
.level-descriptions span {
  display: block;
}

.level-descriptions b {
  font-size: 11px;
  font-weight: 900;
}

.level-descriptions span {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 700;
  color: rgba(246, 251, 248, 0.78);
}

.quick-start-steps {
  margin: 0 0 14px;
  border: 1px solid #cfd8d4;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(37, 46, 43, 0.08), var(--inner-shadow);
}

.quick-start-steps ol {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: quick-step;
}

.quick-start-steps li {
  counter-increment: quick-step;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 34px;
  color: #24322d;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
}

.quick-start-steps li::before {
  content: counter(quick-step);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.favorite-panel,
.recommended-panel {
  margin: 0 0 16px;
  border: 1px solid #cfd8d4;
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.favorite-panel {
  margin-bottom: 10px;
}

.category-overview {
  margin-top: 12px;
}

.favorite-panel .shortcut-list,
.recommended-panel .shortcut-list {
  max-height: 236px;
  overflow: auto;
  padding-right: 2px;
}

.selection-status {
  margin: -8px 0 14px;
  border: 1px solid #cfe2df;
  border-radius: 8px;
  padding: 9px 11px;
  background: #f3fbfa;
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.55;
}

.output.is-empty-output #promptOutput {
  display: grid;
  place-items: center;
  min-height: 260px;
  border-style: dashed;
  background: #fbfdfc;
  color: #697670;
  font-family: "Segoe UI", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.7;
  text-align: center;
  white-space: pre-wrap;
}

.copy-status,
.phrasebook-copy-status,
.followup-copy-status {
  max-width: min(520px, 100%);
  white-space: normal;
}

.phrasebook-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.template-button.is-active,
.shortcut-button.is-active,
.category-button.is-active,
.purpose-button.is-active {
  outline: 2px solid rgba(0, 139, 143, 0.22);
  outline-offset: 1px;
}

.no-results {
  color: #40514b;
  font-weight: 800;
  line-height: 1.6;
}

.privacy-notice,
.data-controls-panel,
.history-controls {
  border: 1px solid #cfd8d4;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffdf5;
  color: #34413d;
  box-shadow: 0 10px 22px rgba(37, 46, 43, 0.06), var(--inner-shadow);
}

.privacy-notice {
  margin: 0 0 14px;
}

.privacy-notice strong,
.data-controls-panel strong {
  display: block;
  color: #1f2f2a;
  font-size: 13px;
  font-weight: 900;
}

.privacy-notice p,
.data-controls-panel p,
.history-controls .details-note {
  margin: 4px 0 0;
  color: #53625d;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

.data-controls-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  background: #f7fbfa;
}

.data-control-actions,
.history-control-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.history-controls {
  display: grid;
  gap: 9px;
  margin: 0 0 12px;
  background: #f7fbfa;
}

.history-save-toggle {
  margin: 0;
}

.history-save-toggle small {
  display: block;
  margin-top: 2px;
  color: #64736e;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.danger-lite-button {
  border-color: #e2b8b0;
  color: #9f2f22;
}

.danger-lite-button:hover,
.danger-lite-button:focus-visible {
  border-color: #b42318;
  background: #fff5f3;
  color: #8f1f15;
}

.danger-lite-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 900px) {
  .level-descriptions {
    grid-template-columns: 1fr;
  }

  .level-descriptions li {
    padding: 5px 7px;
  }

  .level-descriptions span {
    font-size: 10px;
  }

  .quick-start-steps {
    margin-bottom: 12px;
  }

  .recommended-panel .shortcut-list {
    max-height: 190px;
  }

  .output.is-empty-output #promptOutput {
    min-height: 220px;
    padding: 18px;
  }

  .data-controls-panel {
    grid-template-columns: 1fr;
  }

  .data-control-actions,
  .history-control-actions {
    justify-content: flex-start;
  }
}

/* ==========================================================================
   Maintenance Layer: header, buttons, mobile, cards, forms, toasts
   --------------------------------------------------------------------------
   Keep these final safeguards near the end so release-critical visibility and
   focus rules are not accidentally weakened by earlier layout overrides.
   ========================================================================== */

/* Header / mobile safety */
.topbar {
  z-index: 260;
  overflow: visible;
}

.usage-help,
.usage-help-panel {
  z-index: 300;
}

.brand-logo,
.brand-block h1 {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 430px) {
  .topbar,
  .brand-block,
  .mode-panel,
  .view-tabs {
    max-width: 100%;
  }
}

/* Buttons / focus safety */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid rgba(0, 139, 143, 0.34) !important;
  outline-offset: 2px;
}

/* Cards / forms / toast safety */
input::placeholder,
textarea::placeholder {
  color: #aab4ae !important;
  font-weight: 400;
  opacity: 1;
}

/* UI/UX refinement layer */
:root {
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --focus-ring: 0 0 0 3px rgba(0, 139, 143, 0.24);
}

.workspace,
.info-hero {
  border-radius: var(--radius-xl);
}

.panel-header,
.output-actions,
.template-type-line,
.detail-spec-panel,
.advanced-detail-fields,
.my-info-panel,
.control-band,
.after-guide,
.phrasebook-panel,
.value-section,
.history-panel,
.data-controls-panel,
.privacy-notice,
.purpose-panel,
.shortcut-panel,
.form-grid > label,
.detail-form-grid > label,
.category-group,
.category-button,
.template-button,
.shortcut-button,
.history-button,
.purpose-button,
.ai-service-links a,
input,
select,
textarea,
#promptOutput {
  border-radius: var(--radius-md);
}

.brand-block {
  min-width: 0;
}

.usage-help {
  z-index: 180;
  overflow: visible;
}

.usage-help-panel {
  position: absolute;
  right: 0;
  z-index: 220;
  width: min(380px, calc(100vw - 40px));
  margin-top: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(37, 46, 43, 0.18), var(--inner-shadow);
  color: var(--ink);
}

.usage-help-panel ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: usage-step;
}

.usage-help-panel li {
  counter-increment: usage-step;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.usage-help-panel li::before {
  content: counter(usage-step);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.usage-help-panel b,
.usage-help-panel span {
  display: block;
}

.usage-help-panel b {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.usage-help-panel span,
.usage-help-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.usage-help-panel p {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.mode-panel {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  max-width: 380px;
  overflow: visible;
}

.mode-panel > div {
  position: relative;
  min-width: 0;
}

.level-buttons {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.18fr) auto;
  overflow: visible;
}

.level-button,
.level-info-button {
  position: relative;
  border-radius: var(--radius-sm);
}

.level-button[data-help]::after {
  content: attr(data-help);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 230;
  width: max-content;
  max-width: min(230px, calc(100vw - 40px));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 7px 9px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 16px 32px rgba(37, 46, 43, 0.16), var(--inner-shadow);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -3px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.level-button:first-child::after {
  left: 0;
  transform: translate(0, -3px);
}

.level-button:nth-child(3)::after {
  right: 0;
  left: auto;
  transform: translate(0, -3px);
}

.level-button:hover::after,
.level-button:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.level-button:first-child:hover::after,
.level-button:first-child:focus-visible::after,
.level-button:nth-child(3):hover::after,
.level-button:nth-child(3):focus-visible::after {
  transform: translate(0, 0);
}

.level-info-button {
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  min-height: 34px;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #f8fbf9;
  cursor: pointer;
  font-weight: 950;
}

.level-info-button:hover,
.level-info-button:focus-visible,
.level-info-button[aria-expanded="true"] {
  background: #ffffff;
  color: var(--accent-strong);
}

.level-help-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 240;
  width: min(320px, calc(100vw - 40px));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 10px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 18px 42px rgba(37, 46, 43, 0.18), var(--inner-shadow);
}

.level-help-popover p {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.level-help-popover p + p {
  margin-top: 6px;
}

.level-help-popover b {
  color: var(--accent-strong);
}

.level-help-popover span {
  color: var(--muted);
  font-weight: 700;
}

.quick-start-steps {
  display: none;
}

.category-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  overflow: visible;
  padding: 4px;
  margin: 0 -4px 14px;
}

.category-group {
  border: 1px solid #d7dfdc;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 8px 20px rgba(37, 46, 43, 0.06), var(--inner-shadow);
}

.category-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.category-toggle::after {
  content: "▶";
  position: static;
  inset: auto;
  justify-self: end;
  min-width: 38px;
  border: 1px solid rgba(0, 139, 143, 0.18);
  border-radius: 999px;
  padding: 2px 7px;
  background: #f3fbfa;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.3;
  opacity: 1;
  pointer-events: none;
  transform: none;
  text-align: center;
}

.category-toggle[aria-expanded="true"]::after {
  content: "▼";
}

.category-toggle:hover::after,
.category-toggle:focus-visible::after {
  opacity: 1;
  transform: none;
}

.category-toggle-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--ink);
}

.category-toggle-main strong,
.category-toggle-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-toggle .category-toggle-main {
  display: grid;
}

.category-toggle .category-toggle-main strong {
  display: block;
  color: var(--ink);
}

.category-toggle .category-toggle-main span {
  display: block;
  color: var(--muted);
}

.category-template-panel {
  display: grid;
  gap: 8px;
  border-top: 1px solid #edf1ef;
  padding: 8px 8px 10px 14px;
}

.category-template-panel .template-button {
  min-height: auto;
  padding: 10px 11px;
}

.category-template-panel .template-button > span {
  display: block;
  color: #52635e;
  font-size: 12px;
  line-height: 1.45;
}

.category-template-panel .template-badges {
  display: flex;
  gap: 4px;
}

.category-template-panel .template-badges em {
  padding: 1px 6px;
  font-size: 10px;
}

.category-template-panel .template-button small {
  margin-top: -1px;
  color: #687872;
  font-size: 11px;
}

.template-list,
.shortcut-list,
.history-list {
  padding: 10px;
  margin: -10px;
  scroll-padding: 12px;
}

.template-list + .shortcut-panel {
  margin-top: 24px;
}

.shortcut-panel + .shortcut-panel {
  margin-top: 10px;
}

.recommended-panel .shortcut-list {
  padding: 10px;
  margin: -8px;
}

.category-button:hover,
.category-button.is-active,
.template-button:hover,
.template-button.is-active,
.shortcut-button:hover,
.shortcut-button.is-active,
.history-button:hover {
  outline: 0;
  box-shadow: 0 0 0 2px rgba(0, 139, 143, 0.16), 0 12px 28px rgba(37, 46, 43, 0.1), var(--inner-shadow);
}

.category-button:focus-visible,
.template-button:focus-visible,
.shortcut-button:focus-visible,
.history-button:focus-visible,
.purpose-button:focus-visible {
  outline: 3px solid rgba(0, 139, 143, 0.34) !important;
  outline-offset: 3px;
}

.selection-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
  line-height: 1.4;
}

.selection-status span {
  color: var(--accent-strong);
  font-weight: 900;
}

.selection-status em,
.info-feature-list li {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(0, 139, 143, 0.18);
  border-radius: 999px;
  padding: 2px 8px;
  background: #e8f7f5;
  color: var(--accent-strong);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.selection-status small {
  flex-basis: 100%;
  color: var(--muted);
  font-weight: 700;
}

.privacy-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 10px;
  align-items: start;
  border-color: #cfe0dc;
  background: #f7fbfa;
}

.privacy-notice strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.privacy-notice strong::before {
  content: "i";
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 950;
}

.privacy-notice p {
  margin: 0;
}

.panel-header .privacy-notice {
  margin: 10px 0 0;
  width: fit-content;
  max-width: 100%;
  padding: 8px 10px;
  box-shadow: none;
}

.panel-header .privacy-notice strong {
  font-size: 12px;
}

.panel-header .privacy-notice p {
  font-size: 12px;
  line-height: 1.55;
  white-space: nowrap;
}

.my-info-panel {
  margin-top: 16px;
}

.data-controls-panel {
  margin: 16px 0 0;
  background: #f7fbfa;
}

.data-controls-panel + .output-jump-button {
  margin-top: 14px;
}

.form-grid > label[data-field="goal"] > span::after,
.form-grid > label[data-field="source"] > span::after {
  content: "入力推奨";
  display: inline-flex;
  margin-left: 7px;
  border-radius: 999px;
  padding: 1px 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 900;
  vertical-align: 1px;
}

.form-grid > label[data-level] > span::after {
  content: "任意";
  display: inline-flex;
  margin-left: 7px;
  border-radius: 999px;
  padding: 1px 6px;
  background: #eef2f2;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  vertical-align: 1px;
}

#promptOutput {
  font-size: 14px;
  line-height: 1.72;
  white-space: pre-wrap;
}

.output-actions {
  align-items: center;
}

.copy-status:not(:empty) {
  line-height: 1.45;
}

.after-hint {
  margin: 10px 0 0;
  border: 1px solid #d7dfdc;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: #f7fbfa;
  color: var(--ink);
}

.after-hint strong {
  display: block;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.after-hint p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.info-hero p {
  max-width: 68ch;
}

.info-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.primary-legal-link {
  border-color: rgba(0, 139, 143, 0.24);
  background: linear-gradient(135deg, #008b8f, #00646a);
  color: #ffffff;
}

@media (max-width: 900px) {
  .mode-panel {
    max-width: 100%;
  }

  .usage-help {
    display: block;
    grid-column: 1 / -1;
    position: relative;
    width: 100%;
  }

  .usage-help > summary {
    width: 100%;
    justify-content: center;
  }

  .usage-help-panel {
    right: auto;
    left: 0;
    width: min(420px, calc(100vw - 72px));
  }

  .category-list {
    display: grid;
    overflow: visible;
    padding: 4px;
  }

  .category-button {
    min-width: 0;
  }
}

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

  .site-info-switch,
  .usage-help,
  .usage-help > summary,
  .mode-panel,
  .view-tabs {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
  }

  .usage-help {
    display: block;
  }

  .usage-help > summary {
    justify-content: center;
  }

  .usage-help-panel,
  .level-help-popover {
    position: static;
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
  }

  .level-button[data-help]::after {
    display: none;
  }

  .level-buttons {
    grid-template-columns: 1fr 1fr 1.1fr auto;
  }

  .level-button {
    min-height: 36px;
    padding: 0 5px;
    font-size: 11px;
  }

  .level-info-button {
    width: 30px;
    min-width: 30px;
  }

  .selection-status {
    gap: 5px;
  }

  .privacy-notice {
    grid-template-columns: 1fr;
  }

  .panel-header .privacy-notice p {
    white-space: normal;
  }

  .category-template-panel {
    padding-left: 10px;
  }

  .template-list,
  .shortcut-list,
  .history-list {
    padding: 9px;
    margin: -9px;
  }
}

/* Final public safety rules */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.topbar {
  position: relative;
  z-index: 260;
  overflow: visible;
}

.workspace,
.mode-panel,
.level-buttons,
.usage-help {
  overflow: visible;
}

.usage-help {
  position: relative;
  z-index: 300;
}

.usage-help-panel,
.usage-help-panel ol,
.level-help-popover {
  overflow: visible;
  z-index: 320;
}

.level-descriptions {
  display: none !important;
}

.brand-logo,
.brand-block h1,
.brand-logo-text,
.brand-word {
  min-width: 0;
  max-width: 100%;
  white-space: nowrap !important;
  word-break: keep-all;
  overflow-wrap: normal;
}

.brand-logo-text {
  display: inline-flex;
  align-items: baseline;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 1180px) {
  .builder-layout {
    grid-template-columns: minmax(280px, 320px) minmax(430px, 0.96fr) minmax(360px, 1fr);
  }

  .output {
    grid-column: auto;
    border-top: 0;
  }
}

@media (max-width: 430px) {
  .brand-logo-text {
    max-width: calc(100vw - 76px);
    font-size: clamp(16px, 6.3vw, 19px);
  }

  .brand-logo .brand-good,
  .brand-logo .brand-ai {
    display: none;
  }

  .brand-logo .brand-desk::after {
    display: none;
  }
}

.panel-header .privacy-notice {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, max-content);
  align-items: start;
  gap: 5px 8px;
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px;
}

.panel-header .privacy-notice strong,
.panel-header .privacy-notice p {
  line-height: 1.35;
}

.panel-header .privacy-notice p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-controls-panel {
  width: 100%;
  padding: 8px 10px;
  gap: 8px;
}

.data-controls-panel strong {
  font-size: 12px;
  line-height: 1.25;
}

.data-controls-panel p {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.45;
}

.data-controls-panel .danger-lite-button {
  min-height: 34px;
  padding: 6px 10px;
}

#promptOutput {
  border-width: 2px;
  border-color: #c5d0cc;
  box-shadow: inset 4px 0 0 rgba(0, 139, 143, 0.14), var(--inner-shadow);
}

.output.is-empty-output #promptOutput {
  border-width: 2px;
  border-color: #c8d5d1;
}

.info-hero,
.info-grid section,
.info-faq {
  border-color: #dce5e2;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 252, 251, 0.98));
  box-shadow: 0 18px 44px rgba(37, 46, 43, 0.08), var(--inner-shadow);
}

.info-actions a,
.legal-back-link {
  min-height: 38px;
  border-color: rgba(0, 139, 143, 0.22);
  border-radius: 999px;
  padding: 0 14px;
  background: #f7fbfa;
}

.info-faq details {
  border-color: #dde7e4;
  background: #fbfdfc;
}

.info-faq summary {
  min-height: 40px;
  padding: 10px 12px;
}

.info-hero h2 {
  letter-spacing: 0;
}

/* Privacy Page Experience */
.privacy-body {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 8%, rgba(0, 139, 143, 0.22), transparent 0 26%),
    radial-gradient(circle at 86% 2%, rgba(191, 148, 74, 0.2), transparent 0 22%),
    linear-gradient(135deg, #111615 0%, #1c2a25 42%, #edf2f0 42%, #f7f9f8 100%);
}

.privacy-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.78), transparent 68%);
}

.privacy-page {
  position: relative;
  width: min(1120px, calc(100% - 36px));
  padding: clamp(24px, 4vw, 48px) 0;
}

.privacy-back-link {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #f6fbfa;
  backdrop-filter: blur(16px);
}

.privacy-shell {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 252, 251, 0.98));
  box-shadow: 0 32px 80px rgba(12, 20, 18, 0.22), var(--inner-shadow);
}

.privacy-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 58px);
  background:
    linear-gradient(135deg, rgba(17, 22, 21, 0.98), rgba(16, 73, 73, 0.92)),
    radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.18), transparent 0 30%);
  color: #f8fffd;
}

.privacy-hero::after {
  content: "";
  position: absolute;
  right: clamp(18px, 6vw, 72px);
  bottom: -52px;
  width: 180px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 38%;
  background: rgba(255, 255, 255, 0.05);
  transform: rotate(18deg);
  animation: privacyFloat 12s ease-in-out infinite;
}

.privacy-kicker {
  margin: 0 0 12px;
  color: #8be7de;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.privacy-hero h1 {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.08;
  letter-spacing: 0;
}

.privacy-hero > p {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 16px 0 0;
  color: rgba(248, 255, 253, 0.82);
  font-size: clamp(14px, 1.8vw, 17px);
  line-height: 1.9;
}

.privacy-points {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: clamp(22px, 4vw, 36px);
}

.privacy-points div {
  min-height: 132px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.privacy-points span,
.privacy-section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 24px;
  border-radius: 999px;
  background: rgba(139, 231, 222, 0.14);
  color: #79ddd4;
  font-size: 11px;
  font-weight: 950;
}

.privacy-points strong {
  display: block;
  margin-top: 18px;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.35;
}

.privacy-points p {
  margin: 7px 0 0;
  color: rgba(248, 255, 253, 0.76);
  font-size: 12px;
  line-height: 1.65;
}

.privacy-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid #dfe8e4;
  background: rgba(255, 255, 255, 0.72);
}

.privacy-nav a {
  border: 1px solid rgba(0, 139, 143, 0.18);
  border-radius: 999px;
  padding: 7px 12px;
  background: #f7fbfa;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.privacy-nav a:hover,
.privacy-nav a:focus-visible {
  border-color: rgba(0, 139, 143, 0.42);
  background: #e9f8f5;
  transform: translateY(-1px);
}

.privacy-section {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: clamp(12px, 3vw, 24px);
  margin: 0 clamp(18px, 4vw, 42px);
  padding: clamp(22px, 4vw, 34px) 0;
  border-bottom: 1px solid #dfe8e4;
}

.privacy-section h2 {
  margin: 0;
  color: #111615;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.35;
  letter-spacing: 0;
}

.privacy-section p {
  max-width: 820px;
  margin: 10px 0 0;
  color: #40504a;
  line-height: 1.9;
}

.privacy-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 2px;
  padding: 0;
  list-style: none;
}

.privacy-chip-list li {
  border: 1px solid #cfe4df;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f4fbf9;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.privacy-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: clamp(18px, 4vw, 42px);
  border: 1px solid rgba(191, 148, 74, 0.28);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  background: linear-gradient(135deg, #fffaf0, #f7fbfa);
}

.privacy-note strong {
  color: #6f551f;
  font-size: 13px;
  white-space: nowrap;
}

.privacy-note p {
  margin: 0;
  color: #4c5b56;
  line-height: 1.7;
}

.privacy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 clamp(18px, 4vw, 42px) clamp(24px, 4vw, 42px);
}

.privacy-actions .legal-back-link {
  margin-bottom: 0;
  background: #f7fbfa;
}

@keyframes privacyFloat {
  0%, 100% {
    transform: translateY(0) rotate(18deg);
  }
  50% {
    transform: translateY(-12px) rotate(24deg);
  }
}

@media (max-width: 760px) {
  .privacy-body {
    background:
      radial-gradient(circle at 20% 0%, rgba(0, 139, 143, 0.2), transparent 0 28%),
      linear-gradient(180deg, #111615 0%, #1b2824 30%, #f1f5f4 30%, #f8faf9 100%);
  }

  .privacy-page {
    width: min(100% - 22px, 620px);
    padding: 18px 0;
  }

  .privacy-hero {
    padding: 24px 18px;
  }

  .privacy-points {
    grid-template-columns: 1fr;
  }

  .privacy-points div {
    min-height: auto;
  }

  .privacy-section {
    grid-template-columns: 1fr;
    margin-inline: 16px;
    gap: 8px;
  }

  .privacy-note {
    grid-template-columns: 1fr;
    margin-inline: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .privacy-hero::after,
  .privacy-nav a {
    animation: none;
    transition: none;
  }
}

/* Editor Header Compact Polish */
.editor .panel-header {
  align-items: start;
  gap: 8px 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.editor .panel-header > div:first-child {
  min-width: 0;
}

.editor .panel-header .label {
  margin-bottom: 1px;
  line-height: 1.25;
}

.editor .panel-header h2 {
  margin-top: 0;
  line-height: 1.18;
}

.editor .panel-header .selection-status {
  margin-top: 6px;
}

.panel-header .privacy-notice {
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  width: 100%;
  max-width: none;
  margin: 4px 0 0;
  padding: 7px 10px;
}

.panel-header .privacy-notice strong,
.panel-header .privacy-notice p {
  line-height: 1.3;
}

.panel-header .privacy-notice p {
  min-width: 0;
}

@media (max-width: 720px) {
  .editor .panel-header {
    gap: 8px;
    padding: 10px;
  }

  .panel-header .privacy-notice {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .panel-header .privacy-notice p {
    white-space: normal;
  }
}

/* Product Experience Simplification */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

.workspace::before,
.topbar::after {
  display: none !important;
}

.workspace,
.panel,
.sidebar,
.editor,
.output {
  box-shadow: none;
}

.topbar {
  padding: 12px 16px;
  gap: 8px 12px;
  background: #111b18;
  box-shadow: none;
}

/* Header / Brand late polish */
.brand-block,
.brand-logo,
.brand-logo-text {
  min-width: 0;
}

.brand-logo {
  margin: 0;
  line-height: 1;
}

.brand-logo-text {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.header-link-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  width: min(100%, 640px);
  margin-top: 5px;
  padding: 3px;
  border: 1px solid rgba(129, 221, 211, 0.34);
  border-radius: 999px;
  background: rgba(236, 252, 249, 0.1);
}

.header-nav-link,
.header-link-button {
  display: inline-flex;
  min-width: 0;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(231, 247, 244, 0.86);
  font: inherit;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.header-nav-link span,
.header-link-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-nav-link.is-primary {
  background: #e8fbf8;
  color: #00676a;
  box-shadow: inset 0 0 0 1px rgba(0, 139, 143, 0.22);
}

.header-nav-link:hover,
.header-nav-link:focus-visible,
.header-link-button:hover,
.header-link-button:focus-visible {
  background: rgba(232, 251, 248, 0.18);
  color: #ffffff;
  outline: 2px solid rgba(129, 221, 211, 0.72);
  outline-offset: 2px;
}

.header-nav-link.is-primary:hover,
.header-nav-link.is-primary:focus-visible {
  background: #ffffff;
  color: #00595c;
}

.inline-link-button {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.inline-link-button:hover,
.inline-link-button:focus-visible {
  color: #004f51;
  outline: 2px solid rgba(0, 139, 143, 0.28);
  outline-offset: 2px;
}

.static-page-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 680px);
  margin: 0 auto 16px;
  padding: 4px;
  border: 1px solid rgba(0, 139, 143, 0.18);
  border-radius: 999px;
  background: rgba(245, 252, 250, 0.92);
  box-shadow: 0 10px 26px rgba(20, 69, 64, 0.08);
}

.static-page-nav a {
  display: inline-flex;
  min-width: 0;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #3d5350;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.static-page-nav a.is-active,
.static-page-nav a:hover,
.static-page-nav a:focus-visible {
  background: #e4fbf8;
  color: #00676a;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(0, 139, 143, 0.22);
}

.legal-shell .privacy-hero {
  margin-top: 0;
}

.route-anchor {
  display: block;
  height: 0;
  scroll-margin-top: 96px;
}

/* Content pages: guide and future reading/category pages */
.content-page {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #f4f7f6 0%, #edf3f2 48%, #f8faf9 100%);
  color: #111615;
}

.content-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(22px, 4vw, 46px) 0;
}

.content-shell > article {
  overflow: hidden;
  border: 1px solid #dbe5e2;
  border-radius: var(--radius-xl);
  background: #fbfdfc;
  box-shadow: 0 24px 70px rgba(37, 46, 43, 0.12), var(--inner-shadow);
}

.content-hero {
  padding: clamp(30px, 5vw, 58px);
  background:
    linear-gradient(135deg, #111615 0%, #193b39 54%, #0f2423 100%);
  color: #f8fffd;
}

.content-kicker {
  margin: 0 0 10px;
  color: #8be7de;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}

.content-hero h1 {
  max-width: 860px;
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.12;
  letter-spacing: 0;
}

.content-hero p {
  max-width: 800px;
  margin: 16px 0 0;
  color: rgba(248, 255, 253, 0.84);
  line-height: 1.9;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin: 0 0 14px;
  color: #51645e;
  font-size: 13px;
  font-weight: 850;
}

.breadcrumb a {
  color: var(--accent-strong);
  text-decoration: none;
}

.content-section {
  padding: clamp(24px, 4vw, 42px);
  border-bottom: 1px solid #dfe8e4;
}

.content-section h2,
.cta-panel h2 {
  margin: 0 0 12px;
  color: #111615;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.35;
  letter-spacing: 0;
}

.content-section p,
.cta-panel p {
  margin: 0 0 14px;
  color: #40504a;
  line-height: 1.9;
}

.category-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.template-card,
.content-columns section,
.example-box,
.cta-panel {
  border: 1px solid #dbe6e2;
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(37, 46, 43, 0.07), var(--inner-shadow);
}

.template-card,
.content-columns section,
.example-box {
  padding: 16px;
}

.template-card span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: #e8fbf8;
  color: #00676a;
  font-size: 11px;
  font-weight: 950;
}

.template-card h3,
.content-columns h3 {
  margin: 10px 0 8px;
  color: #111615;
  font-size: 17px;
  line-height: 1.45;
}

.template-card p,
.content-columns p {
  margin: 0 0 12px;
}

.template-card a,
.related-links a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 139, 143, 0.22);
  border-radius: 999px;
  padding: 0 13px;
  background: #f4fbf9;
  color: #00676a;
  font-size: 13px;
  font-weight: 950;
  text-decoration: none;
}

.content-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.content-check-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 1.2em;
  color: #40504a;
  line-height: 1.75;
}

.content-faq {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.content-faq details {
  border: 1px solid #dbe6e2;
  border-radius: var(--radius-md);
  background: #ffffff;
}

.content-faq summary {
  min-height: 44px;
  padding: 12px 14px;
  color: #111615;
  font-weight: 950;
  cursor: pointer;
}

.content-faq p {
  margin: 0;
  border-top: 1px solid #e4ebe8;
  padding: 0 14px 14px;
}

.cta-panel {
  margin: clamp(24px, 4vw, 42px);
  padding: clamp(20px, 4vw, 32px);
  background: linear-gradient(135deg, #ffffff, #f4fbf9);
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 clamp(18px, 4vw, 42px) clamp(24px, 4vw, 42px);
}

.ad-slot {
  position: relative;
  display: grid;
  min-height: 158px;
  place-items: center;
  width: auto;
  max-width: 100%;
  margin: clamp(26px, 4vw, 42px) clamp(18px, 4vw, 42px);
  border: 1px dashed #c8d6d2;
  border-radius: 8px;
  background:
    repeating-linear-gradient(135deg, rgba(17, 22, 21, 0.025) 0 10px, rgba(255, 255, 255, 0.5) 10px 20px),
    #f8fbfa;
  color: #6b7773;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  box-shadow: none;
}

.ad-slot::before {
  content: "PR";
  position: absolute;
  top: 10px;
  left: 12px;
  border: 1px solid #d7e2df;
  border-radius: 999px;
  padding: 2px 8px;
  background: #ffffff;
  color: #74817d;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.ad-slot span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
}

.ad-slot--inline {
  margin-block: clamp(28px, 4vw, 44px);
}

.ad-slot--footer {
  margin-top: clamp(28px, 4vw, 44px);
  margin-bottom: clamp(28px, 4vw, 46px);
}

.mobile-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .category-card-grid,
  .content-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .content-shell {
    width: min(100%, calc(100% - 20px));
    padding: 14px 0;
  }

  .content-hero,
  .content-section {
    padding: 22px 18px;
  }

  .mobile-stack > *,
  .related-links a,
  .template-card a {
    width: 100%;
    min-height: 44px;
  }

  .cta-panel {
    margin: 18px;
  }

  .ad-slot {
    min-height: 118px;
    margin: 22px 16px;
  }
}

/* Category pages */
.category-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f4f7f6 0%, #edf3f2 46%, #f8faf9 100%);
  color: #111615;
}

.category-page {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(22px, 4vw, 46px) 0;
}

.category-shell {
  overflow: hidden;
  border: 1px solid #dbe5e2;
  border-radius: var(--radius-xl);
  background: #fbfdfc;
  box-shadow: 0 24px 70px rgba(37, 46, 43, 0.12), var(--inner-shadow);
}

.category-hero {
  padding: clamp(30px, 5vw, 58px);
  background:
    linear-gradient(135deg, #111615 0%, #193b39 54%, #0f2423 100%);
  color: #f8fffd;
}

.category-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 18px;
  color: rgba(248, 255, 253, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.category-breadcrumb a {
  color: #bdf4ee;
  text-decoration: none;
}

.category-kicker {
  margin: 0 0 10px;
  color: #8be7de;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}

.category-hero h1 {
  max-width: 840px;
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.12;
  letter-spacing: 0;
}

.category-hero p {
  max-width: 780px;
  margin: 16px 0 0;
  color: rgba(248, 255, 253, 0.84);
  font-size: clamp(14px, 1.6vw, 17px);
  line-height: 1.9;
}

.category-tool-note,
.content-tool-note {
  max-width: 780px;
  margin-top: 18px;
  border: 1px solid rgba(139, 231, 222, 0.24);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 255, 253, 0.78);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.7;
}

.content-tool-note {
  border-color: #d7e2df;
  background: #f7faf9;
  color: #40504a;
}

.category-hero .category-tool-note,
.content-hero .content-tool-note {
  margin-top: 18px;
  color: rgba(248, 255, 253, 0.78);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.7;
}

.content-hero .content-tool-note {
  border-color: rgba(139, 231, 222, 0.24);
  background: rgba(255, 255, 255, 0.08);
}

.category-actions,
.template-link-grid,
.related-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.template-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.category-actions {
  margin-top: 24px;
}

.category-action {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(139, 231, 222, 0.34);
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fffd;
  font-weight: 950;
  text-decoration: none;
}

.category-action.is-primary {
  border-color: #8be7de;
  background: #e9fbf8;
  color: #00676a;
}

.category-section,
.category-related,
.category-template-panel {
  padding: clamp(24px, 4vw, 42px);
  border-bottom: 1px solid #dfe8e4;
}

.category-section h2,
.category-related h2,
.category-template-panel h2 {
  margin: 0 0 12px;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.35;
  letter-spacing: 0;
}

.category-section p,
.category-related p,
.category-template-panel p {
  margin: 0 0 14px;
  color: #40504a;
  line-height: 1.9;
}

.category-can-do {
  background: #f4fbf9;
}

.category-can-do .category-list {
  margin-top: 12px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.category-grid section,
.example-box,
.category-note,
.category-template-card {
  border: 1px solid #dbe6e2;
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(37, 46, 43, 0.07), var(--inner-shadow);
}

.category-grid section,
.example-box,
.category-note,
.category-template-card {
  padding: 16px;
}

.category-grid h3,
.category-template-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.45;
}

.category-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.2em;
  color: #40504a;
  line-height: 1.7;
}

.example-box {
  margin-top: 16px;
  background: #f8fcfb;
}

.example-box dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.example-box dt {
  color: #00676a;
  font-weight: 950;
}

.example-box dd {
  margin: 0;
  color: #40504a;
  line-height: 1.75;
}

.category-note {
  margin-top: 16px;
  border-color: rgba(191, 148, 74, 0.3);
  background: #fffaf0;
}

.category-note strong {
  display: block;
  margin-bottom: 6px;
  color: #71561f;
}

.category-template-card {
  flex: 1 1 240px;
}

.category-template-card p {
  margin-bottom: 12px;
}

.template-direct-link,
.related-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 139, 143, 0.22);
  border-radius: 999px;
  padding: 0 13px;
  background: #f4fbf9;
  color: #00676a;
  font-size: 13px;
  font-weight: 950;
  text-decoration: none;
}

.category-related {
  border-bottom: 0;
}

.category-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 clamp(18px, 4vw, 42px) clamp(24px, 4vw, 42px);
}

@media (max-width: 900px) {
  .category-grid {
    grid-template-columns: 1fr;
  }

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

  .category-action,
  .template-direct-link,
  .related-link {
    min-height: 44px;
  }
}

@media (max-width: 560px) {
  .category-page {
    width: min(100%, calc(100% - 20px));
    padding: 14px 0;
  }

  .category-hero,
  .category-section,
  .category-related,
  .category-template-panel {
    padding: 22px 18px;
  }

  .category-breadcrumb {
    gap: 5px;
    margin-bottom: 14px;
    font-size: 11px;
    line-height: 1.6;
  }

  .category-actions a,
  .template-link-grid a,
  .related-grid a {
    width: 100%;
  }

  .category-action,
  .template-direct-link,
  .related-link {
    padding-inline: 14px;
  }

  .category-actions,
  .template-link-grid,
  .related-grid {
    flex-direction: column;
  }

  .category-template-card {
    flex-basis: 100%;
  }

  .ad-slot {
    min-height: 118px;
    margin: 22px 16px;
  }

  .ad-slot::before {
    top: 8px;
    left: 10px;
  }
}

.usage-help {
  z-index: 80;
}

.usage-help > summary.secondary-button {
  min-height: 31px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  box-shadow: none;
}

.usage-help-panel {
  z-index: 120;
  box-shadow: 0 18px 36px rgba(8, 32, 30, 0.18);
}

.mode-panel {
  padding: 4px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.level-buttons {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(72px, 1.12fr) 28px;
  gap: 4px;
}

.level-button {
  min-height: 30px;
  padding: 0 7px;
  border-radius: var(--radius-md);
  font-size: 12px;
  white-space: nowrap;
}

.level-info-button {
  min-width: 28px;
  min-height: 30px;
  border-radius: var(--radius-md);
}

.purpose-panel {
  padding: 8px;
}

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

.purpose-button {
  min-height: 36px;
  padding: 7px 9px;
  box-shadow: none;
}

.category-button em,
.category-toggle em,
.count-pill {
  font-size: 11px;
  opacity: 0.76;
}

.category-template-panel,
.template-list,
.shortcut-list {
  padding-top: 5px;
  padding-bottom: 5px;
  overflow: visible;
}

/* Privacy and safety notices */
.panel-header .privacy-notice {
  width: 100%;
  max-width: 100%;
  grid-template-columns: auto minmax(0, 1fr);
  background: #f5fbfa;
  border-color: rgba(0, 139, 143, 0.18);
  box-shadow: none;
}

.panel-header .privacy-notice p {
  max-width: none;
}

.data-controls-panel {
  gap: 8px;
  margin-bottom: 10px;
  padding: 6px 8px;
  border-color: rgba(0, 139, 143, 0.13);
  background: #f8fcfb;
  box-shadow: none;
}

.data-controls-panel strong {
  font-size: 12px;
  line-height: 1.2;
}

.data-controls-panel p {
  max-width: none;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
}

.data-control-actions {
  gap: 6px;
}

.data-history-toggle {
  min-height: 26px;
  margin: 0;
  padding: 2px 7px;
  border: 1px solid rgba(0, 139, 143, 0.16);
  border-radius: 999px;
  background: #ffffff;
}

.data-history-toggle input {
  width: 16px;
  height: 16px;
}

.data-history-toggle span {
  font-size: 11px;
  font-weight: 800;
}

.data-controls-panel .compact-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 11px;
}

.phrasebook-panel:not([open]) {
  opacity: 0.9;
}

/* Prompt output */
.output pre,
#promptOutput {
  border-width: 2px;
}

/* Mobile action bar */
.mobile-action-bar {
  grid-template-columns: 1fr;
}

.mobile-action-bar.is-copy-ready {
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
}

.mobile-action-bar [hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 9px 11px;
  }

  .brand-logo {
    font-size: clamp(18px, 5vw, 22px);
  }

  .header-link-nav {
    width: min(100%, 440px);
  }

  .usage-help {
    grid-column: 2;
    width: auto;
    justify-self: end;
  }

  .usage-help > summary {
    width: auto;
    min-width: 40px;
    justify-content: center;
  }

  .usage-help-panel {
    right: 0;
    left: auto;
    width: min(340px, calc(100vw - 24px));
  }

  .mode-panel {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding-top: 0;
  }

  .workspace {
    border-inline: 0;
    border-radius: 0;
  }

  .topbar {
    padding: 7px 9px;
    gap: 5px 7px;
  }

  .brand-mark {
    width: 20px;
    height: 20px;
  }

  .brand-logo-text {
    max-width: calc(100vw - 88px);
    font-size: clamp(17px, 6vw, 19px);
    line-height: 1;
  }

  .brand-logo .brand-good,
  .brand-logo .brand-ai {
    display: none !important;
  }

  .brand-logo .brand-version {
    margin-left: 6px;
    padding: 1px 5px;
    font-size: 8px;
  }

  .brand-version-note {
    font-size: 0;
    gap: 0;
  }

  .brand-version-note::before {
    display: none;
  }

  .brand-version-note::after {
    content: "変更/終了あり";
    font-size: 8px;
    letter-spacing: 0;
  }

  .brand-logo .brand-desk::after,
  .brand-logo-text::after {
    display: none !important;
  }

  .header-link-nav {
    width: min(100%, 340px);
    margin-top: 4px;
    padding: 2px;
  }

  .header-nav-link,
  .header-link-button {
    min-height: 22px;
    padding: 0 3px;
    font-size: 8.4px;
    letter-spacing: 0;
  }

  .static-page-nav {
    gap: 3px;
    padding: 3px;
  }

  .static-page-nav a {
    min-height: 25px;
    padding: 0 3px;
    font-size: 9px;
    letter-spacing: 0;
  }

  .usage-help > summary.secondary-button {
    width: 32px;
    min-width: 32px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    border-radius: 999px;
    font-size: 0;
  }

  .usage-help > summary.secondary-button::before {
    content: "?";
    font-size: 14px;
    font-weight: 900;
  }

  .usage-help[open] {
    grid-column: 1 / -1;
    width: 100%;
  }

  .usage-help[open] > summary.secondary-button {
    margin-left: auto;
  }

  .usage-help-panel {
    position: static;
    width: 100%;
    margin-top: 4px;
    padding: 10px;
  }

  .usage-help-panel ol {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .mode-panel {
    padding: 3px;
  }

  .level-buttons {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(66px, 1.08fr) 26px;
  }

  .level-button {
    min-height: 29px;
    padding: 0 4px;
    font-size: 10.5px;
  }

  .level-info-button {
    min-width: 26px;
    min-height: 29px;
  }

  .purpose-panel {
    padding: 7px;
  }

  .purpose-grid {
    gap: 6px;
  }

  .purpose-button {
    min-height: 34px;
    font-size: 12px;
  }

  .panel-header .privacy-notice {
    padding: 7px 9px;
  }

  .panel-header .privacy-notice p {
    white-space: normal;
  }

  .data-controls-panel {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 6px 8px;
  }

  .data-controls-panel p {
    white-space: normal;
  }

  .mobile-action-bar {
    padding: 6px;
    gap: 6px;
  }

  .mobile-action-bar .primary-button,
  .mobile-action-bar .secondary-button {
    min-height: 39px;
  }
}

@media (max-width: 430px) {
  .brand-logo-text {
    max-width: calc(100vw - 72px);
  }

  .header-link-nav {
    width: min(100%, 270px);
  }

}

/* Final production guards
   Keep this block at the end. These rules intentionally win over earlier
   responsive polish to prevent public admin exposure and mobile regressions. */

/* Layout floor: prevent accidental horizontal overflow from late additions. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Mobile action bar: keep iPhone safe-area clearance after all prior overrides. */
@media (max-width: 900px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-action-bar {
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  }
}

/* Header / Brand: mobile short logo must not wrap vertically. */
@media (max-width: 560px) {
  .brand-logo-text {
    display: inline-flex;
    max-width: calc(100vw - 84px);
    overflow: hidden;
    white-space: nowrap;
  }

  .brand-good,
  .brand-ai {
    display: none;
  }

  .header-link-nav,
  .static-page-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .header-link-nav {
    width: min(100%, 340px);
  }

  .header-nav-link,
  .header-link-button,
  .static-page-nav a {
    letter-spacing: 0;
  }
}

/* Admin visibility guards: normal visitors must never see admin entry points. */
body:not(.is-admin-mode) #openAdminButton,
body:not(.is-admin-mode) #adminTab,
body:not(.is-admin-mode) #adminView,
body:not(.is-admin-mode) #adminAuthModal,
[hidden],
.admin-open-button[hidden],
#openAdminButton[hidden],
#adminTab[hidden] {
  display: none !important;
}
