:root {
  --brand-ink: #0b0f19;
  --brand-ink-strong: #05070d;
  --brand-muted: #6b7280;
  --brand-line: #e5e7eb;
  --brand-paper: #ffffff;
  --brand-wash: #fbfbfa;
  --brand-accent: #39c5bb;
  --radius-lg: 18px;
  --radius-md: 14px;
  --shadow-soft: 0 8px 24px rgba(17, 24, 39, 0.06);
  --shadow-card: 0 1px 0 rgba(17, 24, 39, 0.04);

  --pico-background-color: var(--brand-wash);
  --pico-card-background-color: var(--brand-paper);
  --pico-color: var(--brand-ink);
  --pico-muted-color: var(--brand-muted);
  --pico-muted-border-color: var(--brand-line);
  --pico-primary: var(--brand-accent);
  --pico-primary-hover: #2fb3aa;
  --pico-primary-focus: rgba(57, 197, 187, 0.22);
  --pico-form-element-border-color: var(--brand-line);
  --pico-form-element-background-color: var(--brand-paper);
  --pico-form-element-focus-color: rgba(57, 197, 187, 0.18);
  --pico-border-radius: 14px;
  --pico-font-family: ui-sans-serif, system-ui, -apple-system, "Hiragino Sans", "Yu Gothic", "Noto Sans TC",
    "Noto Sans JP", "PingFang TC", "Microsoft JhengHei", "Segoe UI", Arial, sans-serif;
}

body {
  background:
    radial-gradient(900px 520px at 15% -10%, rgba(57, 197, 187, 0.20), transparent 60%),
    radial-gradient(720px 460px at 95% 0%, rgba(57, 197, 187, 0.14), transparent 55%),
    repeating-linear-gradient(135deg, rgba(11, 15, 25, 0.035) 0 2px, transparent 2px 10px),
    var(--brand-wash);
  color: var(--brand-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main.container {
  max-width: 1040px;
  padding-top: 1rem;
  padding-bottom: 2.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  color: var(--brand-ink);
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 850;
  letter-spacing: .08em;
  font-size: .85rem;
  color: var(--brand-ink-strong);
  border: 1px solid rgba(57, 197, 187, 0.35);
  background:
    radial-gradient(18px 18px at 30% 28%, rgba(255, 255, 255, 0.85), transparent 70%),
    repeating-linear-gradient(90deg, rgba(11, 15, 25, 0.15) 0 2px, transparent 2px 7px),
    linear-gradient(135deg, rgba(57, 197, 187, 0.80), rgba(57, 197, 187, 0.18));
  box-shadow: 0 10px 22px rgba(11, 15, 25, 0.08);
}
.brand-text { display: grid; gap: .05rem; line-height: 1.05; }
.brand-name { font-weight: 800; letter-spacing: .02em; }
.brand-sub { font-size: .8rem; color: var(--brand-muted); letter-spacing: .02em; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: .85rem 1rem;
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-card);
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}
.site-header::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(57, 197, 187, 0.9), transparent);
}

.site-nav ul { gap: .4rem; }
.site-nav a {
  text-decoration: none;
  border-radius: 999px;
  padding: .35rem .7rem;
  border: 1px solid rgba(229, 231, 235, 0.9);
  background: rgba(255, 255, 255, 0.65);
  color: var(--brand-ink);
}
.site-nav a:hover {
  border-color: rgba(57, 197, 187, 0.35);
  background: rgba(57, 197, 187, 0.06);
}
.site-nav a:focus { outline: 2px solid rgba(57, 197, 187, 0.25); outline-offset: 2px; }

.site-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--brand-line);
  color: var(--brand-muted);
  font-size: .95rem;
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; gap: .4rem; }
.footer-links { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.footer-sep { opacity: .6; }
.footer-note { color: var(--brand-muted); }

.section-gap {
  margin-top: 2rem;
}

.hero {
  border: 1px solid rgba(57, 197, 187, 0.22);
  border-radius: var(--radius-lg);
  padding: 1.05rem 1.1rem;
  background:
    radial-gradient(680px 240px at 12% 25%, rgba(57, 197, 187, 0.22), transparent 58%),
    radial-gradient(520px 240px at 92% 15%, rgba(57, 197, 187, 0.14), transparent 56%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.78));
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -30% -40%;
  transform: rotate(-10deg);
  background: repeating-linear-gradient(90deg, rgba(57, 197, 187, 0.10) 0 2px, transparent 2px 18px);
  opacity: .35;
}
.hero > * { position: relative; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.hero-title { margin: 0; }
.hero-desc { margin: .35rem 0 0 0; color: var(--brand-ink); }
.hero-badges { display: flex; gap: .45rem; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border-radius: 999px;
  padding: .25rem .6rem;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid rgba(57, 197, 187, 0.35);
  background: rgba(57, 197, 187, 0.10);
  color: var(--brand-ink-strong);
}
.badge-outline {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(229, 231, 235, 0.95);
  color: var(--brand-ink);
}

h1 {
  letter-spacing: .01em;
  line-height: 1.25;
  color: var(--brand-ink-strong);
}

h2 {
  color: var(--brand-ink-strong);
}

p { line-height: 1.75; color: var(--brand-ink); }

.muted { color: var(--brand-muted); }

.flash {
  padding: .75rem 1rem;
  border-radius: var(--radius-md);
  margin: .75rem 0;
  border: 1px solid var(--brand-line);
  background: var(--brand-paper);
  box-shadow: var(--shadow-card);
}
.flash-success { border-color: rgba(42, 127, 69, 0.35); }
.flash-error { border-color: rgba(180, 35, 24, 0.35); }

.row { display: flex; gap: 1rem; align-items: center; }
.row-between { justify-content: space-between; }
.actions { display: flex; gap: .5rem; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.catalog {
  margin-top: 1rem;
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: var(--brand-paper);
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 1rem;
}
.catalog-title {
  font-size: 1rem;
  margin-bottom: .4rem;
}
.catalog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.catalog-tag {
  display: inline-flex;
  gap: .35rem;
  align-items: center;
  border: 1px solid var(--brand-line);
  color: var(--brand-ink);
  background: #fff;
  border-radius: 999px;
  padding: .25rem .6rem;
  font-size: .85rem;
  text-decoration: none;
}
.catalog-tag span {
  color: var(--brand-muted);
  font-size: .78rem;
}
.catalog-tag.is-active {
  border-color: rgba(57, 197, 187, 0.4);
  background: rgba(57, 197, 187, 0.08);
  color: var(--brand-ink-strong);
}
.catalog-clear { display: flex; justify-content: flex-end; }

.album-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--brand-paper);
  box-shadow: var(--shadow-card);
  transition: transform .18s ease;
  will-change: transform;
}
.album-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  border-color: rgba(57, 197, 187, 0.22);
}
.album-card:focus { outline: 2px solid rgba(57, 197, 187, 0.25); outline-offset: 2px; }

.album-cover {
  width: 100%;
  background: #f4f6f8;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.album-cover img {
  width: 100%;
  height: auto;
  display: block;
}

.album-meta { flex: 1; padding: .85rem 1rem 1rem 1rem; }
.album-title { font-weight: 700; letter-spacing: .01em; }
.album-sub { color: var(--brand-muted); font-size: .9rem; margin-top: .25rem; }
.album-desc {
  color: var(--brand-muted);
  font-size: .95rem;
  margin-top: .35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.admin-list { display: grid; gap: .85rem; margin-top: .5rem; }
.admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  padding: .85rem 1rem;
  background: var(--brand-paper);
  box-shadow: var(--shadow-card);
}
.admin-item-main { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.admin-item-text { min-width: 0; }
.admin-thumb {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  background: #f4f6f8;
  border: 1px solid var(--brand-line);
  flex: 0 0 auto;
}
.admin-title { font-weight: 750; color: var(--brand-ink-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-item-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.tag-list { margin-top: .35rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.tag {
  font-size: .78rem;
  color: var(--brand-muted);
  background: rgba(57, 197, 187, 0.06);
  border: 1px solid rgba(57, 197, 187, 0.15);
  padding: .2rem .5rem;
  border-radius: 999px;
}

.pager {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .85rem 1rem;
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  background: var(--brand-paper);
  box-shadow: var(--shadow-card);
}
.pager-meta { color: var(--brand-muted); font-size: .95rem; }
.pager-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .35rem; }

article {
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  padding: 1rem 1rem;
  background: var(--brand-paper);
  box-shadow: var(--shadow-card);
}

.danger-zone { margin-top: 1.25rem; }
.danger-actions { display: grid; gap: 1rem; }

.h-compact { margin-bottom: .25rem; }
.meta-stack { margin-top: .75rem; display: grid; gap: .75rem; }
.label {
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand-muted);
  margin-bottom: .35rem;
}
.prompt-block .label { color: var(--brand-ink-strong); }
.text-block {
  padding: .85rem 1rem;
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
}
.text-body {
  color: var(--brand-ink);
  line-height: 1.8;
  white-space: pre-wrap;
}
.prompt-block {
  padding: .85rem 1rem;
  border: 1px solid rgba(57, 197, 187, 0.18);
  border-radius: var(--radius-lg);
  background: rgba(57, 197, 187, 0.04);
  box-shadow: var(--shadow-card);
}
.prompt-bottom { margin-top: 1rem; }
.prompt-text {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .95rem;
  line-height: 1.65;
  color: var(--brand-ink-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.edit-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  align-items: start;
}
.edit-preview {
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: var(--brand-paper);
  box-shadow: var(--shadow-card);
}
.preview-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  display: block;
  background: #f4f6f8;
}

.viewer {
  margin-top: 1rem;
  display: grid;
  gap: .75rem;
}
.viewer-frame {
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  background: var(--brand-paper);
  padding: .65rem;
  box-shadow: var(--shadow-card);
  position: relative;
}
.viewer-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  background: #f4f6f8;
}
.viewer-nav {
  display: flex;
  gap: .5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: .35rem;
}

.tap-nav { position: absolute; inset: .65rem; border-radius: var(--radius-md); overflow: hidden; }
.tap-zone { position: absolute; top: 0; bottom: 0; width: 50%; }
.tap-left { left: 0; }
.tap-right { right: 0; }
.tap-zone:focus { outline: none; }
@media (hover: hover) and (pointer: fine) {
  .tap-left:hover { background: linear-gradient(90deg, rgba(57, 197, 187, 0.10), rgba(57, 197, 187, 0)); }
  .tap-right:hover { background: linear-gradient(270deg, rgba(57, 197, 187, 0.10), rgba(57, 197, 187, 0)); }
}

/* Mobile optimizations */
@media (max-width: 640px) {
  main.container { padding-left: .85rem; padding-right: .85rem; padding-top: .75rem; }

  .site-header { padding: .75rem .85rem; margin-bottom: 1rem; }
  .brand-mark { width: 36px; height: 36px; border-radius: 12px; }
  .brand-sub { display: none; }
  .site-nav { width: 100%; }
  .site-nav ul { justify-content: flex-start; flex-wrap: wrap; }

  .row { flex-direction: column; align-items: stretch; }
  .actions { width: 100%; }
  .actions > * { width: 100%; }

  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
  .album-meta { padding: .75rem .85rem .9rem .85rem; }

  .admin-item { flex-direction: column; align-items: stretch; gap: .85rem; }
  .admin-item-actions { justify-content: stretch; }
  .admin-item-actions > * { flex: 1 1 auto; }

  .edit-grid { grid-template-columns: 1fr; }

  .viewer-frame { padding: .45rem; border-radius: 16px; }
  .tap-nav { inset: .45rem; }
  .text-block, .prompt-block { padding: .75rem .85rem; border-radius: 16px; }

  .viewer-nav {
    position: sticky;
    bottom: .5rem;
    z-index: 5;
    padding: .5rem;
    border-radius: 16px;
    border: 1px solid rgba(229, 231, 235, 0.9);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
  }
  .viewer-nav a[role="button"], .viewer-nav button {
    flex: 1 1 0;
    min-width: 0;
  }
}
