:root {
  --bg: #f4f4f2;
  --panel: #ffffff;
  --text: #111111;
  --muted: #5f5f5f;
  --line: #d7d7d2;
  --line-strong: #8e8e88;
  --accent: #1a1a1a;
  --error-bg: #f7eaea;
  --error-text: #9b2424;
  --shadow: 0 14px 40px rgba(17, 17, 17, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans JP", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(0, 0, 0, 0.03), transparent 32%),
    linear-gradient(180deg, #fafaf8 0%, var(--bg) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  padding: 20px 4px 24px;
}

.eyebrow {
  margin: 0 0 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.04;
}

.hero-copy {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-panel,
.preview-panel,
.output-panel {
  padding: 22px;
}

.panel-heading {
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.panel-heading p,
.output-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.form-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.save-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.form-section {
  margin: 0 0 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.01), transparent);
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.accordion-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.accordion-toggle::after {
  content: "+";
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  color: var(--muted);
}

.accordion.is-open .accordion-toggle::after {
  content: "-";
}

.accordion-panel {
  padding: 0 16px 16px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field span,
.check-field span {
  font-size: 0.92rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  color: var(--text);
}

.color-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-field input[type="color"] {
  min-width: 72px;
  height: 46px;
  padding: 6px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  flex: 0 0 auto;
}

.field textarea {
  resize: vertical;
  min-height: 88px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.primary-button:focus {
  outline: 2px solid #000;
  outline-offset: 2px;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.check-field input {
  width: 18px;
  height: 18px;
}

.meta-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  background: #fbfbfa;
}

.print-note {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafaf8;
}

.print-note span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.print-note p {
  margin: 0;
  line-height: 1.6;
  white-space: pre-line;
}

.meta-note strong {
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
}

.is-hidden {
  display: none;
}

.error-box {
  display: none;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #e5bebe;
  background: var(--error-bg);
  color: var(--error-text);
  line-height: 1.6;
}

.error-box.is-visible {
  display: block;
}

.preview-wrap {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    #f8f8f6;
  background-size: 20px 20px;
}

#previewCanvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #fff;
}


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

.checklist-box {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fafaf8;
  border: 1px solid var(--line);
}

.checklist-heading {
  margin-bottom: 12px;
}

.checklist-heading strong {
  display: block;
  margin-bottom: 4px;
}

.checklist-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.checklist-list {
  display: grid;
  gap: 10px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.checklist-item input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.checklist-item span {
  line-height: 1.5;
}

.output-note {
  flex: 1;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fafaf8;
  border: 1px solid var(--line);
}

.output-note strong {
  display: block;
  margin-bottom: 6px;
}

.customize-card {
  margin-top: 20px;
}

.customize-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.customize-card-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.customize-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.customize-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: #fafaf8;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.customize-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.customize-link {
  text-decoration: none;
}

.primary-button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 15px 28px;
  font-weight: 600;
  cursor: pointer;
  min-width: 180px;
}

.primary-button:hover {
  background: #2a2a2a;
}

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

.secondary-button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
}

.secondary-button:hover {
  background: #f4f4f2;
}

.danger-button {
  border-color: #c99d9d;
  color: #7e1f1f;
}

.danger-button:hover {
  background: #fbefef;
}

.app-credit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 10px 4px 0;
}

.credit-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.credit-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}


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

  .output-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .app-credit {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .primary-button {
    width: 100%;
  }

  .customize-actions {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 18px;
    padding-bottom: 24px;
  }

  .form-panel,
  .preview-panel,
  .output-panel {
    padding: 18px;
  }

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

  .meta-note {
    flex-direction: column;
    align-items: flex-start;
  }
}
