/* The library's look: the app's palette (warm neutral page, one pine accent), light, dark or
   black as the visitor chooses, or as the system says. */
:root {
  --bg: #F6F5F1; --surface: #FFFFFF; --ink: #1B1B19; --muted: #5F5D57; --well: #EFEEE9; --line: #D6D3CB;
  --accent: #236B46; --on-accent: #FFFFFF; --accent-soft: #DCEBDF; --err: #B3261E; --err-soft: #F9DEDC;
  --amber: #8A5A00; --shadow: 0 6px 24px rgba(27, 27, 25, .14);
  --k1: #236B46; --k2: #6B8AC9; --k3: #C9A35B; --k4: #A7A39A;
  --side: 232px; --cols: 6; --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --surface: #1C1C1A; --ink: #E7E5DF; --muted: #B3B0A8; --well: #222220; --line: #45443F;
    --accent: #8FCBA6; --on-accent: #003920; --accent-soft: #1E3A2A; --err: #F2B8B5; --err-soft: #5C1D19; --amber: #F0C46B;
    --shadow: 0 6px 24px rgba(0, 0, 0, .5); --k1: #8FCBA6; --k2: #9DB6E8; --k3: #E3C47F; --k4: #6E6B64;
    color-scheme: dark;
  }
}
:root[data-theme="dark"], :root[data-theme="black"] {
  --bg: #121211; --surface: #1C1C1A; --ink: #E7E5DF; --muted: #B3B0A8; --well: #222220; --line: #45443F;
  --accent: #8FCBA6; --on-accent: #003920; --accent-soft: #1E3A2A; --err: #F2B8B5; --err-soft: #5C1D19; --amber: #F0C46B;
  --shadow: 0 6px 24px rgba(0, 0, 0, .5); --k1: #8FCBA6; --k2: #9DB6E8; --k3: #E3C47F; --k4: #6E6B64;
  color-scheme: dark;
}
:root[data-theme="black"] { --bg: #000; --surface: #0E0E0D; --well: #161615; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif; -webkit-font-smoothing: antialiased; }
body.lock { overflow: hidden; }
a { color: var(--accent); }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.4px; margin: 0; }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 6px; }
p { margin: 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin-top: 8px; display: flex; gap: 6px; align-items: flex-start; }
.hint .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; fill: currentColor; }
.err { color: var(--err); }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic { width: 22px; height: 22px; fill: currentColor; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn .ic { width: 20px; height: 20px; }
.btn:hover { background: var(--well); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); border-color: var(--err); }
.btn.primary.danger, .dlg .btn.danger { background: var(--err); border-color: var(--err); color: var(--surface); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.small { min-height: 32px; padding: 4px 12px; font-size: 14px; }
.btn:disabled { opacity: .4; cursor: default; }
.hiddenbtn { display: none !important; }
.ib { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: inherit; cursor: pointer; flex: none; position: relative; text-decoration: none; }
.ib:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.ib.on { color: var(--accent); }
.ib:disabled { opacity: .3; cursor: default; }
.field { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 42px; width: 100%; }
.field:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.lbl { display: block; font-weight: 600; margin: 12px 0 6px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.row .field { flex: 1 1 10em; width: auto; }

/* ---- the frame ---- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; height: 100dvh; }
.tabs { display: flex; flex-direction: column; gap: 2px; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 12px 18px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 20px; }
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 18px; font-weight: 700; }
.logo.big { width: 64px; height: 64px; font-size: 34px; border-radius: 18px; }
.tab { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; }
.tab:hover { background: var(--well); }
.tab.on { background: var(--accent-soft); color: var(--accent); }
main { overflow-y: auto; overflow-x: hidden; height: 100dvh; outline: none; overscroll-behavior: contain; }
main:focus-visible, .layer:focus-visible { outline: none; }
.page { max-width: 1600px; margin: 0 auto; padding: 0 16px 120px; }
.phead { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 14px 0 10px; background: var(--bg); min-height: 68px; }
.phead p { font-size: 13px; }
.headbox { position: sticky; top: 0; z-index: 4; }
.selbar { display: flex; align-items: center; gap: 4px; min-height: 68px; padding: 8px 0; background: var(--bg); flex-wrap: nowrap; }
.selbar strong { margin: 0 8px 0 4px; white-space: nowrap; }
.sh { margin: 22px 0 10px; }
.shrow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.empty { color: var(--muted); padding: 48px 8px; text-align: center; display: grid; justify-items: center; gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.panel .big { font-size: 40px; font-weight: 700; letter-spacing: -1px; }
.prow { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.bar { height: 8px; border-radius: 99px; background: var(--well); overflow: hidden; margin-top: 8px; }
.bar.thin { height: 4px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .2s; }
.progress { margin: 12px 0; color: var(--muted); font-size: 14px; }

@media (max-width: 899px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .tabs { flex-direction: row; order: 2; border-right: 0; border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .brand { display: none; }
  .tab { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 12px; flex: 1; border-radius: 16px; }
  .tab.on { background: transparent; }
  .tab.on .ic { background: var(--accent-soft); border-radius: 99px; padding: 4px 18px; box-sizing: content-box; }
  main { height: auto; min-height: 0; }
  .wide { display: none; }
  .page { padding: 0 12px 96px; }
  .selbar .btn.small { padding: 4px 8px; }
}

/* ---- filters ---- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 92%, transparent); }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 34px; padding: 4px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chip .ic { width: 18px; height: 18px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.fline { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 14px; padding: 0 0 8px; }
.periods { display: grid; gap: 2px; max-height: 60vh; overflow: auto; margin: 0 -8px; padding: 0 8px; }
.periods h3 { margin: 14px 0 4px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: inherit; text-align: start; cursor: pointer; }
.opt:hover:not(:disabled) { background: var(--well); }
.opt.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.opt:disabled { opacity: .4; cursor: default; }
.opt small { color: var(--muted); }
.opt.year .ic { transition: transform .15s; }
.opt.year[aria-expanded="true"] .ic { transform: rotate(90deg); }
.months { padding-inline-start: 16px; display: grid; gap: 2px; }
.dates { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dates .field { width: auto; flex: 1 1 9em; }

/* ---- the grid ---- */
.mh { font-size: 22px; font-weight: 700; margin: 26px 0 4px; }
.day { content-visibility: auto; contain-intrinsic-size: auto 300px; }
@media (min-width: 900px) {
  /* Small days share a row; each tile keeps the width of one of --cols columns. */
  .mdays { container-type: inline-size; display: flex; flex-wrap: wrap; column-gap: 10px; content-visibility: auto; contain-intrinsic-size: auto 400px; }
  .mdays .day { content-visibility: visible; max-width: 100%; min-width: 0; }
  .mdays .g { display: flex; flex-wrap: wrap; gap: 3px; }
  .mdays .tile { width: calc((100cqw - (var(--cols) - 1) * 3px) / var(--cols) - 3px); flex: none; }
  .mdays .day[data-n="1"] .dh { max-width: calc((100cqw - (var(--cols) - 1) * 3px) / var(--cols) - 3px); }
  .mdays .day[data-n="1"] .dsize { display: none; }
  .dh .dl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
}
.dh { display: flex; align-items: center; gap: 10px; padding: 10px 0 6px; font-weight: 600; }
.dh .dsize { color: var(--muted); font-weight: 400; font-size: 13px; margin-inline-start: auto; }
.dsel { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); background: transparent; color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; opacity: .55; }
.dsel .ic { width: 16px; height: 16px; }
.dh:hover .dsel, .grid.selecting .dsel { opacity: 1; }
.dsel.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); opacity: 1; }
.g { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 3px; }
.tile { position: relative; aspect-ratio: 1; background: var(--well); overflow: hidden; cursor: pointer; border-radius: 4px; transition: transform .12s, border-radius .12s; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .ph { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 4px; color: var(--muted); padding: 8px; text-align: center; }
.tile .ph small { font-size: 11px; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badge { position: absolute; display: inline-flex; align-items: center; gap: 2px; color: #fff; filter: drop-shadow(0 0 3px rgba(0,0,0,.7)); font-size: 12px; font-weight: 600; }
.badge .ic { width: 18px; height: 18px; }
.badge.vid { top: 6px; right: 6px; }
.badge.fav { bottom: 6px; left: 6px; }
.badge.days { bottom: 6px; right: 6px; background: rgba(0,0,0,.55); padding: 1px 8px; border-radius: 99px; filter: none; }
.badge.days.red { background: var(--err); color: #fff; }
.chk { position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.15); display: grid; place-items: center; color: transparent; opacity: 0; transition: opacity .12s; filter: drop-shadow(0 0 2px rgba(0,0,0,.5)); }
.chk .ic { width: 16px; height: 16px; }
.tile:hover .chk, .grid.selecting .chk, .grid.pick .chk { opacity: 1; }
.tile.sel { transform: scale(.88); border-radius: 12px; }
.tile.sel .chk { background: var(--accent); border-color: var(--accent); color: var(--on-accent); opacity: 1; }
.grid.selecting .tile:not(.sel)::after, .grid.pick .tile:not(.sel)::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.18), transparent 40%); pointer-events: none; }

/* ---- cards ---- */
.cards { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.mcard, .scard, .pcard { position: relative; flex: none; scroll-snap-align: start; border: 0; padding: 0; background: var(--well); color: inherit; font: inherit; cursor: pointer; text-align: start; border-radius: var(--radius); overflow: hidden; }
.mcard { width: 160px; aspect-ratio: 3/4; }
.mcard img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mcard > span { position: absolute; inset: auto 0 0; padding: 30px 12px 10px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.65)); display: grid; }
.mcard small { opacity: .9; }
.scard { width: 168px; display: grid; grid-template-rows: auto auto auto; background: var(--surface); border: 1px solid var(--line); }
.scard.small { width: 140px; }
.scard:disabled { opacity: .5; cursor: default; }
.scover { aspect-ratio: 4/3; background: var(--well); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.scover img { width: 100%; height: 100%; object-fit: cover; }
.stitle { font-weight: 600; padding: 8px 10px 0; }
.scard small, .pcard small { color: var(--muted); padding: 0 10px 10px; }
.pcard { width: 150px; display: grid; background: var(--surface); border: 1px solid var(--line); }
.pcard img, .pcard .noimg { width: 100%; aspect-ratio: 1; object-fit: cover; display: grid; place-items: center; background: var(--well); color: var(--muted); }
.ptitle { font-weight: 600; padding: 8px 10px 0; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.ctile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.ctile span { display: grid; }
.ctile small { color: var(--muted); }
.ctile.fav { background: var(--accent-soft); border-color: transparent; }
.ctile.fav .ic { color: var(--accent); }
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.acard { display: grid; gap: 2px; color: var(--ink); text-decoration: none; border: 0; background: transparent; padding: 0; font: inherit; text-align: start; cursor: pointer; }
.acover { aspect-ratio: 1; border-radius: var(--radius); background: var(--well); display: grid; place-items: center; overflow: hidden; color: var(--muted); margin-bottom: 6px; }
.acover img { width: 100%; height: 100%; object-fit: cover; }
.acard.new .acover { border: 2px dashed var(--line); background: transparent; }
.acard small { color: var(--muted); }

/* ---- tidy ---- */
.stack { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--well); margin: 10px 0; }
.stack span { display: block; height: 100%; }
.k1 { background: var(--k1); } .k2 { background: var(--k2); } .k3 { background: var(--k3); } .k4 { background: var(--k4); }
.legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px; }
.legend small { color: var(--muted); }
.trashbtn .count { position: absolute; top: 2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--err); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ---- layers over the page ---- */
.layer { position: fixed; inset: 0; z-index: 20; outline: none; }
.listlayer, .session { background: var(--bg); display: flex; flex-direction: column; }
.listlayer .scroll { flex: 1; overflow: auto; padding: 0 16px 40px; }
.sbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 60px; }
.sbar h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scount { color: var(--muted); font-variant-numeric: tabular-nums; }
.session .bar { margin: 0 16px; }
.sbody { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; padding: 12px 16px 16px; gap: 10px; overflow: auto; }
.swipe { position: relative; flex: 1; min-height: 200px; width: min(100%, 720px); display: grid; place-items: center; touch-action: pan-y; cursor: grab; transition: transform .15s; }
.swipe.dragging { transition: none; cursor: grabbing; }
.swipe img, .swipe video, .cmain img, .cmain video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius); user-select: none; -webkit-user-drag: none; }
.swipe img, .swipe video { position: absolute; inset: 0; width: 100%; height: 100%; }
.stamp { position: absolute; top: 24px; padding: 6px 16px; border: 3px solid; border-radius: 10px; font-size: 24px; font-weight: 800; text-transform: uppercase; opacity: 0; transition: opacity .1s; background: rgba(0,0,0,.25); }
.stamp.keep { left: 24px; color: #6FDB9C; transform: rotate(-12deg); }
.stamp.discard { right: 24px; color: #FF8A80; transform: rotate(12deg); }
.swipe.to-keep .stamp.keep, .swipe.to-discard .stamp.discard { opacity: 1; }
.smeta { color: var(--muted); font-size: 14px; text-align: center; }
.sactions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.sactions .btn { min-width: 120px; min-height: 48px; }
.cmain { position: relative; flex: 1; min-height: 200px; width: min(100%, 900px); display: grid; place-items: center; }
.cmain img, .cmain video { position: absolute; inset: 0; width: 100%; height: 100%; }
.ctag, .cstate { position: absolute; top: 10px; padding: 4px 10px; border-radius: 99px; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.ctag { left: 10px; } .cstate { right: 10px; }
.ctag .ic { width: 16px; height: 16px; }
.cstrip { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; padding: 4px; }
.cthumb { position: relative; flex: none; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 3px solid transparent; padding: 0; background: var(--well); cursor: pointer; }
.cthumb img { width: 100%; height: 100%; object-fit: cover; }
.cthumb.on { border-color: var(--accent); }
.cthumb.gone img { opacity: .35; }
.cthumb .mark { position: absolute; bottom: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; }
.cthumb .mark .ic { width: 14px; height: 14px; }
.cthumb .mark.x { background: var(--err); } .cthumb .mark.ok { background: var(--accent); color: var(--on-accent); }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; font-size: 14px; color: var(--muted); }
.sdone { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 24px 0; max-width: 560px; }
.sdone .freed { font-size: 40px; font-weight: 700; letter-spacing: -1px; }
.sdone .cards { justify-content: center; }

/* ---- the trash ---- */
.trash .panel { margin-bottom: 16px; }
.trash .g { grid-template-columns: repeat(max(3, calc(var(--cols) - 2)), minmax(0, 1fr)); }
.tactions { position: sticky; bottom: 0; display: flex; gap: 10px; justify-content: flex-end; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }

/* ---- settings ---- */
.settings .panel { display: grid; gap: 10px; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.srow .field { width: auto; min-width: 11em; }
.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.links li { display: flex; align-items: center; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.links li:last-child { border-bottom: 0; }

/* ---- the viewer ---- */
.viewer { background: #000; color: #fff; display: grid; grid-template-columns: 1fr; }
.viewer.infoopen { grid-template-columns: 1fr 360px; }
.vmain { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100dvh; }
.vbar { position: absolute; inset: 0 0 auto; z-index: 2; display: flex; align-items: center; gap: 2px; padding: 8px; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.vbar .ib { color: #fff; }
.vbar .ib.on { color: #8FCBA6; }
.vcount { font-size: 14px; color: #ddd; margin-inline-start: 6px; font-variant-numeric: tabular-nums; }
.vstage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; cursor: default; }
.vstage.zoomed { cursor: grab; }
.vmedia { max-width: 100%; max-height: 100dvh; object-fit: contain; transform-origin: center; user-select: none; -webkit-user-drag: none; }
img.vmedia { width: 100%; height: 100dvh; }
video.vmedia { max-height: calc(100dvh - 72px); }
.vnote { color: #ccc; padding: 16px; text-align: center; }
.vnav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(40,40,40,.6) !important; color: #fff; width: 48px; height: 48px; z-index: 2; }
.vnav.prev { left: 12px; } .vnav.next { right: 12px; }
.viewer.slides .vbar, .viewer.slides .vnav { display: none; }
.vinfo { display: none; background: var(--surface); color: var(--ink); overflow: auto; padding: 8px 20px 32px; height: 100dvh; }
.viewer.infoopen .vinfo { display: block; }
.vinfo-head { display: flex; align-items: center; justify-content: space-between; min-height: 52px; }
.vdate { font-size: 17px; font-weight: 600; margin: 8px 0; }
.vdate small { color: var(--muted); font-weight: 400; font-size: 14px; }
.vinfo dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.vinfo dt { color: var(--muted); }
.vinfo dd { margin: 0; word-break: break-word; }
.vwhere { display: flex; gap: 8px; align-items: center; }
.vwhere .ic { color: var(--accent); }
@media (max-width: 899px) {
  .viewer.infoopen { grid-template-columns: 1fr; }
  .vinfo { position: fixed; inset: auto 0 0; height: auto; max-height: 62dvh; border-radius: 20px 20px 0 0; box-shadow: var(--shadow); z-index: 3; }
  .vnav { display: none; }
  /* The photo moves up into the space the sheet leaves. */
  .viewer.infoopen .vmain, .viewer.infoopen img.vmedia { height: 38dvh; }
  .viewer.infoopen video.vmedia { max-height: 38dvh; }
}

/* ---- the editor ---- */
.editor { background: #111; color: #eee; display: grid; grid-template-rows: auto 1fr auto auto; height: 100dvh; }
.ebar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.ebar .ib { color: #fff; }
.editor .btn:not(.primary) { background: #222; border-color: #444; color: #eee; }
.ecanvas { min-height: 0; display: grid; place-items: center; padding: 8px; overflow: hidden; }
.ecanvas canvas { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.cropwrap { position: relative; max-width: 100%; max-height: 100%; line-height: 0; }
.cropwrap canvas { max-height: calc(100dvh - 300px); }
.cropbox { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.55); cursor: move; touch-action: none; }
.cropbox::before, .cropbox::after { content: ""; position: absolute; inset: 33.3% 0; border-top: 1px solid rgba(255,255,255,.4); border-bottom: 1px solid rgba(255,255,255,.4); pointer-events: none; }
.cropbox::after { inset: 0 33.3%; border: 0; border-left: 1px solid rgba(255,255,255,.4); border-right: 1px solid rgba(255,255,255,.4); }
.handle { position: absolute; width: 22px; height: 22px; background: #fff; border-radius: 50%; touch-action: none; }
.handle.nw { left: -11px; top: -11px; cursor: nwse-resize; } .handle.ne { right: -11px; top: -11px; cursor: nesw-resize; }
.handle.sw { left: -11px; bottom: -11px; cursor: nesw-resize; } .handle.se { right: -11px; bottom: -11px; cursor: nwse-resize; }
.etabs { display: flex; justify-content: center; gap: 6px; padding: 6px; border-top: 1px solid #2a2a2a; }
.etab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; border: 0; background: transparent; color: #bbb; font: inherit; font-weight: 600; cursor: pointer; }
.etab.on { background: #2b3d31; color: #8FCBA6; }
.epanel > .btn.small { justify-self: start; }
.epanel { padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 6px; max-width: 760px; width: 100%; margin: 0 auto; min-height: 150px; align-content: start; }
.slider { display: grid; grid-template-columns: 7.5em 1fr 3em; align-items: center; gap: 10px; font-size: 14px; }
.slider input { width: 100%; accent-color: #8FCBA6; }
.slider output { text-align: end; font-variant-numeric: tabular-nums; color: #aaa; }
.looks { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.look { flex: none; display: grid; gap: 4px; justify-items: center; border: 0; background: transparent; color: #ccc; font: inherit; font-size: 13px; cursor: pointer; padding: 0; }
.look canvas { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; border: 3px solid transparent; }
.look.on canvas { border-color: #8FCBA6; }
.look.on { color: #8FCBA6; }
.aspects .chip { background: #222; border-color: #444; color: #eee; }
.aspects .chip.on { background: #2b3d31; border-color: #8FCBA6; color: #8FCBA6; }

/* ---- the map ---- */
.mappage { display: flex; flex-direction: column; height: 100dvh; padding-bottom: 0; }
.mapbox { flex: 1; min-height: 300px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; background: var(--well); }
.mapnote { color: var(--muted); font-size: 14px; min-height: 1.4em; padding-bottom: 8px; }
.pin span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 13px; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
@media (max-width: 899px) { .mappage { height: calc(100dvh - 72px); } }

/* ---- dialogs, menus, the snackbar ---- */
.dlg { border: 0; border-radius: 22px; padding: 22px; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.dlg.wide { width: min(640px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(0,0,0,.45); }
.dlg h2 { margin-bottom: 12px; }
.dlg-body { color: var(--muted); }
.dlg-body p + p { margin-top: 8px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.form .field { margin-bottom: 4px; }
.albumpick { display: grid; gap: 4px; max-height: 55vh; overflow: auto; }
.albumpick .row { margin: 0 0 8px; }
.opt.album { justify-content: flex-start; }
.opt.album img, .opt.album .noimg { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--well); display: grid; place-items: center; flex: none; }
.opt.album span { flex: 1; color: var(--ink); }
.menu { position: fixed; z-index: 60; min-width: 220px; padding: 6px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); display: grid; }
.menu button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--well); }
.menu button.danger { color: var(--err); }
.menu .ic { width: 20px; height: 20px; color: var(--muted); }
#snack { position: fixed; z-index: 70; left: 50%; bottom: 24px; transform: translate(-50%, 140%); display: flex; align-items: center; gap: 16px; max-width: calc(100vw - 32px); padding: 12px 12px 12px 18px; border-radius: 12px; background: #2B2B29; color: #F2F1EC; box-shadow: var(--shadow); transition: transform .2s; }
#snack.on { transform: translate(-50%, 0); }
#snack button { border: 0; background: transparent; color: #8FCBA6; font: inherit; font-weight: 700; cursor: pointer; padding: 6px 8px; white-space: nowrap; }
@media (max-width: 899px) { #snack { bottom: calc(84px + env(safe-area-inset-bottom)); } }

/* ---- uploads and dropping ---- */
.uploads { position: fixed; z-index: 30; right: 16px; bottom: 16px; width: min(360px, calc(100vw - 32px)); padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.urow { display: flex; align-items: center; gap: 8px; }
.uploads p { font-size: 13px; margin-top: 4px; }
@media (max-width: 899px) { .uploads { bottom: calc(80px + env(safe-area-inset-bottom)); } }
.drop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 22%, transparent); backdrop-filter: blur(2px); pointer-events: none; }
.drop > div { display: grid; justify-items: center; gap: 8px; padding: 32px 40px; border-radius: 24px; background: var(--surface); border: 3px dashed var(--accent); color: var(--accent); font-weight: 700; }
.drop .ic { width: 48px; height: 48px; }

/* ---- importing from Google Photos ---- */
.imp { max-width: 720px; margin: 0 auto; display: grid; gap: 14px; padding-top: 8px; }
.imp h3 { margin: 0 0 8px; text-transform: none; letter-spacing: 0; font-size: 16px; color: var(--ink); }
.imp .panel p + p { margin-top: 8px; }
.imp .panel .bar { margin: 12px 0 6px; }
.note-box { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 14px; }
.note-box .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--accent); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 14px 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

/* ---- signing in ---- */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.signin .card { width: min(420px, 100%); display: grid; justify-items: center; gap: 14px; text-align: center; padding: 32px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; }
.signin .card > p:not(.err):not(.hint) { color: var(--muted); }
#gbtn { min-height: 44px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
