:root {
  --ink: #2c242b;
  --muted: #6e616a;
  --line: #eadfe5;
  --oshi: #9b6dff;
  --oshi-soft: #f4eeff;
  --oshi-tint: #fbf8ff;
  --oshi-ink: #5a34a8;
  --cta: #d94664;
  font: 15px/1.6 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  color: var(--ink);
  background: var(--oshi-tint);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--oshi-tint); overflow-x: clip; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.skip-link { position: absolute; top: 8px; left: 8px; transform: translateY(-150%); }
.skip-link:focus { z-index: 20; transform: none; padding: 8px 12px; border-radius: 8px; background: #fff; }

.oshi-app {
  width: min(1200px, calc(100% - 36px));
  margin: auto;
  padding-bottom: 56px;
}

.oshi-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 26px 0 20px;
  border-bottom: 2px dashed var(--line);
}
.oshi-head-main { min-width: 0; max-width: 100%; }
.oshi-head h1 {
  margin: 0 0 4px;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 900;
  line-height: 1.25;
}
.oshi-head p { margin: 0; color: var(--muted); font-size: 14px; }
.oshi-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-action {
  min-height: 38px;
  padding: 6px 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.pill-action:hover { border-color: var(--oshi); color: var(--oshi-ink); background: var(--oshi-soft); }

.oshi-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 32px;
  padding: 24px 0 36px;
  align-items: start;
}

.editor { display: grid; gap: 16px; min-width: 0; }

.card-step {
  min-width: 0;
  padding: 18px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 20px rgb(60 35 55 / 5%);
}

.step-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 900;
}
.step-num {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--oshi);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  flex: none;
}

.sub-label {
  margin: 14px 0 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.card-step > .sub-label:first-of-type { margin-top: 4px; }

.design-grid, .frame-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.design-grid label, .frame-grid label, .type-grid label, .segmented label {
  position: relative;
  cursor: pointer;
}
.design-grid input, .frame-grid input, .type-grid input, .segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.design-grid span, .frame-grid span, .type-grid span, .segmented span {
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 4px 6px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  transition: all .12s ease;
}
.design-grid input:checked + span,
.frame-grid input:checked + span,
.type-grid input:checked + span,
.segmented input:checked + span {
  border-color: var(--oshi);
  background: var(--oshi-soft);
  color: var(--oshi-ink);
  font-weight: 900;
}

.palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.swatch-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px #d7ccd3;
  transition: transform .12s ease, box-shadow .12s ease;
}
.swatch-btn:hover { transform: scale(1.08); }
.swatch-btn[aria-pressed="true"] {
  transform: scale(1.12);
  box-shadow: 0 0 0 2.5px var(--ink);
}

.color-custom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.color-custom input[type="color"] {
  width: 42px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.page-controls {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.page-select-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}
.page-select-wrap select {
  flex: 1;
  min-height: 36px;
  padding: 4px 8px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.page-btn-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.page-btn-row button {
  min-height: 34px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}
.page-btn-row button:disabled { opacity: .4; cursor: default; }

.name-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
}

.field {
  display: block;
  margin: 0 0 11px;
  font-size: 12px;
  font-weight: 700;
}
.field input, .field textarea {
  display: block;
  width: 100%;
  min-height: 40px;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
}
.field textarea { min-height: 76px; resize: vertical; }

.photo-block {
  margin: 12px 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--oshi-tint);
}
.photo-drop {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1.5px dashed var(--oshi);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.photo-drop input { display: none; }
.photo-drop-title { font-size: 13px; font-weight: 700; color: var(--oshi-ink); }
.photo-drop-sub { font-size: 11px; color: var(--muted); }
.text-danger {
  margin-top: 6px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #b53445;
  font-size: 12px;
  font-weight: 700;
}

.profile-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 6px;
  margin-bottom: 6px;
}
.profile-row input {
  min-width: 0;
  min-height: 38px;
  padding: 6px 9px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
}

.toggle-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.toggle-check input { width: 18px; height: 18px; accent-color: var(--oshi); }

.radar-fields { display: grid; gap: 6px; margin-top: 10px; }
.radar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.radar-row input {
  min-width: 0;
  min-height: 36px;
  padding: 5px 9px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
}
.star-group { display: inline-flex; gap: 2px; }
.star-btn {
  width: 28px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d6cbd2;
  font-size: 17px;
  line-height: 1;
}
.star-btn.is-on { color: var(--oshi); }

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}
.field-head .sub-label { margin: 0; }
.text-add {
  border: 0;
  background: transparent;
  color: var(--oshi-ink);
  font-size: 13px;
  font-weight: 900;
}
.point-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.point-row input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 6px 10px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
}
.point-row button {
  width: 38px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}
.point-row button:disabled { opacity: .35; cursor: default; }

.editor-cta { display: grid; gap: 10px; }
.secondary {
  width: 100%;
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}
.secondary:hover { border-color: var(--oshi); background: var(--oshi-soft); color: var(--oshi-ink); }

.editor-more {
  padding: 10px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
}
.editor-more summary {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.editor-more-body { display: grid; gap: 8px; margin-top: 10px; }

.preview-zone { min-width: 0; }
.preview-sticky { position: sticky; top: 18px; }
.preview-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.preview-bar h2 { margin: 0; font-size: 17px; font-weight: 900; }
.preview-bar p { margin: 0; font-size: 12px; font-weight: 700; color: var(--oshi-ink); }

.canvas-wrap {
  padding: 10px;
  border-radius: 22px;
  background: #fff;
  border: 1.5px solid var(--line);
  box-shadow: 0 14px 36px rgb(60 35 55 / 10%);
}
canvas {
  display: block;
  width: min(100%, 540px);
  height: auto;
  margin: auto;
  border-radius: 14px;
}

.primary {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 14px 0 0;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--oshi), var(--cta));
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgb(155 109 255 / 26%);
}
.primary:disabled { opacity: .45; cursor: default; box-shadow: none; }

.status {
  min-height: 1.5em;
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--oshi-ink);
  text-align: center;
}

.mobile-dock { display: none; }

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--oshi);
  outline-offset: 2px;
}

@media (max-width: 860px) {
  .oshi-app { width: min(560px, calc(100% - 24px)); padding-bottom: 88px; }
  .oshi-workspace { display: flex; flex-direction: column; gap: 22px; }
  .preview-zone { order: -1; width: 100%; }
  .preview-sticky { position: static; }
  .mobile-dock {
    position: fixed;
    z-index: 40;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-top: 1.5px solid var(--line);
    background: rgb(255 255 255 / 95%);
    backdrop-filter: blur(8px);
  }
  .dock-jump, .dock-save {
    display: grid;
    place-items: center;
    min-height: 44px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
  }
  .dock-jump {
    border: 1.5px solid var(--oshi);
    background: #fff;
    color: var(--oshi-ink);
  }
  .dock-save {
    border: 0;
    background: linear-gradient(135deg, var(--oshi), var(--cta));
    color: #fff;
  }
  .dock-save:disabled { opacity: .45; }
}

@media (max-width: 420px) {
  .design-grid, .frame-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .name-row { grid-template-columns: 76px minmax(0, 1fr); }
}

.oshi-app [hidden] { display: none; }

.related-tools { margin: 24px 0 8px; padding-top: 14px; border-top: 1px solid var(--line, #e6ddd5); font-size: 13px; line-height: 1.8; }
.related-tools-title { margin: 0 0 4px; font-weight: 700; }
