:root { color-scheme: light; --paper:#faf9f3; --ink:#202420; --muted:#62695f; --line:#e5e6df; --accent:#0871c7; --wash:#eeeae2; }
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; background:#e8e6df; color:var(--ink); font:16px system-ui,"Microsoft YaHei",sans-serif; }
button,input,textarea { font:inherit; color:inherit; }
button { cursor:pointer; }
button:disabled { cursor:default; opacity:.46; }
button:focus-visible,input:focus-visible,textarea:focus-visible,[tabindex]:focus-visible { outline:2px solid var(--muted); outline-offset:2px; }
#app { width:min(100%,460px); height:100dvh; margin:auto; display:flex; flex-direction:column; position:relative; overflow:hidden; background:var(--paper); padding-top:env(safe-area-inset-top); }
.home-header { flex:none; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px 16px 3px; }
.home-header h1 { min-width:0; margin:0; font-size:32px; line-height:1.2; }
#scope { display:flex; align-items:center; max-width:100%; gap:10px; border:0; padding:5px 0; background:none; font-weight:750; text-align:left; }
#scope-label { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.chevron { width:8px; height:8px; flex:none; margin-top:-3px; transform:rotate(45deg); border-bottom:2px solid; border-right:2px solid; }
.icon-button { display:grid; place-items:center; border:0; background:none; min-width:44px; height:44px; flex:none; color:var(--accent); font-size:25px; }
.magnifier { display:block; flex:none; }
.search-close,#search-toggle[aria-expanded="true"] .magnifier { display:none; }
#search-toggle[aria-expanded="true"] .search-close { display:block; font-size:27px; line-height:1; }
.search-row { display:flex; gap:10px; align-items:center; min-height:44px; margin:5px 16px; padding-left:14px; border-radius:14px; background:var(--wash); }
.search-row .magnifier { color:var(--muted); flex:none; }
.search-row input { min-width:0; width:100%; min-height:44px; border:0; background:none; padding:0 9px 0 2px; }
.search-row:focus-within { box-shadow:inset 0 0 0 1.5px var(--muted); }
.search-row input:focus { outline:none; -webkit-appearance:none; appearance:none; }
input[type=search]::-webkit-search-cancel-button { display:none; }
.search-row .icon-button { color:var(--muted); }
.gallery-shell { position:relative; flex:1; min-height:0; }
.feed { height:100%; overflow:auto; overscroll-behavior:contain; scrollbar-width:none; }
.grid { position:relative; touch-action:pan-y; overflow-anchor:none; }
.grid img { position:absolute; top:0; left:0; border-radius:10px; background:var(--wash); object-fit:contain; -webkit-user-drag:none; -webkit-touch-callout:none; user-select:none; cursor:zoom-in; }
.add { position:absolute; top:22px; right:22px; z-index:2; }
.photo-control { width:48px; height:48px; display:grid; place-items:center; border-radius:50%; border:1px solid #ffffff91; background:#25322c51; color:white; font-size:28px; padding:0; text-shadow:0 1px 3px #000; backdrop-filter:blur(7px) saturate(125%); -webkit-backdrop-filter:blur(7px) saturate(125%); box-shadow:inset 0 1px 1px #ffffff93,0 3px 8px #16251d4d; }
.glass { isolation:isolate; overflow:hidden; transition:scale .18s ease; }
.glass canvas { position:absolute; inset:0; width:100%; height:100%; z-index:-2; pointer-events:none; border-radius:inherit; }
.glass::after { content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none; background:radial-gradient(ellipse at var(--shine,24%) 0%,#ffffff58,transparent 47%); box-shadow:inset 0 1px 1px #ffffffe0,inset 0 -1px 2px #ffffff55; }
.photo-control:active { scale:.95; }
.empty { min-height:min(60dvh,480px); display:grid; align-content:center; justify-items:center; gap:8px; padding:60px 18px 18px; color:var(--muted); }
.empty p { margin:0; font-weight:650; color:var(--ink); }
.plain-link { border:0; background:none; color:var(--accent); min-height:42px; padding:4px 10px; }
.column-notice,.status { position:absolute; z-index:4; bottom:18px; left:50%; transform:translateX(-50%); padding:9px 16px; border-radius:24px; color:white; background:#303b34b5; white-space:nowrap; backdrop-filter:blur(9px); }
.status { z-index:12; max-width:calc(100% - 28px); width:max-content; white-space:normal; }
.popup { position:absolute; z-index:8; min-width:min(235px,calc(100% - 24px)); max-width:calc(100% - 24px); padding:6px; border:1px solid #fff9; border-radius:21px; background:#faf9f3df; backdrop-filter:blur(24px) saturate(145%); -webkit-backdrop-filter:blur(24px) saturate(145%); box-shadow:0 6px 24px #171c1933; }
.popup button { width:100%; display:flex; align-items:center; gap:8px; min-height:43px; border:0; background:none; border-radius:13px; padding:8px 11px; text-align:left; }
.popup button:hover,.popup button:focus-visible { background:var(--wash); }
.popup .popup-heading { margin:7px 11px 2px; font-size:13px; color:var(--muted); }
.popup .popup-group + .popup-group { border-top:1px solid var(--line); margin-top:3px; padding-top:3px; }
.destructive { color:#aa2f2d !important; }
dialog { margin:auto; border:0; padding:0; color:var(--ink); background:var(--paper); width:min(100%,460px); max-width:100%; }
dialog::backdrop { background:#21272066; }
#viewer { height:100dvh; max-height:100dvh; overflow:auto; overscroll-behavior:contain; }
.stage { position:relative; overflow:hidden; min-height:140px; max-height:60dvh; background:#e9e7df; touch-action:pan-y; user-select:none; display:grid; place-items:center; }
.stage.zoomed { touch-action:none; cursor:grab; }
.stage img { width:100%; height:100%; position:absolute; inset:0; object-fit:contain; -webkit-user-drag:none; user-select:none; }
.viewer-controls { position:absolute; inset:calc(12px + env(safe-area-inset-top)) 14px auto; display:flex; justify-content:space-between; pointer-events:none; }
.viewer-controls button { pointer-events:auto; }
#detail-popup { top:calc(66px + env(safe-area-inset-top)); right:12px; }
#details { padding:16px 18px 38px; }
#details h2 { margin:0 0 14px; font-size:24px; }
#details h3 { margin:19px 0 6px; font-size:16px; }
#details p { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.65; }
#details .analysis-source { color:var(--muted); font-size:13px; margin-top:12px; }
.tags { display:flex; gap:7px; flex-wrap:wrap; }
.tag { border:0; background:#e8e8df; border-radius:22px; padding:7px 13px; min-height:36px; }
.swatches { display:flex; gap:7px; }
.swatches span { flex:1; height:34px; border-radius:7px; border:1px solid #0001; }
#sheet { max-height:calc(100dvh - 18px); border-radius:24px; box-shadow:0 12px 32px #171c1955; }
#sheet[open] { display:flex; flex-direction:column; }
.sheet-header { position:sticky; top:0; display:grid; grid-template-columns:minmax(50px,1fr) auto minmax(50px,1fr); align-items:center; gap:8px; border-bottom:1px solid var(--line); padding:8px 12px; background:var(--paper); }
.sheet-header button { justify-self:start; }
.sheet-header h2 { font-size:17px; text-align:center; margin:0; }
.sheet-body { overflow:auto; min-height:0; padding:14px 16px 18px; }
.sheet-footer { flex:none; padding:10px 16px max(12px,env(safe-area-inset-bottom)); border-top:1px solid var(--line); }
.sheet-footer button { width:100%; }
.sheet-error { color:#a12d2b; font-size:14px; padding:0 16px 14px; }
.sheet-field { width:100%; border:1px solid var(--line); background:#fff9; padding:11px 12px; border-radius:12px; min-height:44px; }
.sheet-body > .sheet-field { margin-bottom:14px; }
textarea.sheet-field { min-height:105px; resize:vertical; }
.dialog-message { margin:4px 0 10px; line-height:1.6; }
.primary { min-height:44px; border:0; border-radius:14px; background:var(--accent); color:white; padding:8px 16px; font-weight:650; }
.primary.delete { background:#a42b2b; }
.primary.import-save { background:#dbe6d8; color:#294333; }
.folder-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.folder-card { display:grid; gap:5px; grid-template-columns:minmax(0,1fr); border:0; background:none; padding:0; text-align:left; }
.folder-card > strong,.selection-row strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.folder-cover { display:grid; place-items:center; width:100%; height:108px; background:var(--wash); color:var(--muted); border-radius:12px; object-fit:cover; }
.folder-card small,.selection-row small { color:var(--muted); }
.selection-row { width:100%; display:grid; grid-template-columns:48px minmax(0,1fr) 30px; align-items:center; gap:10px; min-height:58px; text-align:left; border:0; background:none; padding:5px 3px; border-bottom:1px solid var(--line); }
.selection-row .row-text { display:grid; gap:3px; }
.selection-row small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.selection-row img,.selection-row .folder-cover { width:48px; height:44px; border-radius:7px; object-fit:cover; }
.selection-row .check { color:var(--accent); font-size:21px; text-align:center; }
.selection-title { margin:12px 1px 5px; color:var(--muted); font-size:14px; }
.sheet-empty { padding:24px 0; text-align:center; color:var(--muted); }
.import-preview { display:block; width:100%; max-height:39dvh; object-fit:contain; margin-bottom:14px; border-radius:13px; background:var(--wash); }
.note-label { display:block; margin-bottom:7px; color:var(--muted); }
@media (min-width:520px) {
  #app { height:min(920px,100dvh); border-radius:22px; }
  #sheet { max-height:min(790px,calc(100dvh - 32px)); }
}
@media (max-width:480px) {
  #sheet { margin:auto auto 0; border-radius:22px 22px 0 0; }
}
@media (prefers-reduced-motion:reduce) { .glass { transition:none; } }

.grid img,.selection-row { -webkit-tap-highlight-color:transparent; }
.grid img:focus,.selection-row:focus { outline:none; }
.grid img:active { opacity:.84; }
.selection-row[aria-pressed="true"] { background:#731f380b; border-radius:10px; }
.selection-row .check { display:grid; place-items:center; justify-self:center; width:21px; height:21px; box-sizing:border-box; font-size:0; border:1.5px solid #a49b96; border-radius:50%; }
.selection-row[aria-pressed="true"] .check { color:white; background:#731f38; border-color:#731f38; font-size:15px; font-weight:700; }
html.keyboard-focus .grid img:focus-visible,html.keyboard-focus .selection-row:focus-visible { outline:2px dashed #731f38; outline-offset:-4px; }
