:root {
  color-scheme: light;
  --ink: #1e2933;
  --muted: #66727c;
  --line: #dce2e7;
  --canvas: #f3f6f8;
  --navy: #1c3d5a;
  --navy-dark: #153047;
  --focus: #1672b8;
  --white: #fff;
  font-family:
    "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 320px;
  overflow: hidden;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.6;
}

button,
input,
textarea,
select {
  font: inherit;
}
button {
  color: inherit;
}
button,
select,
input[type="radio"],
input[type="checkbox"] {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 2px 10px rgb(23 42 58 / 4%);
}

.brand {
  display: flex;
  min-width: 192px;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: var(--navy);
  color: #fff;
  font:
    700 18px/1 Montserrat,
    sans-serif;
}
.brand-copy {
  display: grid;
  gap: 1px;
}
.brand-copy strong {
  font-size: 15px;
  letter-spacing: 0.02em;
}
.brand-copy > span {
  color: var(--muted);
  font-size: 11px;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.mode-switch,
.device-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7f9fa;
}
.mode-button,
.device-button {
  min-height: 32px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5e6972;
  font-size: 12px;
  white-space: nowrap;
}
.mode-button.is-active,
.device-button.is-active {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 4px rgb(29 47 62 / 15%);
  font-weight: 700;
}
.page-picker {
  display: grid;
  gap: 1px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}
.page-picker select {
  min-width: 120px;
  height: 34px;
  padding: 4px 26px 4px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}
.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--navy);
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition:
    background-color 0.16s ease,
    transform 0.16s ease,
    box-shadow 0.16s ease;
}
.primary-button:hover {
  background: var(--navy-dark);
  box-shadow: 0 4px 12px rgb(28 61 90 / 18%);
}
.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}
.secondary-button {
  border-color: var(--line);
  background: #fff;
  color: var(--navy);
}
.secondary-button:hover {
  background: #f5f8fa;
}
.submit-button {
  min-width: 168px;
  min-height: 40px;
  padding-inline: 13px;
  font-size: 13px;
  white-space: nowrap;
}

.workspace {
  display: grid;
  width: 100%;
  min-height: 0;
  grid-template-columns: 352px minmax(0, 1fr);
}
.settings-panel {
  z-index: 2;
  overflow: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  background: #fff;
  scrollbar-color: #b9c4cc transparent;
  scrollbar-width: thin;
}
.panel-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 21px 22px 17px;
  border-bottom: 1px solid #edf0f2;
}
.eyebrow {
  margin: 0 0 3px;
  color: #758594;
  font:
    700 9px/1.4 Montserrat,
    sans-serif;
  letter-spacing: 0.15em;
}
.panel-heading h1 {
  margin: 0;
  color: #172f43;
  font-size: 20px;
  line-height: 1.45;
}
.panel-intro {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.status-pill {
  flex: none;
  padding: 4px 9px;
  border: 1px solid #ead8ae;
  border-radius: 999px;
  background: #fff8e8;
  color: #785918;
  font-size: 11px;
  font-weight: 700;
}
.panel-close {
  display: none;
}
.change-toolbar {
  position: sticky;
  z-index: 3;
  top: 0;
  padding: 9px 14px 8px;
  border-bottom: 1px solid #e7ecef;
  background: #fff;
}
.change-toolbar-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
}
.change-count {
  min-width: 0;
  overflow: hidden;
  color: #42596a;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.review-open-button {
  min-height: 40px;
  padding: 6px 8px;
  font-size: 10px;
  white-space: nowrap;
}
.change-toolbar .history-actions {
  gap: 5px;
}
.change-toolbar .history-actions button {
  min-width: 64px;
  min-height: 40px;
  padding: 6px 7px;
  font-size: 10px;
  white-space: nowrap;
}
.change-storage-summary {
  margin: 5px 0 0;
  color: #78858d;
  font-size: 9px;
  line-height: 1.45;
}

#photo-search {
  scroll-margin-top: calc(var(--settings-toolbar-height, 0px) + 12px);
}

.setting-group {
  border-bottom: 1px solid #edf0f2;
}
.setting-group > summary {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  color: #22394d;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.setting-group > summary::-webkit-details-marker {
  display: none;
}
.group-toggle {
  display: grid;
  width: 18px;
  height: 20px;
  flex: none;
  place-items: center;
  margin-left: auto;
  color: #74818a;
}
.group-toggle svg {
  width: 18px;
  height: 18px;
}
.group-toggle .lucide-minus,
.setting-group[open] > summary .lucide-plus {
  display: none;
}
.setting-group[open] > summary .lucide-minus {
  display: block;
}
.group-icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: #788a98;
}
.group-body {
  padding: 1px 22px 19px;
}
.fields {
  display: grid;
  gap: 8px;
}
.fields > label,
.field-title label,
.font-fieldset legend {
  color: #40515e;
  font-size: 12px;
  font-weight: 700;
}
.fields input[type="text"],
.website-modal input[type="url"],
.fields select,
.fields textarea {
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  border: 1px solid #ccd5dc;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}
.fields input[type="file"] {
  width: 100%;
  min-width: 0;
  font-size: 12px;
}
.photo-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid #dce3e8;
  border-radius: 7px;
  background-position: center;
  background-size: cover;
}
.photo-preview[hidden] {
  display: none;
}
.photo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}
.photo-actions button {
  font-size: 11px;
}
.photo-search-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}
.photo-search-row input[type="search"] {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #ccd5dc;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}
.photo-search-row .text-button {
  flex: none;
  padding-inline: 2px;
  min-height: 40px;
  white-space: nowrap;
}
.photo-search-count {
  min-height: 17px;
}
.fields textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.7;
}
.helper {
  margin: 1px 0 0;
  color: #75818a;
  font-size: 11px;
  line-height: 1.65;
}
.group-note {
  margin: 2px 0 11px;
}
.field-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.contrast-value {
  color: #52616d;
  font:
    600 11px Montserrat,
    sans-serif;
}
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-picker-row input[type="color"] {
  width: 45px;
  height: 34px;
  flex: none;
  padding: 3px;
  border: 1px solid #cbd4db;
  border-radius: 7px;
  background: #fff;
}
.color-code-field {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}
.color-code-field label {
  color: #53616c;
  font-size: 10px;
  font-weight: 700;
}
.color-code-field input {
  width: 100%;
  min-height: 39px;
  padding: 7px 10px;
  border: 1px solid #ccd5dc;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-family: Montserrat, sans-serif;
  font-size: 16px;
  letter-spacing: 0.03em;
}
.color-code-field input[aria-invalid="true"] {
  border-color: #bd5147;
  background: #fff8f6;
}
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 1px 0 2px;
}
.swatch {
  position: relative;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--swatch-color);
  box-shadow: 0 0 0 1px #c9d2d9;
}
.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--navy);
}
.swatch::after {
  position: absolute;
  inset: 6px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  content: "";
  opacity: 0;
  transform: rotate(45deg);
}
.swatch[aria-pressed="true"]::after {
  opacity: 1;
}
.swatch[data-color="#1f5f8b"] {
  --swatch-color: #1f5f8b;
}
.swatch[data-color="#1c3d5a"] {
  --swatch-color: #1c3d5a;
}
.swatch[data-color="#245b45"] {
  --swatch-color: #245b45;
}
.swatch[data-color="#7d3226"] {
  --swatch-color: #7d3226;
}
.swatch[data-color="#4e3b78"] {
  --swatch-color: #4e3b78;
}
.swatch[data-color="#6a3f78"] {
  --swatch-color: #6a3f78;
}
.swatch[data-color="#474747"] {
  --swatch-color: #474747;
}
.swatch[data-color="#a05a18"] {
  --swatch-color: #a05a18;
}
.warning {
  margin: 0;
  color: #a83228;
  font-size: 12px;
  font-weight: 700;
}
.font-fieldset {
  min-width: 0;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
}
.font-fieldset legend {
  margin-bottom: 8px;
}
.font-options {
  display: grid;
  gap: 7px;
}
.font-card {
  display: flex;
  align-items: stretch;
  cursor: pointer;
}
.font-card > input {
  width: 16px;
  height: 16px;
  flex: none;
  align-self: center;
  margin: 0 9px 0 1px;
  accent-color: var(--navy);
}
.font-card-body {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 1px;
  padding: 8px 10px;
  border: 1px solid #dce3e8;
  border-radius: 7px;
  background: #fff;
}
.font-card:has(input:checked) .font-card-body {
  border-color: #658198;
  background: #f2f6f9;
  box-shadow: inset 0 0 0 1px #658198;
}
.font-card-body strong {
  color: #334754;
  font-size: 11px;
}
.font-sample {
  overflow: hidden;
  color: #182f42;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.font-card-body small {
  overflow: hidden;
  color: #7a8790;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fields input[type="file"] {
  width: 100%;
  padding: 8px;
  border: 1px dashed #c8d2da;
  border-radius: 7px;
  background: #f8fafb;
  color: #52616c;
  font-size: 11px;
}
.fields input[type="file"]::file-selector-button {
  margin-right: 8px;
  padding: 5px 8px;
  border: 1px solid #cbd5dc;
  border-radius: 5px;
  background: #fff;
  color: #31485a;
  font-size: 11px;
}
.text-button {
  width: fit-content;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #45677f;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.text-button:hover {
  color: var(--navy-dark);
}
.toggle-list {
  display: grid;
}
.toggle-row {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #eff2f4;
  color: #344a5a;
  font-size: 12px;
}
.toggle-row:last-child {
  border-bottom: 0;
}
.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #6b7880;
  font-size: 10px;
  white-space: nowrap;
}
.toggle-control input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--navy);
}
.section-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.section-row {
  display: grid;
  min-height: 49px;
  grid-template-columns: 21px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border: 1px solid #e0e6ea;
  border-radius: 7px;
  background: #fff;
}
.order-row.is-dragging {
  opacity: 0.45;
}
.order-row.is-drop-target {
  border-color: #658198;
  background: #f1f6f9;
}
.drag-handle {
  color: #87949d;
  cursor: grab;
  font:
    700 16px/1 Montserrat,
    sans-serif;
  text-align: center;
  touch-action: none;
}
.section-row[data-section="hero"] .drag-handle {
  visibility: hidden;
}
.section-label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: #344b5b;
  font-size: 11px;
}
.bilingual-label {
  display: flex;
  min-width: 0;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 6px;
  line-height: 1.25;
}
.bilingual-label-ja {
  overflow: hidden;
  color: #344b5b;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bilingual-label-en {
  overflow: hidden;
  color: #596d7b;
  font:
    500 10px/1.2 Montserrat,
    sans-serif;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-position {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: none;
  align-items: center;
  justify-content: center;
  border: 1px solid #dce3e8;
  border-radius: 50%;
  background: #f7f9fa;
  color: #657681;
  font:
    600 9px/1 Montserrat,
    sans-serif;
}
.section-fixed {
  display: block;
  color: #8a959c;
  font-size: 9px;
}
.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.section-actions label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #687780;
  font-size: 9px;
  white-space: nowrap;
}
.section-actions input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--navy);
}
.move-button {
  display: grid;
  width: 23px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 1px solid #d9e0e5;
  border-radius: 5px;
  background: #fff;
  color: #526775;
  font-size: 12px;
  line-height: 1;
}
.move-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}
.page-row {
  display: grid;
  min-height: 64px;
  grid-template-columns: 21px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 7px;
  padding: 6px 7px;
  border-bottom: 1px solid #eff2f4;
}
.page-row .drag-handle {
  grid-row: 1 / 3;
}
.page-row-info {
  display: flex;
  min-width: 0;
  grid-column: 2;
  grid-row: 1;
  align-items: center;
  gap: 7px;
}
.page-row-info > span:last-child {
  min-width: 0;
}
.page-row-actions {
  grid-column: 3;
  grid-row: 1;
}
.page-row-toggles {
  display: flex;
  min-width: 0;
  grid-column: 2 / 4;
  grid-row: 2;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.page-row-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #52616c;
  font-size: 10px;
}
.page-row-toggles input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--navy);
}
.page-row-toggles input:disabled + span {
  color: #839099;
}
.panel-footer {
  display: grid;
  justify-items: stretch;
  gap: 10px;
  padding: 18px 22px 28px;
}
.full-button {
  width: 100%;
}
.panel-footer > .text-button {
  justify-self: center;
  padding: 4px 0;
  font-size: 12px;
}
.panel-footer .mode-switch {
  justify-self: center;
}
.history-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.history-actions button {
  min-height: 40px;
  padding: 7px 10px;
}
.history-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}
.panel-footer p {
  margin: 0;
  color: #89939a;
  font-size: 10px;
  text-align: center;
}

.preview-area {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(46px, auto) minmax(0, 1fr);
  padding: 13px 17px 17px;
  background: #e9eef2;
}
.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 9px;
  color: #344a5b;
  font-size: 11px;
}
.preview-heading > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-heading-title {
  gap: 8px;
}
.preview-page-current {
  overflow: hidden;
  color: #1c3d5a;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-site-current {
  overflow: hidden;
  color: #78858e;
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-heading-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.photo-edit-toggle,
#layout-edit-toggle {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 10px;
  white-space: nowrap;
}
.layout-control-fields {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
#layout-edit-toggle[aria-pressed="true"],
#layout-pick-button[aria-pressed="true"] {
  border-color: var(--focus);
  background: #edf5fa;
  color: #174f73;
}
.photo-edit-toggle[aria-pressed="true"] {
  border-color: #287c5a;
  background: #e9f5ef;
  color: #1b6647;
}
.live-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #38926b;
  box-shadow: 0 0 0 3px rgb(56 146 107 / 12%);
}
#preview-size-label {
  color: #73818b;
  font-size: 10px;
}
.preview-stage {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: stretch center;
  overflow: hidden;
  border: 1px solid #d1d9df;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgb(30 50 66 / 9%);
}
.preview-frame {
  position: absolute;
  inset: 0;
  display: block;
  left: 50%;
  right: auto;
  width: var(--preview-width, 100%);
  height: var(--preview-height, 100%);
  border: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) scale(var(--preview-scale, 1));
  transform-origin: top center;
  transition: opacity 0.18s ease;
}
.preview-frame.is-active {
  z-index: 1;
  opacity: 1;
  pointer-events: auto;
}
.preview-frame.is-loading {
  z-index: 2;
  opacity: 0;
}
.preview-frame.is-mobile {
  border-right: 1px solid #d1d9df;
  border-left: 1px solid #d1d9df;
  box-shadow: 0 0 25px rgb(31 47 60 / 12%);
}
.mobile-settings-handle {
  display: none;
}
.mobile-scrim {
  display: none;
}

.modal {
  width: min(640px, calc(100vw - 30px));
  max-height: min(82dvh, 780px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #d6dee4;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 80px rgb(15 30 42 / 25%);
}
.modal::backdrop {
  background: rgb(16 31 43 / 48%);
  backdrop-filter: blur(2px);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 20px 23px 15px;
  border-bottom: 1px solid #e9edf0;
}
.modal-head h2 {
  margin: 0;
  color: #1b3448;
  font-size: 20px;
}
.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  padding: 0 0 3px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: #596873;
  font-size: 24px;
  line-height: 1;
}
.modal-description {
  margin: 14px 23px 10px;
  color: #687780;
  font-size: 12px;
}
.config-output {
  max-height: 55dvh;
  margin: 0 23px;
  padding: 15px;
  overflow: auto;
  border: 1px solid #dce3e8;
  border-radius: 8px;
  background: #f6f8f9;
  color: #243744;
  font:
    12px/1.75 ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 23px 20px;
}
.modal-actions .primary-button,
.modal-actions .secondary-button {
  min-width: 104px;
}
.review-modal[open],
.reset-modal[open] {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
dialog:not([open]) {
  display: none !important;
}
.review-list {
  display: grid;
  max-height: min(38dvh, 340px);
  gap: 7px;
  margin: 0 23px 10px;
  padding: 0 7px 0 22px;
  overflow: auto;
  color: #344a57;
  font-size: 12px;
  line-height: 1.65;
}
.review-list li {
  padding-inline-start: 2px;
  overflow-wrap: anywhere;
}
.review-list li::marker {
  color: #658198;
}
.review-empty {
  margin: 0;
  color: #64747f;
  font-size: 12px;
}
.review-storage-note {
  margin: 0 23px 10px;
  padding: 10px 12px;
  border-radius: 7px;
  background: #f2f6f8;
  color: #586976;
  font-size: 11px;
  line-height: 1.65;
}
.review-notice {
  margin: 0 23px 2px;
  padding: 10px 12px;
  border: 1px solid #dce7e0;
  border-radius: 7px;
  background: #f3f8f4;
  color: #3c654f;
  font-size: 11px;
  line-height: 1.6;
}
.review-actions {
  flex-wrap: wrap;
}
.review-actions .primary-button {
  min-width: 190px;
}
.mode-description {
  max-width: 300px;
  justify-self: center;
  color: #74818a;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}
.result-modal {
  width: min(500px, calc(100vw - 30px));
}
.result-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 23px 24px 15px;
}
.result-message p {
  margin: 0;
  color: #344a57;
  font-size: 14px;
  font-weight: 700;
}
.result-check {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: #e8f4ed;
  color: #22734a;
  font-weight: 700;
}
.status-note {
  margin: 0 24px;
  padding: 12px 14px;
  border: 1px solid #f0e1bf;
  border-radius: 8px;
  background: #fff9ec;
  color: #67542d;
  font-size: 12px;
}
.status-note strong {
  margin-left: 4px;
}

@media (max-width: 1120px) and (min-width: 769px) {
  .topbar {
    gap: 10px;
    padding-inline: 15px;
  }
  .brand {
    min-width: 155px;
  }
  .toolbar-controls {
    gap: 6px;
  }
  .mode-button,
  .device-button {
    padding-inline: 7px;
    font-size: 11px;
  }
  .submit-button {
    min-width: 145px;
    font-size: 12px;
  }
  .workspace {
    grid-template-columns: 330px minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  body {
    background: #e9eef2;
  }
  .topbar {
    display: grid;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 10px;
    padding: 9px 12px;
  }
  .brand {
    min-width: 0;
    gap: 7px;
  }
  .brand-mark {
    width: 31px;
    height: 31px;
    border-radius: 9px;
    font-size: 15px;
  }
  .brand-copy strong {
    font-size: 13px;
  }
  .brand-copy > span {
    font-size: 10px;
  }
  .toolbar-controls {
    display: contents;
  }
  .device-switch {
    grid-column: 2 / 3;
    grid-row: 1;
    justify-self: end;
  }
  .mode-button,
  .device-button {
    min-height: 29px;
    padding: 4px 6px;
    font-size: 9px;
  }
  .page-picker {
    grid-column: 1 / 2;
    grid-row: 2;
    justify-self: stretch;
  }
  .page-picker span {
    display: none;
  }
  .page-picker select {
    width: 100%;
    min-width: 0;
    height: 35px;
    font-size: 12px;
  }
  .submit-button {
    grid-column: 2 / 3;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 6px 7px;
    font-size: 11px;
  }
  .workspace {
    display: block;
    position: relative;
  }
  .settings-panel {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    height: min(82dvh, 740px);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 17px 17px 0 0;
    box-shadow: 0 -12px 45px rgb(25 42 55 / 20%);
    transform: translateY(105%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  body.settings-open .settings-panel {
    transform: translateY(0);
  }
  .panel-heading {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
    min-height: 79px;
    padding: 14px 18px 11px;
  }
  .change-toolbar {
    top: var(--panel-heading-height, 79px);
    padding-inline: 14px;
  }
  .change-toolbar-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .change-toolbar .history-actions {
    grid-column: 1 / -1;
  }
  .change-toolbar .history-actions button {
    min-width: 0;
    flex: 1;
    min-height: 44px;
    padding-inline: 5px;
    font-size: 12px;
  }
  .review-open-button {
    min-height: 44px;
    padding-inline: 7px;
    font-size: 11px;
  }
  .change-count,
  .change-storage-summary {
    font-size: 11px;
  }
  .panel-heading h1 {
    font-size: 17px;
  }
  .panel-intro {
    max-width: 240px;
    font-size: 10px;
  }
  .panel-close {
    display: inline-flex;
    flex: none;
    align-items: center;
    padding: 7px 9px;
    border: 1px solid #d9e1e6;
    border-radius: 7px;
    background: #fff;
    color: #3f596b;
    font-size: 10px;
  }
  .status-pill {
    position: absolute;
    top: 12px;
    right: 112px;
  }
  .setting-group > summary {
    min-height: 48px;
    padding: 10px 18px;
  }
  .group-body {
    padding: 1px 18px 17px;
  }
  .preview-area {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-rows: minmax(72px, auto) minmax(0, 1fr);
    padding: 6px 7px 8px;
    background: #e9eef2;
  }
  .preview-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    align-content: center;
    padding: 0 4px 6px;
    font-size: 10px;
  }
  .preview-heading-title {
    min-height: 18px;
  }
  .preview-page-current {
    font-size: 11px;
  }
  .preview-site-current {
    display: none;
    font-size: 9px;
  }
  .preview-heading-actions {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .photo-edit-toggle,
  #layout-edit-toggle {
    min-height: 44px;
    max-width: calc(100% - 76px);
    padding: 7px 10px;
    font-size: 10px;
  }
  .photo-search-row .text-button,
  .photo-actions button,
  .panel-footer #reset-button {
    min-height: 44px;
  }
  #preview-size-label {
    font-size: 9px;
    white-space: nowrap;
  }
  .preview-stage {
    border-radius: 8px;
  }
  .mobile-settings-handle {
    position: fixed;
    z-index: 20;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 50%;
    display: flex;
    min-width: 170px;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 6px 16px;
    border: 1px solid #d5dde3;
    border-radius: 999px;
    background: #fff;
    color: #203d53;
    box-shadow: 0 5px 22px rgb(25 41 53 / 20%);
    font-size: 12px;
    font-weight: 700;
    transform: translateX(-50%);
  }
  body.settings-open .mobile-settings-handle {
    opacity: 0;
    pointer-events: none;
  }
  .handle-grip {
    width: 18px;
    height: 3px;
    border-radius: 3px;
    background: #8e9aa2;
  }
  .handle-count {
    color: #87939b;
    font-size: 10px;
    font-weight: 400;
  }
  .mobile-scrim:not([hidden]) {
    position: fixed;
    z-index: 35;
    inset: 0;
    display: block;
    background: rgb(18 32 43 / 35%);
  }
  body.settings-open .preview-heading,
  body.settings-open .preview-stage {
    pointer-events: none;
  }
  .panel-footer {
    padding-bottom: 25px;
  }
  .history-actions button {
    min-height: 44px;
  }
  .icon-button {
    width: 44px;
    height: 44px;
  }
  .modal {
    max-height: 86dvh;
  }
  .review-list {
    max-height: 30dvh;
    margin-inline: 17px;
  }
  .review-storage-note,
  .review-notice {
    margin-inline: 17px;
  }
  .review-actions {
    display: grid;
    grid-template-columns: 1fr;
    padding: 12px 17px 17px;
  }
  .review-actions .primary-button,
  .review-actions .secondary-button {
    width: 100%;
    min-height: 44px;
  }
  .mode-description {
    font-size: 10px;
  }
}

@media (max-width: 370px) {
  .mode-button,
  .device-button {
    padding-inline: 5px;
    font-size: 9px;
  }
  .mode-switch,
  .device-switch {
    gap: 0;
  }
  .brand-copy strong {
    font-size: 12px;
  }
  .settings-panel {
    height: 86dvh;
  }
}

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

.preview-error {
  position: fixed;
  z-index: 70;
  top: 12px;
  left: 50%;
  width: min(580px, calc(100% - 24px));
  margin: 0;
  padding: 12px 16px;
  border: 1px solid #bc4c3b;
  border-radius: 8px;
  background: #fff5f2;
  color: #8e2c21;
  box-shadow: 0 4px 20px rgb(25 42 55 / 15%);
  transform: translateX(-50%);
}
.preview-error[hidden] {
  display: none;
}

/* 編集の状態と入力エラーは、補足説明と分けて読める大きさで表示する。 */
.field-status,
.warning,
.review-notice,
.modal-description {
  font-size: 14px;
  line-height: 1.6;
}
.field-status {
  margin: 0;
  overflow-wrap: anywhere;
}
.field-status[hidden] {
  display: none;
}
#text-slot {
  scroll-margin-top: calc(var(--settings-toolbar-height, 0px) + 12px);
}
#layout-target {
  scroll-margin-top: calc(var(--settings-toolbar-height, 0px) + 40px);
}
.bilingual-label-en {
  font-size: 12px;
}
.change-toolbar {
  padding-block: 10px;
}

[hidden] {
  display: none !important;
}

.template-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.template-card {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  text-align: left;
  font-size: 12px;
}
.template-card[aria-pressed="true"] {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px var(--focus);
}
.template-thumbnail {
  display: grid;
  height: 65px;
  align-content: start;
  gap: 5px;
  overflow: hidden;
  padding: 7px;
  border: 1px solid #e5e9ec;
  border-radius: 4px;
  background: #f4f6f8;
}
.template-thumbnail::before {
  content: "";
  width: 40%;
  height: 4px;
  background: #647d91;
}
.template-thumbnail::after {
  content: "";
  height: 36px;
  background: linear-gradient(150deg, #b9cbd5 45%, #617c8e 46%);
}
.template-thumbnail[data-template="photo"] {
  background: #263b49;
}
.template-thumbnail[data-template="photo"]::before {
  background: #d3dfe6;
}
.template-thumbnail[data-template="photo"]::after {
  height: 43px;
  background: linear-gradient(160deg, #527768, #9fb6b0 55%, #e6ece7);
}
.template-thumbnail[data-template="friendly"] {
  background: #f5eee3;
}
.template-thumbnail[data-template="friendly"]::after {
  width: 65%;
  justify-self: end;
  border-radius: 8px;
  background: #bda88d;
}
.design-status,
.design-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.design-status {
  color: var(--ink);
}
.library-panel {
  margin-bottom: 20px;
}
.section-library {
  display: grid;
  gap: 8px;
}
.library-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.library-card strong {
  font-size: 13px;
}
.library-card button {
  min-height: 36px;
  white-space: nowrap;
}
.library-card.is-added {
  border-color: #92af9e;
  background: #f4f9f6;
}
.design-fields-divider {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}

.assist-start { display: grid; gap: 8px; margin: 14px 18px; padding: 15px; border: 1px solid #d3e2e8; border-radius: 10px; background: #f2f8fa; }
.assist-start strong { font-size: 13px; color: var(--navy); }
.assist-start p, .assist-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.assist-button { display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
.assist-button svg { width: 17px; height: 17px; flex: none; }
.assist-mode { margin: 0; color: #567282; font-size: 11px; }
.assist-modal { width: min(720px, calc(100vw - 24px)); }
.assist-modal[open] { display: flex; flex-direction: column; }
.assist-body { min-height: 0; padding: 20px 23px; overflow-y: auto; overscroll-behavior: contain; }
.assist-body.fields { gap: 12px; }
.assist-body input:not([type=checkbox],[type=radio]), .assist-body textarea, .assist-body select { width: 100%; min-width: 0; }
.assist-body h3 { margin: 8px 0 12px; font-size: 15px; }
.assist-search { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.assist-search button { min-width: 72px; }
.assist-profile { margin-top: 14px; }
.assist-check { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.8; cursor: pointer; }
.assist-check input { width: 17px; height: 17px; flex: none; margin: 3px 0 0; }
.ai-controls-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); gap: 12px; }
.ai-controls-grid > .fields { gap: 6px; min-width: 0; }
.assist-comparison { display: grid; gap: 10px; overflow-wrap: anywhere; }
.assist-comparison > div { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #f7f9fa; }
.assist-comparison p { margin: 5px 0 0; font-size: 13px; white-space: pre-wrap; }
.assist-comparison .assist-after { border-color: #b3d4cc; background: #f0f8f4; }
.company-candidates { display: grid; min-width: 0; margin: 0; padding: 0; border: 0; gap: 10px; }
.company-candidates legend { margin-bottom: 10px; font-size: 13px; }
.company-candidate { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.company-candidate:has(input:checked) { border-color: var(--navy); background: #f2f8fa; }
.company-candidate input { margin-top: 5px; flex: none; }
.company-candidate span { min-width: 0; overflow-wrap: anywhere; }
.company-candidate strong, .company-candidate small { display: block; }
.company-candidate small { margin-top: 4px; color: var(--muted); line-height: 1.8; font-size: 11px; }
.ai-preview-banner { position: fixed; z-index: 15; bottom: 22px; right: 22px; max-width: calc(100vw - 44px); padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border: 1px solid #b3d4cc; border-radius: 12px; background: #f0f8f4; box-shadow: 0 5px 30px #18362b25; }
.ai-preview-banner span { font-size: 12px; }
[hidden] { display: none !important; }
@media(max-width:600px) {
  .ai-controls-grid { grid-template-columns: 1fr; }
  .assist-body { padding: 15px; }
  .assist-modal .modal-head { padding: 15px; }
  .assist-modal .modal-actions { padding: 12px; flex-wrap: wrap; gap: 6px; }
  .assist-modal .modal-actions button { min-width: 0; flex: 1 1 auto; font-size: 12px; }
  .assist-modal h2 { font-size: 18px; }
  .ai-preview-banner { right: 12px; bottom: 90px; max-width: calc(100vw - 24px); }
}

.assist-modal button:disabled { cursor: not-allowed; opacity: .45; }

/* Company-to-draft flow: keep the task visible, and the source copy in its editor. */
.assist-steps { display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; margin: 0; padding: 15px 24px; border-bottom: 1px solid var(--line); background: #fafcfd; }
.assist-steps li { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.assist-steps li[aria-current] { color: var(--navy); font-weight: 700; }
.assist-steps svg { width: 19px; height: 19px; flex: none; }
.assist-intro { margin: 0; color: var(--navy); font-size: 14px; line-height: 1.7; }
.company-selected { padding: 16px; border: 1px solid #cfdee5; border-radius: 10px; background: #f2f8fa; }
.company-selected strong { color: var(--navy); font-size: 16px; }
.company-selected p { margin: 7px 0 0; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.assist-import-options { margin-top: 14px; font-size: 12px; color: var(--muted); }
.assist-import-options > summary { padding: 6px 0; cursor: pointer; }
.assist-import-options .assist-comparison { margin: 10px 0; grid-template-columns: repeat(2,minmax(0,1fr)); }
.assist-import-options .assist-comparison > div { padding: 10px; }
#company-dialog .assist-body { gap: 11px; }
#company-compare > .assist-note { margin-top: 10px; }
#company-profile-note { margin-top: 10px; }
#ai-dialog .assist-body { padding: 20px 24px; }
#ai-dialog .assist-body.fields { gap: 14px; }
#ai-dialog #ai-profile { gap: 8px; }
#ai-dialog #ai-profile > label:not(:first-child) { margin-top: 8px; }
#ai-dialog .fields > label, #ai-dialog #ai-profile > label { color: #40515e; font-size: 13px; font-weight: 700; }
#ai-dialog textarea { padding: 10px 12px; font-size: 14px; line-height: 1.65; }
#ai-dialog #ai-business { min-height: 90px; }
#ai-dialog .modal-head { padding: 19px 24px 16px; }
#ai-dialog .modal-actions { padding: 14px 24px 18px; gap: 10px; }
#ai-dialog #ai-status:empty { display: none; }
#ai-status { margin: 0; font-size: 13px; line-height: 1.8; color: var(--navy); }
.ai-current { padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: #f7f9fa; }
.ai-current h3 { margin: 0 0 8px; font-size: 13px; }
.ai-current p { margin: 0; font-size: 14px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow: auto; }
.ai-current .assist-note { margin-top: 8px; font-size: 12px; }
.ai-edit-context { margin: 0 0 4px; color: var(--navy); font-size: 14px; font-weight: 700; }
.ai-company-context { margin: 0; color: var(--navy); font-size: 14px; font-weight: 700; }
.ai-company-context:empty { display: none; }
.ai-optional-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 8px; }
.ai-optional-grid .fields { min-width: 0; gap: 7px; }
.field-optional { margin-left: 5px; color: var(--muted); font-size: 11px; font-weight: 400; }
.ai-send-info { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fafcfd; }
.ai-send-info .assist-note { margin-top: 6px; font-size: 11px; }
.ai-send-info a { margin-left: 6px; }
#ai-site-results { gap: 18px; margin: 16px 0; }
#ai-site-results .fields { gap: 7px; }
.ai-preview-banner { left: 50%; right: auto; bottom: 22px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 44px); border-color: #cfdee5; background: #fff; }
.ai-preview-banner strong { color: var(--navy); font-size: 14px; }
.ai-preview-banner p { max-width: 440px; margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.ai-preview-banner > div { flex: 1 1 280px; }
@media(max-width:600px) {
  .assist-steps { padding: 12px 16px; gap: 7px; }
  .assist-steps li { gap: 4px; font-size: 10px; }
  .assist-steps svg { width: 16px; height: 16px; }
  #ai-dialog .modal-head { padding: 15px 16px; }
  #ai-dialog .assist-body { padding: 16px; }
  #ai-dialog .modal-actions { padding: 12px 16px; }
  .ai-optional-grid { grid-template-columns: 1fr; gap: 12px; }
  .ai-preview-banner { bottom: 85px; max-width: calc(100vw - 24px); padding: 12px; }
  .ai-preview-banner button { flex: 1 1 auto; font-size: 12px; }
  .assist-import-options .assist-comparison { grid-template-columns: 1fr; }
}

.ai-optional { margin-top: 8px; color: var(--muted); font-size: 12px; }
.ai-optional > summary { padding: 5px 0; cursor: pointer; }

/* Website text import shares the existing writing dialog's controls. */
.website-open { justify-self: start; text-align: left; }
.website-import-notice { padding: 10px 12px; background: #f0f6f7; border-radius: 8px; }
.website-import-notice p { margin: 0; }
.website-import-notice .text-button { padding: 6px 0 0; }
.website-candidates { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; min-width: 0; }
.website-url-section { border-top: 1px solid var(--line, #dce3e8); padding-top: 16px; margin-top: 6px; }
.website-modal a { overflow-wrap: anywhere; }
.website-modal textarea { width: 100%; }
#website-search-suggestions { width: 100%; height: 150px; border: 0; margin-top: 8px; }
#website-excerpts blockquote { margin: 10px 0; padding: 10px 14px; border-left: 3px solid #b6c9ce; background: #f5f8f8; white-space: pre-wrap; }
#website-status:empty { display: none; }
@media (max-width: 600px) { .website-modal .modal-actions button { flex: 1 1 100%; } }

.website-modal[data-state="error"] #website-status { color: #993d30; }
#website-status { margin: 0; font-size: 13px; line-height: 1.7; }
