﻿:root {
  color-scheme: light;
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f4efe4;
  color: #24221c;
  --paper: #fffdf8;
  --paper-deep: #faf6ed;
  --ink: #24221c;
  --muted: #6b675c;
  --line: rgba(36, 34, 28, 0.12);
  --accent: #da5c42;
  --accent-deep: #a83d2b;
  --accent-soft: #fff0e8;
  --success: #70a66a;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: #f4efe4; }
button, input, canvas { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(218, 92, 66, 0.3); outline-offset: 2px; }
[hidden] { display: none !important; }

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 24px;
}

.app-header {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  align-items: end;
  gap: 48px;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.22em;
}

h1 {
  margin: 0;
  font-size: clamp(40px, 5.4vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h1 span { color: var(--accent); }

.intro {
  max-width: 430px;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.board-card {
  overflow: hidden;
  border: 1px solid rgba(36, 34, 28, 0.14);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(63, 52, 32, 0.12);
}

.mode-bar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-deep);
}

.mode-switch {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 8px;
}

.mode-button {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 14px 7px 9px;
  border: 1px solid transparent;
  border-radius: 17px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.mode-button:hover { border-color: rgba(168, 61, 43, 0.26); }
.mode-button:active { transform: translateY(1px) scale(0.99); }
.mode-button.is-selected,
.mode-button[aria-pressed="true"] {
  border-color: rgba(168, 61, 43, 0.42);
  background: var(--paper);
  box-shadow: 0 5px 16px rgba(63, 52, 32, 0.07);
}

.mode-number {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #ebe5d8;
  color: #787164;
  font-size: 11px;
  font-weight: 850;
}

.mode-button[aria-pressed="true"] .mode-number,
.mode-button.is-selected .mode-number { background: var(--accent); color: #fff; }
.mode-button > span:last-child { min-width: 0; display: grid; gap: 2px; }
.mode-button strong { font-size: 15px; }
.mode-button small { color: #777166; font-size: 11px; white-space: nowrap; }

.history-actions { flex: 0 0 auto; display: flex; gap: 7px; }
.icon-button {
  min-width: 64px;
  min-height: 48px;
  display: grid;
  grid-template-columns: auto auto;
  place-content: center;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
  color: #49453d;
  font-size: 12px;
  font-weight: 780;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}
.icon-button span[aria-hidden="true"] { font-size: 20px; line-height: 1; }
.icon-button:hover:not(:disabled) { border-color: rgba(168, 61, 43, 0.38); }
.icon-button:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.icon-button:disabled { opacity: 0.38; cursor: not-allowed; }
.icon-button-danger { color: #922f22; background: #fff7f2; }

.creative-workspace {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 620px;
}

.tool-panel {
  min-width: 0;
  padding: 20px 18px;
  border-right: 1px solid var(--line);
  background: #fdfaf3;
}

.control-view { display: grid; gap: 20px; }
.control-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 2px;
}
.control-kicker { color: #797266; font-size: 12px; font-weight: 780; letter-spacing: 0.08em; }
.control-heading strong { color: var(--accent-deep); font-size: 18px; }

.control-group {
  min-width: 0;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.control-group legend {
  float: left;
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  color: #575248;
  font-size: 13px;
  font-weight: 820;
}
.control-group legend + * { clear: both; }

.character-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.character-option {
  min-width: 0;
  min-height: 86px;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 6px 7px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: #4d493f;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(63, 52, 32, 0.04);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.character-option:hover { transform: translateY(-1px); border-color: rgba(168, 61, 43, 0.42); }
.character-option:active { transform: translateY(1px); }
.character-option.is-selected,
.character-option[aria-pressed="true"] {
  border-color: var(--accent-deep);
  background: var(--accent-soft);
  color: #8e2f20;
  box-shadow: 0 6px 18px rgba(168, 61, 43, 0.12);
}
.character-option img { width: 48px; height: 48px; object-fit: contain; border-radius: 12px; background: #fff; }
.character-option span { font-size: 12px; }

.segmented-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.segment-button,
.size-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: #5a554b;
  font-size: 13px;
  font-weight: 780;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.segment-button:hover,
.size-button:hover { border-color: rgba(168, 61, 43, 0.38); }
.segment-button:active,
.size-button:active { transform: translateY(1px) scale(0.99); }
.segment-button.is-selected,
.segment-button[aria-pressed="true"],
.size-button.is-selected,
.size-button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fffdf8; }

.control-help { margin: -2px 1px 0; color: #858075; font-size: 11px; line-height: 1.55; }
.color-controls { display: grid; gap: 10px; }
.color-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.color-swatch {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0;
  border: 2px solid var(--paper);
  border-radius: 14px;
  background: var(--swatch);
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(36, 34, 28, 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.color-swatch:hover { transform: translateY(-1px); }
.color-swatch:active { transform: translateY(1px) scale(0.96); }
.color-swatch.is-selected,
.color-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.color-swatch.is-selected::after,
.color-swatch[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-2px, -2px);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

.custom-color {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: #5a554b;
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
}
.custom-color input {
  width: 36px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.custom-color input::-webkit-color-swatch-wrapper { padding: 0; }
.custom-color input::-webkit-color-swatch { border: 0; border-radius: 9px; }
.custom-color input::-moz-color-swatch { border: 0; border-radius: 9px; }

.size-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.size-button { min-height: 50px; display: grid; grid-template-columns: auto auto; place-content: center; align-items: center; gap: 6px; padding: 0 5px; }
.size-dot { display: block; border-radius: 50%; background: currentColor; }
.size-dot-fine { width: 5px; height: 5px; }
.size-dot-medium { width: 9px; height: 9px; }
.size-dot-thick { width: 14px; height: 14px; }
.range-control { display: grid; grid-template-columns: auto minmax(0, 1fr) 25px; align-items: center; gap: 8px; color: #767064; font-size: 11px; font-weight: 700; }
.range-control input { width: 100%; min-height: 32px; accent-color: var(--accent); cursor: pointer; }
.range-control output { color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

.canvas-panel { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.board-toolbar {
  min-height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 10px 16px 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.status { min-width: 0; display: flex; align-items: center; gap: 10px; color: #676258; font-size: 13px; font-weight: 680; }
.status-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(112, 166, 106, 0.13); }
.mode-badge { flex: 0 0 auto; padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font-size: 11px; font-weight: 820; }

.canvas-wrap {
  position: relative;
  min-height: 560px;
  height: min(68vh, 720px);
  overflow: hidden;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(45, 42, 34, 0.11) 1px, transparent 1px);
  background-size: 22px 22px;
  isolation: isolate;
}

.canvas-layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.canvas-layer-coloring { z-index: 1; pointer-events: none; }
.canvas-layer-role { z-index: 2; pointer-events: none; }
.canvas-layer-decoration { z-index: 3; touch-action: none; cursor: crosshair; }

.canvas-hint {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  display: grid;
  justify-items: center;
  gap: 3px;
  transform: translate(-50%, -50%);
  color: #989183;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.canvas-hint.is-hidden { opacity: 0; transform: translate(-50%, -46%); }
.hint-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 7px;
  border: 2px solid var(--accent);
  border-radius: 18px 18px 18px 5px;
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 900;
  transform: rotate(-5deg);
}
.canvas-hint strong { color: #5d594f; font-size: 18px; }
.canvas-hint small { margin-top: 4px; font-size: 12px; }

.app-footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px 4px 0; color: #635e53; font-size: 12px; }

@media (max-width: 900px) {
  .creative-workspace { grid-template-columns: 236px minmax(0, 1fr); }
  .tool-panel { padding: 18px 14px; }
  .mode-button { padding-right: 10px; }
  .mode-button small { display: none; }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 20px, 1240px); padding-top: 24px; }
  .app-header { grid-template-columns: 1fr; gap: 14px; margin-bottom: 20px; }
  h1 { font-size: clamp(39px, 12vw, 58px); }
  .intro { font-size: 14px; line-height: 1.65; }
  .board-card { border-radius: 22px; }
  .mode-bar { display: grid; gap: 10px; padding: 10px; }
  .mode-switch { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-button { min-height: 54px; padding: 6px 8px; }
  .mode-number { width: 34px; height: 34px; flex-basis: 34px; border-radius: 11px; }
  .mode-button strong { font-size: 13px; white-space: nowrap; }
  .history-actions { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .icon-button { min-width: 0; min-height: 46px; }
  .creative-workspace { display: flex; min-height: 0; flex-direction: column; }
  .tool-panel { padding: 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .control-view { gap: 14px; }
  .control-heading { display: none; }
  .control-group { padding-top: 12px; }
  .control-view > .control-group:first-of-type { padding-top: 0; border-top: 0; }
  .character-group { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; }
  .character-group legend { width: auto; margin: 0; white-space: nowrap; }
  .character-group .character-options { clear: none; }
  .character-option { min-height: 58px; grid-template-columns: auto auto; place-content: center; gap: 7px; padding: 5px 8px; }
  .character-option img { width: 40px; height: 40px; }
  #generateControls { grid-template-columns: 1fr; }
  #generateControls .control-group:not(.character-group) { grid-template-columns: 86px minmax(0, 1fr); align-items: center; gap: 10px; }
  #generateControls .control-group:not(.character-group) legend { width: auto; margin: 0; }
  #generateControls .color-controls { clear: none; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  #generateControls .custom-color span { display: none; }
  #generateControls .custom-color { min-width: 48px; padding: 5px; }
  .color-swatch { width: 40px; height: 40px; flex-basis: 40px; }
  #freeDrawControls { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  #freeDrawControls .control-group { min-width: 0; }
  #freeDrawControls #drawColorGroup,
  #freeDrawControls .size-group { grid-column: 1 / -1; }
  #freeDrawControls .color-controls { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  #freeDrawControls .custom-color { min-width: 116px; }
  .board-toolbar { min-height: 54px; padding: 9px 12px 9px 16px; }
  .status { font-size: 12px; }
  .canvas-wrap { height: 58vh; min-height: 410px; }
  .app-footer { flex-direction: column; gap: 4px; }
}

@media (max-width: 430px) {
  .app-shell { width: calc(100% - 14px); padding-top: 18px; }
  .eyebrow { margin-bottom: 9px; }
  h1 { font-size: clamp(37px, 11.6vw, 50px); }
  .intro { max-width: 36em; }
  .mode-button { gap: 7px; padding-left: 6px; }
  .mode-number { width: 31px; height: 31px; flex-basis: 31px; font-size: 10px; }
  .icon-button { padding: 0 7px; }
  .tool-panel { padding: 12px 10px; }
  .character-group { grid-template-columns: 72px minmax(0, 1fr); }
  #generateControls .control-group:not(.character-group) { grid-template-columns: 72px minmax(0, 1fr); }
  .color-presets { gap: 7px; }
  .color-swatch { width: 38px; height: 38px; flex-basis: 38px; border-radius: 12px; }
  #freeDrawControls { gap: 12px 8px; }
  #freeDrawControls .custom-color { min-width: 48px; padding: 5px; }
  #freeDrawControls .custom-color span { display: none; }
  .range-control { grid-template-columns: auto minmax(0, 1fr) 22px; }
  .mode-badge { display: none; }
  .canvas-wrap { height: 56vh; min-height: 380px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Custom-character studio */
.custom-character-actions { display: grid; grid-template-columns: 1.3fr 1fr; gap: 7px; }
.primary-small-button, .secondary-small-button {
  min-height: 44px; padding: 8px 10px; border-radius: 13px; font-size: 12px; font-weight: 820; cursor: pointer;
}
.primary-small-button { border: 1px solid var(--ink); background: var(--ink); color: #fffdf8; }
.secondary-small-button { border: 1px solid var(--line); background: var(--paper); }
.custom-character-quick-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.custom-character-quick-list:empty { display: none; }
.custom-character-mini { min-height: 58px; display: grid; place-items: center; gap: 2px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; overflow: hidden; }
.custom-character-mini img { width: 34px; height: 34px; object-fit: contain; }
.custom-character-mini span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }

.character-studio { position: fixed; z-index: 1000; inset: 0; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: rgba(31, 28, 22, .68); backdrop-filter: blur(12px); }
.studio-shell { width: min(1120px, 100%); height: 100%; margin: auto; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; border: 1px solid rgba(255,255,255,.28); border-radius: 26px; background: #fffdf8; box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.studio-header { min-height: 76px; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.studio-header h2 { margin: 1px 0 0; font-size: 23px; }
.studio-kicker { margin: 0; color: var(--accent-deep); font-size: 10px; font-weight: 850; letter-spacing: .16em; }
.studio-icon-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 14px; background: #fff; font-size: 23px; cursor: pointer; }
.studio-progress { display: grid; grid-template-columns: repeat(6, 1fr); padding: 0 18px; border-bottom: 1px solid var(--line); background: #faf6ed; }
.studio-progress span { padding: 10px 5px; color: #8a8478; border-bottom: 3px solid transparent; text-align: center; font-size: 11px; font-weight: 750; }
.studio-progress span.is-active { color: var(--accent-deep); border-color: var(--accent); }
.studio-progress span.is-complete { color: #467744; }
.studio-content { min-height: 0; overflow: auto; padding: 24px; }
.studio-step { width: min(920px, 100%); min-height: 100%; margin: auto; }
.studio-copy { margin-bottom: 18px; text-align: center; }
.studio-copy h3, .upload-dropzone h3, .processing-card h3 { margin: 0 0 7px; font-size: clamp(22px, 4vw, 34px); }
.studio-copy p, .upload-dropzone p, .processing-card p { margin: 0; color: var(--muted); line-height: 1.65; }
.upload-dropzone { min-height: 420px; display: grid; place-items: center; align-content: center; gap: 12px; padding: 34px; border: 2px dashed rgba(168,61,43,.32); border-radius: 24px; background: #fff8f1; text-align: center; }
.upload-mark { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 24px; background: var(--accent); color: #fff; font-size: 44px; line-height: 1; }
.studio-primary-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 22px; border: 0; border-radius: 15px; background: var(--ink); color: #fff; font-weight: 820; cursor: pointer; }
.studio-primary-button:disabled { opacity: .4; cursor: not-allowed; }
.studio-text-button { display: block; margin: 18px auto 0; padding: 10px 14px; border: 0; background: transparent; color: var(--accent-deep); font-weight: 800; cursor: pointer; }
.crop-stage { position: relative; width: min(768px, 100%); margin: auto; overflow: hidden; border-radius: 18px; background: #28251f; touch-action: none; }
.crop-stage canvas { display: block; width: 100%; height: auto; max-height: 56vh; object-fit: contain; }
.crop-frame { position: absolute; inset: 6%; border: 3px solid #fff; border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.42); pointer-events: none; }
.studio-range { width: min(600px, 100%); margin: 15px auto 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; font-weight: 750; }
.studio-range input { width: 100%; accent-color: var(--accent); }
.subject-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.subject-card { padding: 16px; border: 2px solid var(--line); border-radius: 18px; background: #fff; text-align: left; cursor: pointer; }
.subject-card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.processing-card { min-height: 420px; display: grid; place-items: center; align-content: center; gap: 12px; text-align: center; }
.processing-spinner { width: 58px; height: 58px; border: 6px solid #eee5d7; border-top-color: var(--accent); border-radius: 50%; animation: studio-spin .85s linear infinite; }
@keyframes studio-spin { to { transform: rotate(360deg); } }
.result-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.result-comparison figure { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.result-comparison img, .result-comparison canvas { width: 100%; aspect-ratio: 1; display: block; object-fit: contain; border-radius: 12px; background: #f5f1e7; }
.result-comparison figcaption { padding: 8px 0 0; color: var(--muted); text-align: center; font-size: 12px; font-weight: 760; }
.line-art-stats { width: fit-content; max-width: 100%; margin: 14px auto 0; padding: 9px 14px; border: 1px solid rgba(168,61,43,.18); border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); text-align: center; font-size: 12px; font-weight: 800; }
.template-editor-toolbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 12px; }
.template-editor-toolbar button, .template-editor-toolbar label { min-height: 42px; display: flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 12px; font-weight: 760; }
.template-editor-toolbar button { cursor: pointer; }
.template-editor-toolbar button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.template-editor-line-count { width: fit-content; margin: 0 auto 12px; padding: 7px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font-size: 12px; font-weight: 800; }
.template-editor-comparison { display: grid; grid-template-columns: minmax(180px, .42fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.template-editor-comparison figure { min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.template-editor-comparison img { width: 100%; aspect-ratio: 1; display: block; object-fit: contain; border-radius: 12px; background: #f5f1e7; }
.template-editor-comparison figcaption { padding-top: 8px; color: var(--muted); text-align: center; font-size: 12px; font-weight: 760; }
.template-editor-canvas { width: 100%; max-height: 56vh; display: block; margin: auto; border-radius: 12px; background: #fff; touch-action: none; }
.naming-card { width: min(520px, 100%); min-height: 440px; display: grid; place-items: center; align-content: center; gap: 13px; margin: auto; text-align: center; }
.naming-card canvas { width: min(280px, 70vw); aspect-ratio: 1; border: 1px solid var(--line); border-radius: 22px; background: #fff; }
.naming-card label { font-size: 20px; font-weight: 850; }
.naming-card input { width: min(360px, 100%); min-height: 52px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 14px; text-align: center; font-size: 18px; }
.naming-card p { margin: 0; color: var(--muted); font-size: 12px; }
.manage-role-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.manage-role-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.manage-role-card img { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; background: #f7f2e8; }
.manage-role-card strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.manage-role-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.manage-role-actions button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 11px; cursor: pointer; }
.manage-role-actions .danger { color: #9d3023; }
.studio-footer { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; border-top: 1px solid var(--line); background: #faf6ed; }
.studio-footer p { margin: 0; color: var(--muted); font-size: 12px; }

@media (max-width: 720px) {
  .character-studio { padding: 0; }
  .studio-shell { border: 0; border-radius: 0; }
  .studio-header { min-height: 66px; padding: 8px 10px; }
  .studio-header h2 { font-size: 19px; }
  .studio-progress { padding: 0 4px; overflow-x: auto; }
  .studio-progress span { min-width: 74px; font-size: 10px; }
  .studio-content { padding: 16px 12px; }
  .studio-footer { padding: 9px 12px; }
  .result-comparison { grid-template-columns: 1fr 1fr; gap: 8px; }
  .template-editor-comparison { grid-template-columns: 160px minmax(0, 1fr); gap: 8px; }
  .upload-dropzone { min-height: 360px; padding: 24px 16px; }
  .custom-character-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 430px) {
  .studio-progress span { min-width: 66px; }
  .result-comparison { grid-template-columns: 1fr; }
  .result-comparison figure:first-child { display: none; }
  .template-editor-comparison { grid-template-columns: 1fr; }
  .template-editor-comparison > figure:first-child { position: sticky; z-index: 2; top: -8px; width: 132px; margin-left: auto; padding: 7px; box-shadow: 0 8px 22px rgba(31, 28, 22, .14); }
  .template-editor-comparison > figure:first-child figcaption { padding-top: 4px; font-size: 10px; }
  .studio-footer p { max-width: 62%; }
}
