:root {
  --paper: #f8f7f3;
  --ink: #273b35;
  --muted: #7b8179;
  --red: #ae4d35;
  --line: #e7e7df;
  --green: #244d40;
  --serif: Georgia, "Noto Serif TC", "Songti TC", serif;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    14px/1.65 "Segoe UI",
    "Microsoft JhengHei",
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 9px;
  padding: 9px 15px;
}
button:hover {
  border-color: var(--red);
  color: var(--red);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #ca845b;
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 230px;
  background: #eeefe7;
  border-right: 1px solid #e1e4da;
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand svg {
  width: 38px;
  height: 42px;
  color: var(--red);
}
.brand strong {
  display: block;
  font: 600 19px var(--serif);
  letter-spacing: 2px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}
.brand small {
  color: #737d70;
  letter-spacing: 3px;
  font-size: 9px;
}
.nav-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: #8b9388;
  margin: 55px 15px 13px;
}
.side-nav {
  display: grid;
  gap: 8px;
}
.side-nav a,
.side-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  font-size: 13px;
}
.side-nav .active {
  background: var(--green);
  color: white;
  box-shadow: 0 5px 12px #244d4015;
}
.side-nav svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 30px;
}
.season-note {
  border-top: 1px solid #d9dfd0;
  padding: 24px 8px;
  color: #6c7c69;
  font-size: 12px;
}
.season-note b {
  font: italic 23px var(--serif);
  color: #8c553d;
  display: block;
  margin-bottom: 9px;
}
.user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 18px;
}
.avatar {
  border-radius: 50%;
  background: #dbdfcc;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font: 17px var(--serif);
}
.user span {
  font-size: 11px;
  color: #727f70;
}
.user strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}
.user button {
  margin-left: auto;
  padding: 4px 8px;
  background: transparent;
}
.layout {
  margin-left: 230px;
  padding: 0 46px 20px;
  max-width: 1800px;
}
.topbar {
  height: 93px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}
.topbar .trail {
  font-size: 12px;
  color: var(--muted);
}
.trail span {
  color: var(--ink);
  padding-left: 16px;
}
.tools {
  display: flex;
  align-items: center;
  gap: 20px;
}
.tools select {
  background: transparent;
  border: 0;
  color: #737c73;
  font-size: 12px;
  max-width: 100px;
}
.pill {
  border: 1px solid #e4e4d8;
  border-radius: 99px;
  padding: 5px 11px;
  font-size: 10px;
  color: #6c7866;
}
.pill i {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7a9169;
  margin-right: 6px;
}
.welcome {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 31px 0 24px;
}
.welcome h1 {
  font: 400 29px var(--serif);
  letter-spacing: 1px;
  margin: 0 0 6px;
}
.welcome p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.season-date {
  text-align: right;
  color: #9c6b50;
  font: italic 15px var(--serif);
}
.season-date small {
  display: block;
  font:
    9px "Segoe UI",
    sans-serif;
  letter-spacing: 2px;
  color: #93978a;
  margin-top: 5px;
}
.hero {
  position: relative;
  border-radius: 14px;
  background: #eae8db;
  overflow: hidden;
  height: 300px;
  border: 1px solid #e4dfcf;
}
.hero-copy {
  position: absolute;
  left: 32px;
  top: 28px;
  z-index: 1;
  pointer-events: none;
}
.hero-copy .eyebrow {
  color: #a56842;
}
.hero-copy h2 {
  font: 400 36px/1.35 var(--serif);
  letter-spacing: 3px;
  margin: 13px 0 10px;
}
.hero-copy p {
  font-size: 11px;
  color: #818270;
  letter-spacing: 1px;
}
.hero-art {
  width: 100%;
  height: 100%;
  display: block;
}
.hero-controls {
  position: absolute;
  bottom: 17px;
  left: 28px;
  display: flex;
  gap: 6px;
}
.hero-controls button {
  border-color: #fff8;
  background: #faf8efca;
  padding: 5px 10px;
  border-radius: 50px;
  font-size: 10px;
  backdrop-filter: blur(8px);
}
.hero-controls button[aria-pressed="true"] {
  background: #335441;
  color: white;
  border-color: #335441;
}
.scene-caption {
  position: absolute;
  right: 24px;
  bottom: 17px;
  font-size: 9px;
  letter-spacing: 2px;
  color: #646c54;
}
.leaf-drift {
  animation: fall 11s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.leaf-two {
  animation-delay: -4s;
  animation-duration: 14s;
}
.leaf-three {
  animation-delay: -8s;
  animation-duration: 16s;
}
.tree-sway {
  animation: sway 7s ease-in-out infinite alternate;
  transform-origin: bottom;
  transform-box: fill-box;
}
.walker {
  animation: stroll 12s ease-in-out infinite alternate;
}
.paused-leaves .leaf-drift,
.paused-city .tree-sway,
.paused-city .walker {
  animation-play-state: paused;
}
.paused-city .lamp-glow {
  opacity: 0;
}
@keyframes fall {
  0% {
    transform: translate(0, -90px) rotate(-20deg);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    transform: translate(100px, 180px) rotate(180deg);
    opacity: 0;
  }
}
@keyframes sway {
  to {
    transform: rotate(2deg);
  }
}
@keyframes stroll {
  to {
    transform: translateX(24px);
  }
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 26px;
  margin-top: 29px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.section-head h2 {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  letter-spacing: 1px;
}
.section-head h2 small {
  font:
    10px "Segoe UI",
    sans-serif;
  color: #969b90;
  letter-spacing: 1px;
  margin-left: 8px;
}
.section-head button {
  font-size: 11px;
  padding: 7px 10px;
  background: transparent;
}
.file-panel {
  min-width: 0;
}
.file-toolbar {
  display: flex;
  gap: 9px;
  margin-bottom: 17px;
  align-items: center;
}
.search {
  flex: 1;
  position: relative;
}
.search svg {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 15px;
  height: 15px;
  stroke: #8a9389;
  fill: none;
  stroke-width: 1.5;
}
.search input {
  padding: 9px 12px 9px 36px;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff9;
  border-radius: 8px;
  font-size: 11px;
  color: var(--ink);
}
.file-toolbar select {
  max-width: 100px;
  border: 1px solid var(--line);
  padding: 8px;
  background: transparent;
  border-radius: 8px;
  font-size: 11px;
  color: var(--muted);
}
.crumb {
  font-size: 11px;
  color: var(--muted);
  margin: 12px 0;
}
.crumb a:hover {
  color: var(--red);
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
  text-align: left;
  font-size: 12px;
}
th {
  font-size: 10px;
  font-weight: 400;
  color: #8c9387;
  padding: 10px 12px;
  background: #edeee6;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
}
th:first-child {
  border-radius: 6px 0 0 6px;
}
td:first-child {
  min-width: 185px;
}
td:last-child {
  text-align: right;
}
td button {
  padding: 3px 6px;
  font-size: 10px;
  background: transparent;
  border: 0;
  margin: 0 1px;
}
td a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
td a:hover {
  color: var(--red);
}
.file-icon {
  width: 30px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: #ebe7d9;
  color: #9e8253;
  font-size: 9px;
  font-weight: 600;
}
.file-icon.folder {
  background: #e6eadb;
  color: #6d805b;
}
.file-icon.photo {
  background: #eee0d3;
  color: #b27850;
}
.level-tag {
  background: #eeeee7;
  border: 1px solid #e3e4da;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 9px;
  color: #78836e;
}
.empty {
  text-align: center;
  padding: 30px;
  color: var(--muted);
  font-size: 12px;
}
.upload-card {
  padding: 21px;
  background: #f0f1e9;
  border: 1px solid #e5e7dc;
  border-radius: 12px;
}
.upload-card h2 {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 500;
}
.upload-card > p {
  margin: 0 0 18px;
  color: #939a8c;
  font-size: 10px;
  letter-spacing: 1px;
}
.dropzone {
  border: 1px dashed #bbc6ac;
  border-radius: 9px;
  text-align: center;
  padding: 24px 12px 20px;
  background: #f8f9f2;
  transition:
    background 0.2s,
    border 0.2s;
}
.dropzone.over {
  background: #e0e9d5;
  border-color: var(--green);
  box-shadow: 0 0 0 3px #244d4020;
}
.dropzone svg {
  width: 55px;
  height: 49px;
  color: #799168;
  margin-bottom: 10px;
}
.dropzone strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}
.dropzone small {
  display: block;
  color: #9b9f90;
  font-size: 10px;
  margin: 5px 0 15px;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.primary:hover {
  background: #35614f;
  color: white;
  border-color: #35614f;
}
.dropzone button {
  width: 100%;
  font-size: 11px;
}
.upload-note {
  font-size: 10px;
  color: #818b77;
  margin: 13px 0 0;
}
.queue {
  list-style: none;
  margin: 15px 0 0;
  padding: 0;
  max-height: 260px;
  overflow: auto;
}
.queue li {
  border-top: 1px solid #dce0d2;
  padding: 10px 0;
  font-size: 11px;
}
.queue .qtop {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.queue .qname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}
.queue .qstatus {
  font-size: 10px;
  color: #7b806c;
}
.queue progress {
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 7px;
  accent-color: var(--green);
}
.queue button {
  font-size: 10px;
  padding: 2px 6px;
  margin-top: 6px;
}
.queue .failed {
  color: #b34e35;
}
.mini-note {
  display: flex;
  gap: 13px;
  margin: 19px 3px;
  color: #8c927f;
  font-size: 10px;
}
.mini-note svg {
  width: 25px;
  height: 32px;
  flex-shrink: 0;
}
.mini-note strong {
  display: block;
  font-size: 11px;
  color: #63775e;
  font-weight: 500;
  margin-bottom: 4px;
}
.admin {
  margin-top: 25px;
  overflow: auto;
}
.admin h2 {
  font-size: 15px;
  font-weight: 500;
}
.admin select {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px;
  color: var(--ink);
  background: transparent;
}
.message {
  font-size: 12px;
  min-height: 20px;
  color: var(--red);
  margin: 15px 0;
}
.preview-banner {
  font-size: 11px;
  background: #f2e4cf;
  color: #85603e;
  padding: 9px 15px;
  border-radius: 6px;
  margin: 18px 0 0;
}
.footer {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  color: #929989;
  font-size: 9px;
  letter-spacing: 1px;
  padding: 16px 0;
  margin-top: 20px;
}
.loading {
  color: var(--muted);
  padding: 20px;
}
.results-note {
  font-size: 10px;
  color: #929989;
  margin-top: 14px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 25px;
  width: min(400px, 90vw);
  box-shadow: 0 20px 80px #142c3422;
  color: var(--ink);
  background: var(--paper);
}
dialog::backdrop {
  background: #20362c66;
  backdrop-filter: blur(4px);
}
dialog h2 {
  font-size: 18px;
  margin: 0 0 15px;
}
dialog input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  margin: 8px 0 20px;
  background: white;
}
dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}
@media (min-width: 1500px) {
  .hero {
    height: 350px;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}
@media (max-width: 1150px) {
  .sidebar {
    width: 190px;
    padding: 30px 16px;
  }
  .layout {
    margin-left: 190px;
    padding: 0 25px;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 18px;
  }
  .hero-copy h2 {
    font-size: 30px;
  }
  .hero-copy {
    left: 25px;
  }
  .hero {
    height: 280px;
  }
  td {
    padding: 14px 8px;
  }
}
@media (max-width: 900px) {
  .sidebar {
    width: 74px;
    padding: 28px 12px;
  }
  .brand strong,
  .brand small,
  .nav-label,
  .side-nav span,
  .sidebar-bottom {
    display: none;
  }
  .brand {
    justify-content: center;
  }
  .side-nav {
    margin-top: 45px;
  }
  .side-nav a,
  .side-nav button {
    justify-content: center;
    padding: 12px;
  }
  .layout {
    margin-left: 74px;
    padding: 0 22px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .upload-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 22px;
  }
  .upload-card h2,
  .upload-card > p {
    grid-column: 1;
  }
  .dropzone {
    grid-row: 1 / span 5;
    grid-column: 2;
  }
  .queue {
    grid-column: 1;
  }
  .hero-copy h2 {
    font-size: 29px;
  }
  .hero-copy p {
    max-width: 140px;
  }
  .tools {
    gap: 8px;
  }
}
@media (max-width: 560px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 20px;
  }
  .brand strong {
    display: block;
    font-size: 16px;
  }
  .brand svg {
    width: 26px;
    height: 30px;
  }
  .side-nav {
    display: flex;
    margin: 0 0 0 auto;
    gap: 4px;
  }
  .side-nav a,
  .side-nav button {
    padding: 9px;
  }
  .side-nav span {
    display: none;
  }
  .layout {
    margin: 0;
    padding: 0 18px;
  }
  .topbar {
    height: 58px;
  }
  .topbar .trail {
    font-size: 10px;
  }
  .trail span {
    padding-left: 6px;
  }
  .pill {
    font-size: 9px;
  }
  .tools select {
    font-size: 10px;
    max-width: 75px;
  }
  .welcome {
    padding: 23px 0 20px;
  }
  .welcome h1 {
    font-size: 25px;
  }
  .welcome p {
    font-size: 10px;
  }
  .season-date {
    font-size: 12px;
  }
  .season-date small {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .hero {
    height: 350px;
  }
  .hero-art {
    width: 175%;
    max-width: none;
    position: absolute;
    right: -55px;
    bottom: -30px;
    height: 260px;
  }
  .hero-copy {
    top: 22px;
    left: 23px;
  }
  .hero-copy h2 {
    font-size: 29px;
    margin: 8px 0;
  }
  .hero-copy p {
    max-width: none;
    font-size: 10px;
  }
  .hero-controls {
    left: 20px;
    bottom: 15px;
  }
  .scene-caption {
    display: none;
  }
  .workspace {
    margin-top: 25px;
  }
  .section-head h2 small {
    font-size: 8px;
  }
  .upload-card {
    display: block;
  }
  .footer span:last-child {
    display: none;
  }
  .file-toolbar {
    flex-wrap: wrap;
  }
  .search {
    min-width: 150px;
  }
  .mini-note {
    margin-bottom: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .leaf-drift,
  .tree-sway,
  .walker {
    animation: none !important;
  }
  * {
    scroll-behavior: auto !important;
  }
}


/* 提示文本居中 */
#home-status { text-align: center; }

/* 側欄在 /api/nav 回傳前不顯示，避免權限項閃現 */
.side-nav:not(.ready) { visibility: hidden; }

/* 狀態文字排版：表格內置中，腳本錯誤區塊左對齊 */
#rows td[colspan], #rows td.loading { text-align: center; }
#msg.message { text-align: left; }
pre, code, .error-log, .error-box { text-align: left; }
