:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #202821;
  background: #f6f5ef;
  font-synthesis: none;
  --ink: #202821;
  --muted: #526057;
  --surface: #fffefa;
  --line: #dedfd4;
  --forest: #254638;
  --green: #3c654f;
  --radius: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
a, button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
:focus-visible { outline: 3px solid #587c61; outline-offset: 3px; }

.frame { width: min(100% - 72px, 1320px); margin-inline: auto; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-content { display: flex; align-items: center; justify-content: space-between; min-height: 76px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 680; letter-spacing: -.01em; }
.brand-mark {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; border-radius: 9px; overflow: hidden;
}
.brand-mark img { width: 132%; height: 132%; flex: none; object-fit: contain; }

.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 28px 0 16px; color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.breadcrumbs a:hover { text-decoration: underline; }
.separator { color: #6f7c72; }
.folder-heading {
  display: flex; justify-content: space-between; align-items: end; gap: 20px;
  border-radius: 20px; background: var(--forest); color: #fffdf4;
  padding: clamp(22px, 4.2vw, 52px); min-height: 174px;
  background-image: radial-gradient(ellipse at 105% -18%, #476b54 0%, transparent 68%);
}
.folder-heading > div { min-width: 0; }
.folder-heading h1 { font-weight: 660; font-size: clamp(1.8rem, 4vw, 3.45rem); line-height: 1.06; letter-spacing: -.035em; overflow-wrap: anywhere; }
.folder-heading p { color: #dae7d8; font-size: .9rem; margin-top: 13px; }
.folder-heading p:empty { display: none; }

.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 9px;
  min-height: 41px; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px;
  font-size: .86rem; font-weight: 640; white-space: nowrap;
}
.button.primary { background: var(--forest); color: #fffdf4; }
.button.primary:hover { background: var(--green); }
.button.quiet { background: transparent; border-color: var(--line); color: var(--ink); }
.button.quiet:hover:not(:disabled) { background: #eeefe6; }
.folder-heading .primary { background: #f3e5c7; color: var(--forest); }
.folder-heading .primary:hover { background: #fff2d6; }
.folder-actions, .viewer-actions, .tile-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.folder-actions { flex: 0 1 auto; justify-content: flex-end; }
.button.cover-secondary { background: transparent; color: #fffdf4; border-color: #e6e0c87a; }
.button.cover-secondary:hover { background: #ffffff16; }
.download-icon { position: relative; width: 15px; height: 15px; border-bottom: 1.5px solid currentColor; flex: none; }
.download-icon::before { content: ""; position: absolute; top: 0; left: 7px; height: 10px; border-left: 1.5px solid currentColor; }
.download-icon::after { content: ""; position: absolute; top: 4px; left: 5px; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; margin: 27px 0 17px; }
.toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 5px; }
.filters button { padding: 7px 13px; min-height: 37px; color: var(--muted); border: 1px solid transparent; background: transparent; border-radius: 8px; font-size: .86rem; font-weight: 600; }
.filters button:hover { background: #eaede3; }
.filters button[aria-pressed="true"] { background: #e1e9dc; border-color: #d9e3d4; color: #254638; }
.search { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); }
.search input { width: clamp(160px, 22vw, 256px); background: transparent; color: var(--ink); border: 0; font-size: .86rem; }
.search:focus-within { outline: 2px solid #587c61; outline-offset: 2px; }
.search input:focus-visible { outline: none; }
.search-icon { width: 11px; height: 11px; position: relative; border: 1.5px solid currentColor; border-radius: 50%; flex: none; }
.search-icon::after { content: ""; position: absolute; width: 5px; border-top: 1.5px solid currentColor; transform: rotate(45deg); left: 7px; top: 8px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 16px; padding-bottom: 48px; }
.tile { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 2px #2436260a; }
.tile:hover { border-color: #aebaac; }
.tile[data-selected="true"] { border-color: var(--green); background: #edf2e8; }
.folder-checkbox { display: none; position: absolute; z-index: 2; top: 9px; left: 9px; width: 24px; height: 24px; margin: 0; accent-color: var(--forest); cursor: pointer; }
.gallery[data-selecting-folders="true"] .folder-checkbox { display: block; }
.zip-selection { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-bottom: 16px; padding: 10px 13px; border: 1px solid #cbd8c9; border-radius: 10px; background: #edf2e8; }
.zip-selection p { color: var(--forest); font-size: .86rem; }
.tile-preview { display: grid; place-items: center; position: relative; width: 100%; aspect-ratio: 7 / 4; padding: 0; border: 0; color: var(--forest); background: #e7ece3; }
.tile-preview:focus-visible { outline-offset: -4px; }
.tile-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile[data-kind="folder"] .tile-preview { background: #ece8d8; color: #686043; }
.tile[data-kind="video"] .tile-preview { background: #dbe8e0; }
.file-symbol { position: relative; display: grid; place-items: center; flex: none; }
.file-symbol.folder { width: 46px; height: 32px; border: 1.5px solid #8a805d; border-radius: 6px; background: #e6d5ae; }
.file-symbol.folder::before { content: ""; position: absolute; left: 1px; top: -7px; width: 22px; height: 7px; border: 1.5px solid #8a805d; border-bottom: 0; border-radius: 4px 5px 0 0; background: #e6d5ae; }
.file-symbol.video { width: 46px; height: 46px; border: 1.5px solid #75917e; border-radius: 50%; }
.file-symbol.video::before { content: ""; margin-left: 4px; border: 9px solid transparent; border-left: 13px solid #41624f; border-right: 0; }
.tile-preview.has-poster .file-symbol.video { z-index: 1; width: 36px; height: 36px; background: #17241dcc; border-color: #fffdf4b0; }
.tile-preview.has-poster .file-symbol.video::before { border-width: 6px 0 6px 9px; border-left-color: #fffdf4; }
.file-symbol.file, .file-symbol.photo { width: 42px; height: 47px; border: 1.5px solid #7d897e; border-radius: 6px; font-size: .63rem; font-weight: 750; }
.file-symbol.photo::before { content: ""; width: 18px; height: 18px; border: solid #7d897e; border-width: 1.5px 0 0 1.5px; transform: translateY(4px) rotate(45deg); }
.tile-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 13px; }
.tile-text { min-width: 0; }
.tile-name { display: block; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; max-width: 100%; padding: 0; background: none; border: 0; color: var(--ink); text-align: left; font-size: .87rem; font-weight: 640; }
.tile-name:hover { text-decoration: underline; }
.tile-meta { margin-top: 5px; color: var(--muted); line-height: 1.35; font-size: .74rem; }
.tile-download { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; color: var(--forest); flex: none; }
.tile-download:hover { background: #e9efe4; }
.tile-actions { flex-wrap: nowrap; }
.tile-share, .share-trigger { color: var(--forest); background: #edf2e8; }
.tile-share:hover, .share-trigger:hover { background: #dfeadd; border-color: #9eb4a0; }
.share-mark { display: block; flex: none; }
.gallery[data-layout="tiles"] .tile-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.gallery[data-layout="tiles"] .tile-text { display: contents; }
.gallery[data-layout="tiles"] .tile-name { grid-column: 1 / -1; }
.gallery[data-layout="tiles"] .tile-meta { margin-top: 0; }
.gallery[data-layout="list"] { grid-template-columns: minmax(0, 1fr); gap: 7px; }
.gallery[data-layout="list"] .tile { display: grid; grid-template-columns: 66px minmax(0, 1fr); border-radius: 10px; }
.gallery[data-layout="list"][data-selecting-folders="true"] .tile[data-kind="folder"] { padding-left: 41px; }
.gallery[data-layout="list"] .folder-checkbox { top: 50%; transform: translateY(-50%); }
.gallery[data-layout="list"] .tile-preview { aspect-ratio: auto; min-height: 54px; }
.gallery[data-layout="list"] .file-symbol { transform: scale(.67); }
.gallery[data-layout="list"] .tile-preview.has-poster .file-symbol.video { width: 26px; height: 26px; transform: none; }
.gallery[data-layout="list"] .tile-info { padding-block: 9px; }
.gallery[data-layout="list"] .tile-meta { margin-top: 3px; }
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 76px; margin-top: 18px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); }

.viewer { padding: 0; width: min(940px, 100% - 28px); max-height: calc(100% - 28px); border: 1px solid #b9c3b5; border-radius: 17px; background: var(--surface); color: var(--ink); }
.viewer::backdrop { background: #101a15bb; }
.viewer-header, .viewer-footer { padding: 14px 19px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.viewer-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.viewer-header h2 { font-size: clamp(.95rem, 2.1vw, 1.25rem); overflow-wrap: anywhere; }
.viewer-header p { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.viewer-content { display: grid; place-items: center; min-height: 130px; background: #17241d; color: #fffdf4; }
.viewer-content img, .viewer-content video { display: block; max-width: 100%; max-height: 64vh; object-fit: contain; }
.viewer-content video { width: 100%; }
.viewer-message { padding: 25px; text-align: center; }
.viewer-nav { display: flex; justify-content: center; align-items: center; gap: 10px; }
.viewer-footer .viewer-nav { grid-column: 2; }
.viewer-footer .viewer-actions { grid-column: 3; justify-content: flex-end; }
.viewer-step { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-width: 46px; height: 46px; padding: 0 14px; border: 1px solid #cbd8c9; border-radius: 999px; background: #edf2e8; color: var(--forest); }
.viewer-step:hover:not(:disabled) { border-color: #9eb4a0; background: #dfeadd; }
.viewer-chevron { display: inline-block; width: 9px; height: 9px; flex: none; border: solid currentColor; border-width: 2px 2px 0 0; transform: rotate(45deg); }
.viewer-chevron.previous { transform: rotate(-135deg); }
.seek-label { display: none; font-size: .8rem; font-weight: 650; white-space: nowrap; }
.viewer-nav[data-kind="video"] .seek-label { display: inline; }
.download-options { max-width: 540px; }
#download-record { overflow-wrap: anywhere; }
.download-versions { display: grid; gap: 8px; padding: 0 19px 19px; }
.download-versions a { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 10px;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: #edf2e8; color: var(--forest); }
.download-versions a:hover { border-color: #9eb4a0; background: #dfeadd; }
.download-versions .download-icon { grid-row: span 2; }
.download-version-name { font-size: .9rem; font-weight: 640; overflow-wrap: anywhere; }
.download-version-meta { font-size: .8rem; color: var(--muted); }
.share-notice { position: fixed; inset: auto 14px max(14px, env(safe-area-inset-bottom)) auto; z-index: 10; display: grid; gap: 8px;
  width: min(360px, 100% - 28px); max-width: none; max-height: calc(100dvh - 28px); overflow: auto; overscroll-behavior: contain;
  margin: 0; padding: 12px 14px; border: 1px solid #b5c7b4; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 6px 24px #17241d30; }
.share-notice-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
#share-status { font-weight: 650; line-height: 1.35; }
.share-help { margin-top: 3px; color: var(--muted); font-size: .85rem; }
#close-share { min-height: 29px; padding: 0 8px; font-size: 1.2rem; }
.share-time-toggle { justify-self: start; min-height: 32px; }
.share-notice form, #share-result { display: flex; align-items: end; flex-wrap: wrap; gap: 7px; }
.share-notice label { display: grid; flex: 1 1 145px; min-width: 0; gap: 5px; font-size: .85rem; }
.share-notice input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 8px; font: inherit; }
.shared-item { padding-block: 24px 36px; }
.shared-item .viewer-content { margin-top: 12px; border-radius: var(--radius); overflow: hidden; }
.shared-navigation { margin-top: 13px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card { display: grid; grid-template-columns: .85fr 1fr; width: min(810px, 100%); min-height: 450px; overflow: hidden; border-radius: 24px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 24px 70px #2a3b2417; }
.login-cover { display: grid; place-items: center; min-height: 160px; background: radial-gradient(ellipse at 0% 95%, #50745a, var(--forest) 72%); }
.login-book { display: block; width: clamp(146px, 21vw, 184px); height: auto; border-radius: 16%; box-shadow: 0 12px 32px #14271e55; }
.login-panel { align-self: center; padding: clamp(25px, 5vw, 52px); }
.login-panel h1 { font-size: clamp(1.75rem, 3.5vw, 2.8rem); line-height: 1.06; font-weight: 660; letter-spacing: -.037em; }
.login-panel > p { margin-top: 10px; color: var(--muted); font-size: .93rem; }
.login-panel form { display: grid; gap: 10px; margin-top: 24px; }
.login-panel label { font-size: .86rem; font-weight: 650; }
.login-panel input { min-width: 0; min-height: 45px; padding: 8px 11px; border: 1px solid #b7c0b1; border-radius: 8px; background: #fdfcf7; color: var(--ink); }
.login-panel .primary { margin-top: 3px; justify-content: space-between; min-height: 44px; }
.form-error { color: #8b2a25; font-size: .83rem; }

@media (max-width: 640px) {
  .frame { width: calc(100% - 28px); }
  .header-content { min-height: 61px; }
  .breadcrumbs { margin-top: 18px; }
  .folder-heading { align-items: start; flex-direction: column; min-height: 0; }
  .folder-actions { justify-content: flex-start; }
  .toolbar { margin-top: 19px; }
  .toolbar-actions { width: 100%; }
  .search, .search input { width: 100%; min-width: 0; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .tile-info { padding: 9px 8px; }
  .tile-download { width: 30px; height: 30px; }
  .tile-meta { font-size: .68rem; }
  .viewer-footer { grid-template-columns: 1fr; }
  .viewer-footer .viewer-nav, .viewer-footer .viewer-actions { grid-column: 1; justify-content: center; }
  .login-page { padding: 16px; }
  .login-card { grid-template-columns: 1fr; }
  .login-book { width: clamp(98px, 24vw, 126px); }
}
