:root {
  color-scheme: light;
  --bg: #f5f1ea;
  --surface: #ffffff;
  --surface-soft: #f8f7f4;
  --text: #181816;
  --muted: #74716b;
  --line: #dedbd4;
  --line-strong: #c8c4bc;
  --accent: #b75f3b;
  --accent-hover: #934729;
  --dark: #20201d;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow: 0 20px 60px rgba(40, 37, 31, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 36px 18px 56px;
  font-family:
    Inter, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo",
    system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255,255,255,.9), transparent 420px),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 34px;
  background: var(--surface);
  border: 1px solid rgba(80, 75, 67, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: .24em;
  margin: 0 0 18px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .18em;
}

.brand strong { color: var(--accent); font-weight: 900; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.18;
  letter-spacing: -.035em;
}

.lead {
  margin: 14px 0 0;
  font-size: 16px;
  color: #3f3d39;
}

.privacy-promise {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: min(100%, 660px);
  margin: 22px auto 0;
  padding: 14px 16px;
  border: 1px solid #ead8cc;
  border-radius: 12px;
  background: #fbf5f0;
  text-align: left;
}

.privacy-promise p {
  margin: 0;
  color: #4b4f58;
  font-size: 13px;
  line-height: 1.75;
}

.privacy-promise strong {
  display: block;
  color: #5a3425;
  font-size: 14px;
}

.privacy-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.upload-area {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 34px 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  transition:
    border-color .18s ease,
    background .18s ease,
    transform .18s ease;
  cursor: pointer;
  outline: none;
}

.upload-area:hover,
.upload-area:focus-visible {
  border-color: var(--accent);
  background: #fbf4ef;
}

.upload-area.dragover {
  border-color: var(--accent);
  background: #f8eee8;
  transform: translateY(-1px);
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 2px;
  border-radius: 50%;
  background: #f2e3d9;
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
}

.upload-title,
.upload-subtitle {
  margin: 0;
}

.upload-title {
  font-size: 15px;
  font-weight: 700;
}

.upload-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.select-file,
.primary-action,
.control-button {
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition:
    background .16s ease,
    color .16s ease,
    border-color .16s ease,
    transform .16s ease;
}

.select-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 10px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
}

.select-file:hover {
  background: var(--accent-hover);
}

.preview {
  width: 100%;
  margin-top: 24px;
}

.preview > img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 72vh;
  margin: 0 auto;
  border-radius: 12px;
  object-fit: contain;
}

.primary-action-wrap {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.primary-action {
  min-height: 46px;
  padding: 0 24px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.primary-action:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.primary-action:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.primary-action[hidden] {
  display: none;
}

.status-message {
  min-height: 22px;
  margin-top: 12px;
  text-align: center;
  color: #55514b;
  font-size: 13px;
}

/* Result */
.comparison-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.comparison-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: #111;
  line-height: 0;
  user-select: none;
  touch-action: none;
}

.comparison-stage.is-portrait {
  width: auto;
  max-height: 72vh;
}

.comparison-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: fill;
  pointer-events: none;
}

.comparison-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.25);
  pointer-events: none;
}

.comparison-handle {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #1d1d1b;
  box-shadow: 0 4px 18px rgba(0,0,0,.28);
  cursor: ew-resize;
  touch-action: none;
}

.comparison-label {
  position: absolute;
  top: 12px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(20,20,18,.62);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.comparison-label.is-left {
  left: 12px;
}

.comparison-label.is-right {
  right: 12px;
}

.comparison-stage:not(.is-compare) .comparison-divider,
.comparison-stage:not(.is-compare) .comparison-handle,
.comparison-stage:not(.is-compare) .comparison-label {
  display: none;
}

.result-panel {
  width: min(100%, 760px);
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.control-group + .control-group {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.control-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.control-button {
  min-height: 40px;
  padding: 0 14px;
  border-color: var(--line-strong);
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.control-button:hover {
  border-color: #9c978d;
  background: #f5f3ee;
}

.control-button.is-active {
  border-color: var(--dark);
  background: var(--dark);
  color: #fff;
}

.control-button.is-save {
  flex: 1 1 180px;
  border-color: var(--accent);
  color: var(--accent);
  background: #fff;
}

.control-button.is-save:hover {
  color: #fff;
  background: var(--accent);
}

.control-button.is-secondary {
  width: 100%;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.control-button.is-secondary:hover {
  background: #ece9e2;
  color: var(--text);
}

@media (max-width: 680px) {
  body {
    padding: 14px 10px 28px;
  }

  .app-shell {
    padding: 22px 14px;
    border-radius: 14px;
  }

  .upload-area {
    padding: 26px 16px;
  }

  .result-panel {
    padding: 14px;
  }

  .control-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .control-button {
    min-width: 0;
    padding-inline: 8px;
    font-size: 13px;
  }

  .save-row {
    grid-template-columns: 1fr 1fr;
  }

  .comparison-handle {
    width: 40px;
    height: 40px;
  }
}


.story-section,
.support-section {
  width: min(100%, 760px);
  margin: 42px auto 0;
  padding-top: 34px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.story-section h2,
.support-section h2 {
  margin: 8px 0 0;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -.025em;
}

.story-section p:not(.section-kicker),
.support-section p:not(.section-kicker) {
  width: min(100%, 620px);
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}

.section-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
}

.support-section {
  margin-top: 34px;
  padding-bottom: 8px;
}

.support-button {
  min-height: 44px;
  margin-top: 20px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #f5f3ee;
  color: var(--muted);
  font-weight: 700;
  cursor: not-allowed;
}

@media (max-width: 680px) {
  .privacy-promise {
    padding: 13px 14px;
  }

  .story-section,
  .support-section {
    margin-top: 34px;
    padding-top: 28px;
  }
}


.reference-group {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf8f4;
}
.reference-copy { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.reference-picker { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.reference-file-name { color: var(--muted); font-size: 12px; }
.reference-strength { margin-top: 16px; }
.reference-strength-head { display:flex; justify-content:space-between; gap:12px; margin-bottom:8px; font-size:12px; color:var(--muted); }
.reference-strength input { width:100%; accent-color:var(--accent); }
.reference-active { display:inline-flex; align-items:center; gap:6px; margin-top:12px; color:#6a3b29; font-size:12px; font-weight:700; }
.reference-active::before { content:'✓'; display:grid; place-items:center; width:18px; height:18px; border-radius:50%; color:#fff; background:var(--accent); font-size:11px; }
@media (max-width: 640px) {
  body { padding: 14px 10px 30px; }
  .app-shell { padding: 24px 16px; }
  .brand { font-size: 11px; }
  .reference-picker .control-button { width:100%; }
}

/* COLOR RE:FINE v2.1 — あの日の色 状態UI */
.control-group.is-locked {
  position: relative;
}

.control-group.is-locked .control-row {
  opacity: .42;
}

.control-group.is-locked .control-button:disabled {
  cursor: not-allowed;
  filter: grayscale(.35);
}

.control-locked-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.reference-group {
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.reference-group.is-active {
  border-color: rgba(190, 105, 65, .34);
  background: linear-gradient(180deg, #fffaf5 0%, #fbf7f2 100%);
  box-shadow: 0 8px 24px rgba(78, 49, 36, .055);
}

.reference-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.reference-heading .control-title {
  margin: 0;
}

.reference-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.reference-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.reference-toggle-track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #d9d5cf;
  transition: background-color .2s ease;
}

.reference-toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.16);
  transition: transform .2s ease;
}

.reference-toggle input:checked + .reference-toggle-track {
  background: var(--accent);
}

.reference-toggle input:checked + .reference-toggle-track::after {
  transform: translateX(16px);
}

.reference-toggle input:focus-visible + .reference-toggle-track {
  outline: 3px solid rgba(190, 105, 65, .2);
  outline-offset: 2px;
}

.reference-toggle-text {
  min-width: 48px;
}

.control-button.is-quiet-danger {
  border-color: transparent;
  background: transparent;
  color: #9b6250;
  padding-inline: 10px;
  box-shadow: none;
}

.control-button.is-quiet-danger:hover {
  border-color: rgba(155, 98, 80, .22);
  background: rgba(155, 98, 80, .06);
}

.reference-strength input:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.atmosphere-summary {
  margin-top: 18px;
  padding: 14px 15px;
  border: 1px solid rgba(117, 96, 81, .12);
  border-radius: 10px;
  background: rgba(255,255,255,.68);
}

.atmosphere-title {
  margin: 0 0 11px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}

.atmosphere-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.atmosphere-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 8px;
  background: #f7f3ee;
}

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

.atmosphere-metric strong {
  color: #704334;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.atmosphere-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

@media (max-width: 520px) {
  .reference-heading {
    align-items: flex-start;
  }

  .reference-toggle {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .atmosphere-metrics {
    gap: 6px;
  }

  .atmosphere-metric {
    padding: 8px;
  }
}

/* v2.2 Release Candidate */
:root {
  --bg: #f4efe7;
  --surface: #fffdfa;
  --surface-soft: #f8f4ee;
  --text: #171613;
  --muted: #716d65;
  --line: #dfd8ce;
  --line-strong: #c9bfb2;
  --accent: #a65336;
  --accent-hover: #84402a;
  --gold-soft: #b89568;
}

body {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "Noto Serif JP", Georgia, serif;
  padding-top: 44px;
}

.app-shell { max-width: 1020px; padding: clamp(24px, 4vw, 48px); }
.hero { margin-bottom: 34px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: .68em;
  margin-bottom: 25px;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: .11em;
  font-size: 15px;
}
.brand-color { font-weight: 300; }
.brand-refine { display: inline-flex; align-items: baseline; letter-spacing: .045em; }
.brand-refine strong { color: var(--text); font-weight: 800; }
.brand-refine i { color: var(--accent); margin: 0 .03em; font-style: normal; font-weight: 900; }
.brand-refine span { font-weight: 300; }

h1 {
  font-size: clamp(36px, 5.4vw, 62px);
  line-height: 1.35;
  letter-spacing: -.055em;
  font-weight: 600;
}
.lead { margin-top: 16px; font-size: clamp(17px, 2.2vw, 22px); letter-spacing: .03em; }
.free-note {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 0;
  margin: 17px 0 0; color: var(--muted); font-family: Inter, "Yu Gothic", sans-serif; font-size: 12px;
}
.free-note span, .free-note strong { padding: 0 11px; border-right: 1px solid var(--line); }
.free-note strong { color: var(--accent); font-weight: 800; }
.free-note > :last-child { border-right: 0; }

.privacy-promise { margin-top: 26px; background: #fbf4ed; }
.upload-area, .result-panel, .story-section, .support-section, .legal-section { font-family: Inter, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif; }
.primary-action { min-height: 52px; padding-inline: 34px; border-radius: 999px; }
.select-file { border-radius: 999px; }

.loading-overlay {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center;
  padding: 24px; background: rgba(244,239,231,.88); backdrop-filter: blur(12px);
}
.loading-overlay[hidden] { display: none; }
.loading-card {
  width: min(100%, 420px); padding: 34px; border: 1px solid rgba(100,80,60,.13);
  border-radius: 20px; background: rgba(255,253,250,.96); box-shadow: 0 24px 80px rgba(48,38,28,.16); text-align: center;
  font-family: Inter, "Yu Gothic", sans-serif;
}
.loading-mark { display: inline-flex; align-items: baseline; margin-bottom: 20px; font-size: 18px; letter-spacing: .08em; }
.loading-mark span { font-weight: 800; }
.loading-mark i { color: var(--accent); font-style: normal; font-weight: 900; }
.loading-title { margin: 0; font-weight: 800; font-size: 16px; }
.loading-detail { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.loading-progress { height: 5px; margin-top: 20px; overflow: hidden; border-radius: 99px; background: #e8e0d6; }
.loading-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .2s ease; }
.loading-progress.is-indeterminate span { width: 38%; animation: loading-slide 1.2s ease-in-out infinite; }
.loading-percent { margin: 9px 0 0; color: var(--muted); font-size: 11px; }
@keyframes loading-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(270%); } }

.legal-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.legal-section h2 { margin: 0 0 9px; font-size: 15px; }
.legal-section p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.9; }
.site-footer {
  width: min(100%, 980px); margin: 18px auto 46px; padding: 0 18px; text-align: center;
  font-family: Inter, "Yu Gothic", sans-serif; color: var(--muted); font-size: 11px;
}
.site-footer a { display: inline-block; margin: 0 9px; color: #56514b; text-underline-offset: 4px; }
.site-footer p { margin: 14px 0 0; }
.mobile-break { display: none; }

@media (max-width: 640px) {
  body { padding: 18px 10px 36px; }
  .app-shell { padding: 24px 16px; border-radius: 15px; }
  .brand { margin-bottom: 20px; font-size: 13px; }
  h1 { font-size: clamp(30px, 9.5vw, 42px); line-height: 1.42; }
  .mobile-break { display: block; }
  .lead { margin-top: 12px; font-size: 16px; }
  .free-note span, .free-note strong { padding: 0 8px; }
  .privacy-promise { padding: 13px; }
  .loading-card { padding: 28px 22px; }
}

/* v2.2 RC final polish */
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10000;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--dark);
  color: #fff;
  font: 700 13px/1 Inter, "Yu Gothic", sans-serif;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }
.brand-reading {
  margin: -18px 0 21px;
  color: var(--muted);
  font: 500 10px/1.4 Inter, "Yu Gothic", sans-serif;
  letter-spacing: .24em;
}
.service-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 19px;
  font-family: Inter, "Yu Gothic", sans-serif;
}
.service-facts span {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  color: #5d5952;
  font-size: 11px;
  font-weight: 700;
}
.upload-area { position: relative; overflow: hidden; }
.upload-area::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(166,83,54,.07), transparent 55%);
}
.upload-area > * { position: relative; }
.select-file:focus-visible,
.primary-action:focus-visible,
.control-button:focus-visible,
.support-button:focus-visible,
.site-footer a:focus-visible {
  outline: 3px solid rgba(166,83,54,.24);
  outline-offset: 3px;
}
.noscript-message {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid #ead8cc;
  border-radius: 10px;
  background: #fbf5f0;
  color: #6c4534;
  font: 600 13px/1.7 Inter, "Yu Gothic", sans-serif;
  text-align: center;
}
.principle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
  text-align: left;
}
.principle-grid div {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.principle-grid strong,
.principle-grid span { display: block; }
.principle-grid strong { font-size: 12px; letter-spacing: .03em; }
.principle-grid span { margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.support-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 20px;
  padding: 0 22px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-family: Inter, "Yu Gothic", sans-serif;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.support-button:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.loading-card::after {
  content: "写真は端末の外へ送信されません";
  display: block;
  margin-top: 18px;
  color: #8a8177;
  font-size: 10px;
  letter-spacing: .04em;
}
.site-footer nav { margin-bottom: 12px; }
.site-footer p + p { margin-top: 5px; }
@media (max-width: 680px) {
  .principle-grid { grid-template-columns: 1fr; }
  .service-facts { gap: 6px; }
  .service-facts span { padding: 6px 8px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
