:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #192638;
  background: #f1f4fa;
  color-scheme: light;
  --line: #e0e7f0;
  --control-line: #c9d4e2;
  --muted: #526179;
  --blue: #2457b0;
  --blue-dark: #1a438c;
  --blue-tint: #eaf2ff;
  --surface: #fff;
  --shadow: 0 2px 5px #182c4e0a, 0 10px 26px #182c4e07;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden], .folders:empty, .files:empty { display: none !important; }
body { margin: 0; min-height: 100vh; }
h1, h2, p { margin: 0; }
h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 1.125rem; font-weight: 700; letter-spacing: -.015em; }
p { line-height: 1.5; }
button, input { font: inherit; }
button, input:not([type="file"]) {
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid var(--control-line);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
}
button {
  cursor: pointer;
  font-size: .9rem;
  font-weight: 650;
  transition: background-color .15s ease, border-color .15s ease;
}
button:hover:not(:disabled) { background: #f2f6fb; border-color: #aebed3; }
button:disabled { cursor: default; opacity: .58; }
button.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
button.primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); }
button.danger { color: #fff; background: #a32229; border-color: #a32229; }
button.danger:hover:not(:disabled) { background: #801b20; border-color: #801b20; }
a { color: var(--blue-dark); }
:focus-visible { outline: 2px solid #275ec1; outline-offset: 3px; }
.muted { color: var(--muted); }
.error { color: #922229; overflow-wrap: anywhere; }

.header { background: #172943; color: #f8faff; border-bottom: 1px solid #2c425d; }
.header-inner, .container { width: min(100% - 48px, 1080px); margin-inline: auto; }
.header-inner {
  min-height: 68px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-block: 8px;
}
.header button {
  min-height: 38px;
  border-color: #546781;
  background: #243b58;
  color: #f8faff;
}
.header button:hover:not(:disabled) { background: #334c6d; border-color: #8a9bb2; }
.header button:focus-visible { outline-color: #a4c4ff; }
.container { padding-block: 32px 48px; }

.login, .section {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.login { width: min(100%, 390px); margin: 26px auto; padding: 28px; }
.login h2, dialog h2 { font-size: 1.35rem; }
.login form, dialog form, .dialog-body { display: grid; gap: 10px; }
.login form { margin-top: 20px; }
.login button { margin-top: 8px; }
.login label, dialog label { font-size: .9rem; font-weight: 650; }
.login input, dialog input { width: 100%; min-width: 0; }
.login input + label { margin-top: 5px; }

#path {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 9px;
  margin-bottom: 16px;
  font-size: .875rem;
  color: var(--muted);
}
#path button {
  min-height: 32px;
  padding: 3px 7px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--blue-dark);
}
#path button:hover { background: var(--blue-tint); border-color: #cee0fa; }
#path span { overflow-wrap: anywhere; }
#path span:last-child { color: #253650; font-weight: 650; }

.upload {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  border: 1px dashed #a7b8d6;
  border-radius: 14px;
  background: linear-gradient(110deg, #f1f6ff, #fff 80%);
  padding: 23px;
  transition: border-color .15s ease, background-color .15s ease;
}
.upload.is-dragging { border-color: var(--blue); background: #e2edff; }
.upload-intro { display: flex; align-items: flex-start; gap: 13px; min-width: 0; }
.upload h2 { font-size: 1.25rem; }
.upload p { color: var(--muted); font-size: .875rem; margin-top: 4px; }
.upload button { padding-inline: 16px; }
.upload-symbol {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--blue-tint);
  color: var(--blue);
}
.upload-symbol span {
  position: relative;
  width: 22px;
  height: 22px;
  background: linear-gradient(currentColor, currentColor) center 4px / 2px 11px no-repeat;
}
.upload-symbol span::before, .upload-symbol span::after { content: ""; position: absolute; }
.upload-symbol span::before {
  width: 9px;
  height: 9px;
  top: 4px;
  left: 6.5px;
  border-top: 2px solid;
  border-left: 2px solid;
  transform: rotate(45deg);
}
.upload-symbol span::after {
  inset: 13px 3px 1px;
  border: 2px solid;
  border-top: 0;
  border-radius: 0 0 3px 3px;
}

.section { margin-top: 18px; padding: 17px 19px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}
.section > .muted {
  padding: 12px 13px;
  border-radius: 8px;
  background: #f5f7fb;
  font-size: .9rem;
}
.actions, .pages { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pages { justify-content: center; margin-top: 14px; font-size: .9rem; }
#create-folder, .file-url button { color: var(--blue-dark); border-color: #becfea; }
#create-folder:hover:not(:disabled), .file-url button:hover:not(:disabled) { background: #eaf2ff; border-color: #99b5e3; }
#remove-folder, .remove-file { color: #92252a; }
#remove-folder:hover:not(:disabled), .remove-file:hover:not(:disabled) {
  background: #fff2f2;
  border-color: #e2aab0;
}
.folders, .files {
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  list-style: none;
}
.folders li + li, .files li + li { border-top: 1px solid var(--line); }
.folders { overflow: hidden; }
.folder-link {
  display: block;
  width: 100%;
  padding: 9px 13px;
  border: 0;
  border-radius: 0;
  text-align: left;
  color: var(--blue-dark);
  overflow-wrap: anywhere;
}
.folder-link:focus-visible { outline-offset: -3px; }
.file {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}
.file-info {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.file-info img {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 7px;
  background: #edf1f7;
}
.file-name { display: block; overflow-wrap: anywhere; font-size: .9rem; font-weight: 650; }
.file-info[href] .file-name { color: var(--blue-dark); text-decoration: underline; }
.file-detail { display: block; margin-top: 2px; font-size: .8125rem; color: var(--muted); }
.file-url { display: flex; min-width: 0; gap: 6px; align-items: center; }
.file-url input {
  min-width: 0;
  width: 100%;
  background: #f7f9fc;
  font-family: Consolas, ui-monospace, monospace;
  font-size: .8125rem;
}
.file-url button { flex: 0 0 auto; }

.status, #upload-errors, #panel-error { margin-top: 10px; }
.status { color: var(--blue-dark); }
.notice {
  position: fixed;
  bottom: 14px;
  right: 14px;
  max-width: calc(100vw - 28px);
  padding: 10px 14px;
  border: 1px solid #334961;
  border-radius: 9px;
  background: #172943;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: .9rem;
}
dialog {
  width: min(100% - 24px, 430px);
  padding: 22px;
  border: 1px solid var(--control-line);
  border-radius: 13px;
  color: inherit;
  box-shadow: 0 14px 36px #1b2b4a2c;
}
dialog h2 { margin-bottom: 3px; }
.password-hint { font-size: .875rem; }
dialog .actions { justify-content: flex-end; margin-top: 6px; }
dialog::backdrop { background: #13233d65; }
#delete-info { overflow-wrap: anywhere; }

@media (max-width: 670px) {
  .header-inner, .container { width: calc(100% - 28px); }
  .header-inner { min-height: 60px; }
  .container { padding-top: 20px; }
  .upload { padding: 16px; gap: 14px; }
  .section { padding: 13px; }
  .section-header { min-height: 34px; }
  .file { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .file-url { grid-row: 2; grid-column: 1 / -1; }
}

@media (max-width: 400px) {
  .upload-symbol { flex-basis: 36px; height: 36px; }
  .upload-intro { gap: 9px; }
  .login { margin-top: 12px; padding: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  button, .upload { transition: none; }
}
