:root {
  color-scheme: light;
  --ink: #202822;
  --muted: #546257;
  --soft: #eef1e9;
  --line: #dce2d8;
  --page: #f5f7f2;
  --white: #fff;
  --orange: #a73a1d;
  --orange-hover: #862d16;
  --green: #225943;
  --gutter: clamp(1rem, 4vw, 3rem);
  --gutter-left: max(var(--gutter), env(safe-area-inset-left));
  --gutter-right: max(var(--gutter), env(safe-area-inset-right));
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p, figure { margin: 0; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.05; letter-spacing: -.055em; }
h2 { font-size: 1.15rem; letter-spacing: -.025em; }
h3 { font-size: 1.05rem; }
p, small { color: var(--muted); }
small { font-size: .875rem; }
a { color: var(--green); }
button, input { font: inherit; }
button, .button {
  align-items: center; justify-content: center; display: inline-flex;
  min-height: 42px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--white); color: var(--ink); padding: .5rem .85rem;
  cursor: pointer; text-decoration: none; font-size: .9rem; font-weight: 650;
}
button:hover, .button:hover { background: var(--soft); }
button:disabled { opacity: .65; cursor: wait; }
button.primary, .button.primary { background: var(--orange); border-color: var(--orange); color: white; }
button.primary:hover, .button.primary:hover { background: var(--orange-hover); border-color: var(--orange-hover); }
.quiet { background: transparent; border-color: transparent; }
.danger { color: #a32e21; }
:focus-visible { outline: 3px solid #317b60; outline-offset: 3px; }
input {
  min-height: 44px; width: 100%; border-radius: 9px; border: 1px solid #c9d1c5;
  padding: .55rem .75rem; color: var(--ink); background: white;
}
input[type=file] { padding: .4rem; }
input::file-selector-button {
  border: 0; border-radius: 6px; background: var(--soft); padding: .25rem .5rem; color: var(--ink);
  font: inherit; cursor: pointer; margin-right: .5rem;
}
label { display: block; font-size: .9rem; font-weight: 650; margin-bottom: .3rem; }
.top { background: var(--white); border-bottom: 1px solid var(--line); }
.top-inner {
  max-width: 1296px; margin: auto; min-height: 76px;
  padding: max(.75rem, env(safe-area-inset-top)) var(--gutter-right) .75rem var(--gutter-left);
  display: flex; gap: .65rem; align-items: center; justify-content: space-between;
}
.brand { display: flex; gap: .7rem; align-items: center; color: var(--ink); text-decoration: none; font-weight: 740; line-height: 1.18; }
.brand small { display: block; margin-top: .14rem; font-size: .875rem; font-weight: 550; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; background: var(--orange); position: relative; flex: none; }
.brand-mark::before { content: ""; position: absolute; inset: 11px 9px; border: 1.5px solid white; border-radius: 4px; }
.brand-mark::after {
  content: ""; position: absolute; left: 17px; top: 16px;
  width: 0; height: 0; border: 4px solid transparent; border-left: 6px solid white;
}
.actions, .dialog-actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.workspace { max-width: 1296px; margin: auto; padding: 2.55rem var(--gutter-right) 3.5rem var(--gutter-left); }
.intro { margin-bottom: 1.8rem; }
.intro p { margin-top: .65rem; }
.layout { display: grid; grid-template-columns: minmax(235px, 290px) minmax(0, 1fr); align-items: start; gap: 1rem; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 16px; }
.sidebar { min-height: 28rem; overflow: hidden; }
.sidebar-head { padding: 1.05rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: .65rem; }
.count { min-width: 1.9rem; padding: .15rem .45rem; border-radius: 100px; background: var(--soft); text-align: center; font-size: .875rem; }
#search { margin-top: .8rem; font-size: .9rem; }
#folders { padding: 0 .65rem .7rem; }
.empty-list { display: block; padding: .6rem .4rem; }
.folder-link {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: .12rem; text-decoration: none;
  color: var(--ink); border: 1px solid transparent; padding: .65rem .55rem; border-radius: 9px;
}
.folder-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 620; }
.folder-link:is(:hover, [aria-current]) { background: var(--soft); border-color: var(--line); }
.detail { min-height: 28rem; padding: clamp(1.1rem, 3vw, 2rem); overflow-wrap: anywhere; }
.detail h2 { font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.15; }
.empty { min-height: 23.8rem; display: grid; place-content: center; justify-items: center; text-align: center; gap: .7rem; }
.empty p { max-width: 36ch; }
.folder-icon { display: block; width: 64px; height: 64px; border-radius: 18px; background: var(--soft); position: relative; }
.folder-icon::before { content: ""; position: absolute; inset: 25px 15px 16px; border: 2px solid var(--green); border-radius: 4px; }
.folder-icon::after {
  content: ""; position: absolute; top: 19px; left: 15px; width: 17px; height: 10px;
  border: 2px solid var(--green); border-bottom: 0; border-right-color: transparent; border-radius: 4px 4px 0 0;
}
.detail-header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; flex-wrap: wrap; }
.product-meta { margin-top: .55rem; display: flex; gap: .4rem 1rem; flex-wrap: wrap; }
.product-meta a { font-weight: 650; }
.file-section { border-top: 1px solid var(--line); margin-top: 1.35rem; padding-top: 1.2rem; }
.file-section .section-title { align-items: start; flex-wrap: wrap; margin-bottom: .75rem; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 148px), 1fr)); gap: .75rem; }
.image-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-width: 0; }
.image-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--page); }
.image-card figcaption { display: grid; gap: .4rem; padding: .5rem; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-controls { display: flex; gap: .25rem; align-items: center; flex-wrap: wrap; }
.file-controls :is(button, a) { padding: .2rem .45rem; min-height: 34px; }
.video-row {
  border: 1px solid var(--line); background: var(--page); border-radius: 10px; padding: .75rem;
  display: flex; gap: .65rem; justify-content: space-between; align-items: center; flex-wrap: wrap;
}
.video-row strong { display: block; }
.upload-info { margin-top: .65rem; display: block; }
.loading { margin: 3rem auto; text-align: center; }
.login { max-width: 440px; margin: 7vh auto 2rem; padding: clamp(1.2rem, 5vw, 2.1rem); }
.login h1 { margin: 1.1rem 0 .5rem; font-size: 2rem; }
.login form { margin-top: 1.4rem; }
.login form button { margin-top: .85rem; width: 100%; }
.mobile-back { display: none; }
.image-unavailable { display: grid; aspect-ratio: 4 / 3; place-content: center; padding: .6rem; text-align: center; background: var(--page); }
.notice {
  position: fixed; z-index: 2; right: 1rem; bottom: 1rem; width: max-content; max-width: calc(100% - 2rem);
  border: 1px solid var(--line); border-radius: 10px; background: var(--white); padding: .65rem .85rem;
  box-shadow: 0 6px 25px #28312418; overflow-wrap: anywhere;
}
.notice.error, .error { color: #982e22; }
form p.error { margin-top: .65rem; }
dialog { width: min(480px, calc(100% - 1.5rem)); padding: 1.35rem; border-radius: 16px; border: 1px solid var(--line); color: var(--ink); }
dialog::backdrop { background: #20282291; }
dialog label { margin-top: .75rem; }
dialog small { display: block; margin-top: .3rem; }
.icon-button { font-size: 1.25rem; }
.dialog-actions { justify-content: flex-end; margin-top: 1.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 690px), (max-width: 960px) and (orientation: landscape) and (pointer: coarse) {
  :root { --gutter: 1rem; }
  .top-inner { min-height: 68px; padding-top: max(.65rem, env(safe-area-inset-top)); }
  .top-inner .actions { flex-wrap: nowrap; }
  .top-inner button { white-space: nowrap; padding-inline: .65rem; }
  .top-inner .quiet { padding-inline: .45rem; }
  .brand { gap: .45rem; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-mark::after { left: 15px; top: 14px; }
  button, .button, .file-controls :is(button, a), input[type=file] { min-height: 44px; }
  #search, input { font-size: 1rem; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-height: auto; }
  .folder-link { min-height: 54px; }
  .workspace { padding-top: 1.4rem; padding-bottom: max(2rem, calc(env(safe-area-inset-bottom) + 1rem)); }
  .has-folder :is(.intro, .sidebar), .has-folders:not(.has-folder) .detail { display: none; }
  .has-folder .mobile-back { display: inline-flex; margin-bottom: .75rem; }
  .detail { min-height: 0; }
  .empty { min-height: 13rem; }
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 125px), 1fr)); }
  .image-card .file-controls :is(button, a) { flex: 1 1 auto; }
  .video-row .actions { width: 100%; }
  .video-row .primary { flex: 1; }
  .notice {
    right: var(--gutter-right);
    bottom: max(1rem, calc(env(safe-area-inset-bottom) + .5rem));
    max-width: calc(100% - var(--gutter-left) - var(--gutter-right));
  }
  .login { width: min(440px, calc(100% - var(--gutter-left) - var(--gutter-right))); margin-top: clamp(1rem, 6vh, 3rem); }
  dialog {
    inset: auto var(--gutter-right) auto var(--gutter-left);
    top: calc(var(--dialog-top, 0px) + max(.5rem, env(safe-area-inset-top)));
    width: min(480px, calc(100% - var(--gutter-right) - var(--gutter-left)));
    max-height: calc(100vh - 2rem);
    max-height: calc(var(--dialog-height, 100dvh) - max(.5rem, env(safe-area-inset-top)) - max(.5rem, env(safe-area-inset-bottom)));
    margin-block: 0;
    overflow-y: auto;
    scroll-padding-block-end: 4.5rem;
    padding: 1rem;
  }
  .dialog-actions {
    position: sticky;
    bottom: -1rem;
    background: var(--white);
    padding-block: .55rem 1rem;
    margin-bottom: -1rem;
  }
}
@media (max-width: 350px) {
  .brand-mark { display: none; }
}
