:root {
  color-scheme: light;
  --paper: #f7f5f0;
  --ink: #242923;
  --olive: #425446;
  --line: #d5d1c8;
  --muted: #62685f;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 600px; margin: auto; padding: max(28px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); }
.brand { padding: 8px 0; font-size: 15px; font-weight: 650; letter-spacing: .04em; }
.intro { padding: 24px 0 28px; }
h1, #result-title { font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-weight: 500; font-size: 30px; line-height: 1.55; letter-spacing: -.025em; margin: 0; }
.intro p { margin: 12px 0 0; font-size: 14px; color: var(--olive); }
h1 span { white-space: nowrap; }
p { font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
h2, h3 { font-size: 16px; line-height: 1.5; margin: 0; }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 12px 18px; border: 1px solid transparent; border-radius: 12px; background: var(--olive); color: var(--paper); font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1.5; cursor: pointer; text-decoration: none; text-align: center; -webkit-tap-highlight-color: transparent; transition: background-color .15s, opacity .15s; }
button:disabled { background: var(--line); color: #65695f; cursor: not-allowed; }
.secondary { background: #e7eae1; color: var(--olive); border-color: #c6ccbc; }
.text-button { background: transparent; color: var(--olive); width: 100%; font-weight: 500; }
.secondary:disabled, .text-button:disabled { background: transparent; color: var(--muted); border-color: var(--line); box-shadow: none; }
button:not(:disabled):active, .button:active { opacity: .7; }
:focus-visible { outline: 3px solid var(--olive); outline-offset: 4px; }
.main-picker { border: 1px dashed var(--line); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.photo-icon { width: 38px; height: 38px; color: #817f72; margin: 5px 0; }
#main-preview { width: 100%; height: 150px; object-fit: contain; border-radius: 6px; }
#main-select { width: 100%; }
.file-status { font-size: 13px; color: var(--olive); line-height: 1.5; }
.materials, .generation { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 24px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.material-count { margin: 0; font-size: 13px; color: var(--olive); font-variant-numeric: tabular-nums; }
.material-advice { margin: -4px 0 16px; font-size: 13px; line-height: 1.6; color: var(--olive); }
.material-advice[data-state="warn"] { color: #7a4a17; background: #fdf3e3; border: 1px solid #e7d2ae; border-radius: 10px; padding: 8px 10px; }
.album-picker button { width: 100%; }
#folder-select { width: 100%; }
#folder-help { font-size: 14px; margin: 10px 0 0; }
#tile-select { margin-top: 6px; }
.privacy { display: flex; gap: 8px; align-items: center; color: var(--olive); font-size: 13px; margin: 14px 0 0; }
.privacy svg { width: 17px; height: 20px; flex-shrink: 0; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.actions > * { width: 100%; }
.rule { margin: 12px 0 0; text-align: center; color: var(--olive); font-size: 12px; }
.status { color: var(--olive); font-size: 13px; margin: 14px 0 0; }
.status:empty { display: none; }
progress { display: block; width: 100%; height: 8px; margin-top: 20px; border: 0; border-radius: 8px; overflow: hidden; background: var(--line); accent-color: var(--olive); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--olive); }
progress::-moz-progress-bar { background: var(--olive); }
details { border-top: 1px solid var(--line); margin-top: 24px; font-size: 13px; color: var(--olive); }
summary { display: flex; align-items: center; justify-content: space-between; min-height: 50px; gap: 12px; cursor: pointer; list-style: none; font-weight: 600; }
summary::-webkit-details-marker { display: none; }
.chevron { width: 20px; height: 20px; flex-shrink: 0; transition: transform .15s; }
.usage-guide { margin: 0 0 24px; border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; }
.usage-body { padding-bottom: 18px; }
.usage-body p { margin: 0 0 14px; }
.usage-body ol { padding-left: 22px; margin: 0 0 16px; font-size: 14px; line-height: 1.8; }
.usage-body li + li { margin-top: 10px; }
#usage-close { width: 100%; font-size: 14px; }
details[open] > summary .chevron { transform: rotate(180deg); }
.details-body { padding: 0 0 16px; margin: 0; font-size: 13px; }
.details-body p { font-size: 13px; margin: 0 0 12px; }
.install-card { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 16px; }
.install-card h2 { font-size: 16px; }
.install-card button { width: 100%; }
.install-help { padding-top: 12px; }
.hint, footer p { color: var(--muted); font-size: 12px; }
footer { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
footer p { text-align: center; margin: 8px 0 0; }
#result { padding-top: 24px; scroll-margin-top: 24px; }
#result-title { margin-bottom: 24px; font-size: 28px; }
figure { margin: 0; min-width: 0; }
canvas { display: block; width: 100%; height: auto; }
.artwork canvas { border-radius: 8px; }
.source-row { display: flex; gap: 16px; align-items: flex-start; margin: 20px 0 24px; }
.source-row figure { width: 80px; flex-shrink: 0; }
.source-row canvas { border-radius: 6px; }
.source-row h3 { font-size: 13px; }
.source-row p { font-size: 13px; color: var(--olive); margin: 4px 0 0; }
#save-status:not(:empty) { border-left: 2px solid var(--olive); padding-left: 12px; }
#save-help { margin-top: 12px; }
#edit-selection { margin-top: 8px; }
.return-result { width: 100%; margin-bottom: 24px; }
.clear-confirmation { border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin: 12px 0; }
.clear-confirmation h3 { font-size: 16px; }
.clear-confirmation p { text-align: left; margin: 12px 0 16px; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
/* Approved immersive cover, Superdesign draft c6e4f38d v6. */
body:has(.home-screen:not([hidden])) { background: #101418; }
.home-screen { position: relative; width: 100%; max-width: 600px; height: 100vh; height: 100dvh; min-height: 600px; margin: auto; overflow: hidden; background: #101418; color: white; }
.home-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.home-shade { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.10) 40%, rgba(0,0,0,.38) 80%, rgba(0,0,0,.15)); }
.memory-photos { position: absolute; top: 40%; left: 24px; right: 24px; height: 230px; transform: translateY(-50%); pointer-events: none; z-index: 1; }
.memory-photos img { position: absolute; width: 43%; max-width: 170px; height: auto; aspect-ratio: 4/5; object-fit: cover; border: 2px solid white; }
.memory-dog { left: 0; top: 38px; transform: rotate(-5deg); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.memory-flowers { left: 28.5%; top: 0; transform: rotate(2deg); box-shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1); }
.memory-friends { right: 0; top: 34px; transform: rotate(6deg); box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1); }
.home-content { position: relative; z-index: 2; display: flex; height: 100%; flex-direction: column; }
.home-brand { flex-shrink: 0; padding: max(28px, env(safe-area-inset-top)) 24px 0; font-size: 15px; font-weight: 650; letter-spacing: .04em; line-height: 1.5; }
.home-brand::first-line { line-height: 38.5px; }
.home-copy { margin-top: auto; padding: 0 24px 24px; }
.home-copy h1 { margin: 0; font: 750 42px/1.2 -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif; letter-spacing: -.025em; color: white; filter: drop-shadow(0 4px 3px rgba(0,0,0,.07)) drop-shadow(0 2px 2px rgba(0,0,0,.06)); }
.home-copy p { margin: 12px 0 0; font-size: 15px; line-height: 1.6; color: rgba(255,255,255,.9); }
.home-dock { flex-shrink: 0; padding: 20px 24px max(34px, env(safe-area-inset-bottom)); background: rgba(0,0,0,.35); border-top: 1px solid rgba(255,255,255,.1); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
#start-creating { display: flex; width: 100%; min-height: 56px; border: 0; border-radius: 9999px; gap: 12px; padding: 12px 20px; background: white; color: #101418; font-size: 16px; font-weight: 650; line-height: 1.4; }
#start-creating svg { width: 20px; height: 20px; }
.home-dock p { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 16px 0 0; font-size: 12px; line-height: 1.5; color: rgba(255,255,255,.8); }
.home-dock p svg { width: 14px; height: 14px; flex-shrink: 0; }
.home-screen :focus-visible { outline-color: white; }
.back-home { gap: 4px; border: 0; margin: -24px 0 12px -16px; }
.back-home svg { width: 20px; height: 20px; }
#selection-title { font-family: inherit; font-weight: 750; }
@media (max-width: 360px) { .home-copy h1 { font-size: 34px; } }
@media (max-height: 740px) { .memory-photos { top: 36%; height: 200px; } .memory-photos img { max-width: 125px; } }
@media (max-height: 620px) { .memory-photos { top: 29%; } }
@media (max-width: 360px) { main { padding-left: 20px; padding-right: 20px; } h1 { font-size: 27px; } .main-picker { padding: 20px; } button, .button { font-size: 15px; } }
@media (min-width: 800px) { main { padding-top: 48px; } .intro { padding-top: 32px; } #main-preview { height: 220px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

/* Browser-only selection and full-resolution preparation. */
.selected-files-details summary { display: block; cursor: pointer; min-height: 44px; padding: 12px 0; }
#selected-files { max-height: 320px; overflow: auto; padding: 0; list-style: none; }
#selected-files li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid #ddd; }
#selected-files li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#selected-files button { flex-shrink: 0; min-height: 44px; padding: 8px 12px; }
.browser-highres { border-top: 1px solid #d8d5cd; margin-top: 24px; padding-top: 20px; }
.browser-highres label { display: block; margin-bottom: 8px; }
.browser-highres select { appearance: none; -webkit-appearance: none; font: inherit; color: var(--olive); background: #fff; border: 1px solid var(--line); width: 100%; min-height: 48px; border-radius: 10px; padding: 10px; margin-bottom: 12px; }
.browser-highres button { width: 100%; margin-bottom: 10px; }
#download[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* Non-interactive, reflowable diagrams for the beginner Files guide. */
.file-guide-details { margin: 12px 0 20px; }
.file-guide-details > summary { font-size: 1rem; line-height: 1.6; padding: 12px 0; }
.file-guide-details > p { font-size: 1rem; }
.file-guide-details .hint { font-size: .875rem; }
.usage-body .file-guide-steps { padding-left: 1.4em; font-size: 1rem; }
.file-guide-steps > li { margin: 0 0 12px; line-height: 1.7; }
.guide-phase { padding-top: 16px; border-top: 1px solid var(--line); font-weight: 650; }

/* Photo import progress shares the existing workspace palette. */
.import-panel { margin: 20px 0; padding: 20px; border: 1px solid var(--line); border-radius: 12px; }
.import-panel > p:first-child { margin: 0; font-size: 1rem; font-weight: 600; }
.import-panel progress { margin-top: 12px; }
.import-panel .hint { font-size: .875rem; }
.import-feedback { margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; font-size: 1rem; overflow-wrap: anywhere; }
.import-feedback[data-state="error"] { border-color: #a64032; color: #852f24; background: #fff4f1; }

.session-warning { margin: 0 0 24px; padding: 16px 20px; border-left: 3px solid var(--olive); background: var(--line); border-radius: 0 8px 8px 0; }
.session-warning p { margin: 0 0 8px; font-size: 1rem; }
.session-warning .hint { margin-bottom: 0; font-size: .875rem; }

/* 保存はこの画面で一番したい操作。他より大きく、影で浮かせて見つけやすくする。 */
#result .actions button, #result .actions .button {
  min-height: 60px; font-size: 18px; border-radius: 14px;
  box-shadow: 0 6px 16px rgba(36, 41, 35, .22);
}
#result .actions .button.secondary {
  background: var(--olive); color: var(--paper); border-color: transparent;
}
#result .actions button:disabled { box-shadow: none; }

/* 写真を選ぶ操作は押せる面を見せる。消す操作だけは静かなままにする。 */
#tile-select { background: #e7eae1; color: var(--olive); border-color: #c6ccbc; font-weight: 600; }

.privacy-policy { margin-top: 20px; text-align: left; }
.privacy-policy summary { text-align: left; }
.privacy-policy h3 { margin: 20px 0 6px; font-size: 1rem; }
.privacy-policy p { margin: 0 0 10px; font-size: .9375rem; line-height: 1.8; text-align: left; }
.privacy-policy code { font-size: .875em; word-break: break-all; }
