:root { color-scheme: dark; --bg:#10141c; --surface:#191f2a; --surface2:#252e3e; --edge:#354053; --text:#edf3fc; --muted:#8e9cb1; --accent:#9ccaff; }
* { box-sizing:border-box; }
html, body { margin:0; min-height:100%; background:var(--bg); color:var(--text); font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; -webkit-font-smoothing:antialiased; }
button,input { font:inherit; }
button { color:inherit; cursor:pointer; -webkit-tap-highlight-color:transparent; }
button:focus-visible,input:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
[hidden] { display:none !important; }
.topbar { min-height:66px; border-bottom:1px solid #2b3545; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px max(18px,env(safe-area-inset-right)); position:sticky; top:0; background:#10141cf2; backdrop-filter:blur(20px); z-index:4; }
.identity { display:flex; align-items:center; gap:11px; font-size:17px; font-weight:650; letter-spacing:-.35px; }
.brand-icon { background:linear-gradient(140deg,#5ba1f8,#94d0ff); color:#111b2a; display:grid; place-items:center; font-weight:700; font-size:36px; width:68px; height:68px; border-radius:19px; }
.brand-icon.small { width:32px; height:32px; font-size:23px; border-radius:9px; }
.top-actions { display:flex; align-items:center; gap:10px; }
.ghost, .icon-button { border:1px solid var(--edge); background:var(--surface); border-radius:12px; height:38px; min-width:42px; padding:0 13px; }
.icon-button { font-size:26px; line-height:1; }
.ghost { font-size:14px; }
.main-area { max-width:1200px; margin:auto; padding:20px 18px 90px; }
.folder-nav { display:flex; gap:10px; align-items:center; min-height:64px; margin-bottom:16px; }
.crumbs { display:flex; align-items:center; gap:8px; overflow-x:auto; overflow-y:hidden; scrollbar-width:none; min-width:0; padding:4px 0; }
.crumbs::-webkit-scrollbar { display:none; }
.crumb { border:0; display:flex; align-items:center; min-width:0; padding:5px 7px; background:transparent; border-radius:8px; flex:none; }
.crumb.active { background:var(--surface2); }
.crumb img { height:28px; width:auto; max-width:180px; object-fit:contain; }
.crumb-separator { color:#617187; }
h2 { color:#aebacf; font-size:13px; text-transform:uppercase; letter-spacing:1.3px; margin:24px 0 14px; font-weight:700; }
.folders-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(176px,1fr)); gap:10px; }
.folder-tile { display:flex; align-items:center; gap:12px; padding:14px 10px; border:1px solid var(--edge); background:var(--surface); border-radius:14px; min-width:0; text-align:left; }
.folder-tile:hover,.photo-tile:hover { border-color:#718ba9; }
.folder-glyph { flex:none; display:grid; place-items:center; color:#99c6fc; width:32px; font-size:27px; }
.folder-label { min-width:0; width:100%; height:auto; max-height:42px; object-fit:contain; object-position:left; }
.photos-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:15px 10px; }
.photo-tile { min-width:0; padding:5px; border:1px solid transparent; border-radius:13px; background:transparent; display:flex; flex-direction:column; gap:7px; overflow:hidden; }
.thumb-wrapper { display:grid; place-items:center; aspect-ratio:1/1; background:#202734; border-radius:10px; overflow:hidden; width:100%; position:relative; }
.thumb-favorite { position:absolute; right:7px; top:6px; color:#ffcf67; font-size:22px; text-shadow:0 1px 4px #000e; pointer-events:none; }
.thumb-wrapper img { width:100%; height:100%; object-fit:cover; }
.photo-label { width:100%; max-height:44px; object-fit:contain; object-position:center; }
.status { margin:35px 0; font-size:14px; color:var(--muted); }
.error { color:#f2adb5; }
.login-page { min-height:100dvh; display:grid; place-items:center; padding:24px; }
.login-card { width:min(100%,385px); text-align:center; }
.login-card .brand-icon { margin:0 auto 18px; }
.login-card h1 { font-size:27px; margin:0 0 8px; }
.login-card p { color:var(--muted); font-size:14px; line-height:1.6; margin:0 0 27px; }
.login-card form { text-align:left; }
.login-card label { display:block; color:#c6d0e1; font-size:13px; margin-bottom:9px; }
.login-card input { width:100%; background:var(--surface); border:1px solid var(--edge); color:var(--text); padding:14px 16px; border-radius:12px; margin-bottom:12px; }
.primary { width:100%; border:0; background:var(--accent); color:#091322; font-weight:700; padding:14px; border-radius:12px; }
.login-card .error { margin:16px 0 0; }
.viewer { position:fixed; inset:0; height:100dvh; background:#05070b; z-index:10; display:flex; flex-direction:column; padding-top:env(safe-area-inset-top); padding-bottom:env(safe-area-inset-bottom); }
.viewer-header { display:flex; height:68px; align-items:center; gap:10px; justify-content:space-between; padding:8px 12px; flex:none; }
.viewer-btn { flex:none; border:0; width:42px; height:42px; border-radius:50%; background:#242b38; color:white; font-size:21px; display:grid; place-items:center; }
.viewer-title { flex:1; min-width:0; display:grid; place-items:center; }
.viewer-title img { width:auto; max-width:100%; max-height:50px; object-fit:contain; }
.viewer-space { flex:1; min-height:0; width:100%; display:flex; align-items:center; justify-content:center; overflow:hidden; overscroll-behavior:contain; touch-action:none; }
.viewer-space img { display:block; width:auto; height:auto; max-width:100%; max-height:100%; object-fit:contain; user-select:none; -webkit-user-select:none; transform-origin:center center; will-change:transform; pointer-events:none; }
.viewer-space.zoomed { justify-content:safe center; align-items:safe center; }
.viewer-space.zoomed img { max-width:none; max-height:none; }
.photo-metadata { flex:none; max-height:130px; padding:3px 14px; display:grid; place-items:center; background:#151d29; }
.photo-metadata img { max-width:100%; max-height:120px; object-fit:contain; }
.favorite-button.is-favorite { color:#ffcf67; }
.favorites-shortcut { font-size:24px; }
.favorites-shortcut:disabled { opacity:.45; }
.viewer-footer { display:flex; gap:25px; justify-content:center; align-items:center; padding:10px 12px; height:64px; flex:none; }
.viewer-footer .zoom-button { font-size:13px; width:78px; border-radius:20px; }
.viewer-footer .arrow { font-size:30px; }
.viewer-footer button:disabled { opacity:.25; cursor:default; }
@media (max-width:520px) { .main-area { padding:11px 12px 80px; } .folders-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; } .photos-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px 6px; } .folder-tile { padding:12px 8px; gap:6px; } .folder-glyph { font-size:24px; width:28px; } .folder-label { max-height:39px; } .crumb img { max-width:120px; } .viewer-header { height:60px; } }

/* Public landing page shares the native dark gallery style, without admin controls. */
.public-documents-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:12px; }
.public-document { display:flex; align-items:center; gap:12px; border:1px solid var(--edge); border-radius:12px; padding:13px 12px; background:var(--surface); color:inherit; text-decoration:none; min-width:0; }
.public-document:hover { border-color:#718ba9; }
.public-document .doc-icon { flex:none; font-size:12px; font-weight:800; border-radius:7px; background:#354d68; padding:9px 7px; color:#dceeff; }
.public-document .doc-label { min-width:0; width:100%; max-height:44px; object-fit:contain; object-position:left center; }
.public-page .main-area { padding-top:16px; }
.public-page h2:first-child { margin-top:12px; }
.return-public { display:block; margin:18px auto 0; }
@media(max-width:520px) { .public-documents-grid { grid-template-columns:1fr; } }

/* Fit both the web gallery and full-screen photo controls to iPhone landscape. */
@media (orientation: landscape) and (max-height: 560px) {
  .topbar { min-height: 48px; padding-top: 5px; padding-bottom: 5px; }
  .main-area { padding-top: 8px; padding-bottom: 24px; }
  .folder-nav { min-height: 42px; margin-bottom: 5px; }
  .viewer { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .viewer-header { height: 43px; padding-top: 2px; padding-bottom: 2px; gap: 6px; }
  .viewer-btn { height: 34px; width: 38px; font-size: 19px; }
  .viewer-title img { max-height: 32px; }
  .viewer-footer { height: 42px; padding-top: 2px; padding-bottom: 2px; }
  .viewer-footer .arrow { font-size: 25px; }
  .photo-metadata { max-height: 80px; }
  .photo-metadata img { max-height: 75px; }
}

/* Cloud-only management controls; never visible on the public hostname. */
.cloud-busy { opacity:.55; pointer-events:none; }
#cloud-public-actions[hidden] { display:none !important; }
@media(max-width:520px) {
  .top-actions { gap:5px; }
  #cloud-private-new-folder, #cloud-private-upload, #cloud-manage-public,
  #cloud-public-actions .ghost { font-size:11px; min-width:0; padding:0 7px; height:35px; }
  .identity { font-size:14px; gap:5px; }
  .brand-icon.small { width:28px; height:28px; }
}
