@font-face {
  font-family: "Pretendard";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/resources/fonts/pretendard/Pretendard-Regular.subset.woff2") format("woff2");
}
@font-face {
  font-family: "Pretendard";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/resources/fonts/pretendard/Pretendard-Medium.subset.woff2") format("woff2");
}
@font-face {
  font-family: "Pretendard";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/resources/fonts/pretendard/Pretendard-SemiBold.subset.woff2") format("woff2");
}
@font-face {
  font-family: "Pretendard";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/resources/fonts/pretendard/Pretendard-Bold.subset.woff2") format("woff2");
}

:root {
  --bg: #101011;
  --bg-elevated: #141416;
  --bg-subtle: #1c1c20;
  --fg: #f3f1ea;
  --fg-muted: #9a9588;
  --fg-subtle: #6e6a60;
  --gold: #ffd010;
  --gold-bright: #ffe14a;
  --gold-dim: color-mix(in oklab, var(--gold) 22%, transparent);
  --border: color-mix(in oklab, var(--fg) 12%, transparent);
  --border-strong: color-mix(in oklab, var(--fg) 22%, transparent);
  --danger: #b4544a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --font-display: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --font-body: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --text-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.82rem + 0.25vw, 0.9375rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  --text-2xl: clamp(2rem, 1.35rem + 2vw, 3rem);
  --text-3xl: clamp(2.4rem, 1.6rem + 3vw, 4rem);

  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --tracking-display: -0.03em;
  --tracking-wide: 0.14em;

  --motion-micro: 80ms;
  --motion-quick: 150ms;
  --motion-fast: 250ms;
  --motion-slow: 400ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-scale-modal: 0.96;
  --motion-scale-menu: 0.97;

  --dock-size: 52px;
  --chrome: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  /* compatibility aliases for existing tool CSS */
  --bs-primary: var(--gold);
  --bs-dark: var(--bg);
  --bs-body-bg: var(--bg);
  --bs-gray-200: #e8e4d8;
  --bs-gray-700: #3a3a40;
  --bs-gray-800: var(--bg-subtle);
  --bs-gray-900: var(--bg-elevated);
  --bs-red: var(--danger);
  --highlightColor: var(--gold-bright);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
button, [role="button"] { cursor: pointer; font-family: inherit; }
button:disabled, [role="button"][aria-disabled="true"] { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font-family: inherit; }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  text-wrap: balance;
  letter-spacing: var(--tracking-display);
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ——— chrome ——— */
.corner {
  position: fixed;
  z-index: 40;
  width: var(--dock-size);
  height: var(--dock-size);
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg-elevated) 88%, transparent);
  color: var(--fg);
  border-radius: var(--radius-pill);
  padding: 0;
  backdrop-filter: blur(10px);
  transition: background var(--motion-quick) var(--ease-out),
              border-color var(--motion-quick) var(--ease-out),
              transform var(--motion-quick) var(--ease-out),
              color var(--motion-quick) var(--ease-out);
}
.corner:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.corner:active { transform: scale(0.96); }
.corner svg { width: 22px; height: 22px; }
.corner.tl { top: calc(var(--space-4) + var(--safe-t)); left: calc(var(--space-4) + var(--safe-l)); }
.corner.tr { top: calc(var(--space-4) + var(--safe-t)); right: calc(var(--space-4) + var(--safe-r)); }
.corner .lang-code {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* ——— menu sheet ——— */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: color-mix(in oklab, #000 55%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-fast) var(--ease-out);
}
.overlay.is-open { opacity: 1; pointer-events: auto; }

.menu-panel {
  position: absolute;
  top: calc(var(--space-4) + var(--safe-t) + var(--dock-size) + var(--space-3));
  left: calc(var(--space-4) + var(--safe-l));
  min-width: 220px;
  padding: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-md) + var(--space-3));
  transform: scale(var(--motion-scale-menu)) translateY(-6px);
  transform-origin: top left;
  opacity: 0;
  transition: transform var(--motion-fast) var(--ease-out),
              opacity var(--motion-fast) var(--ease-out);
}
.overlay.is-open .menu-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.menu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.menu-list a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--fg);
  font-weight: 500;
  min-height: 44px;
  transition: background var(--motion-quick) var(--ease-out), color var(--motion-quick) var(--ease-out);
}
.menu-list a:hover,
.menu-list a.is-active {
  background: var(--gold-dim);
  color: var(--gold-bright);
}
.menu-list a svg { width: 18px; height: 18px; flex-shrink: 0; }

.lang-panel {
  position: absolute;
  top: calc(var(--space-4) + var(--safe-t) + var(--dock-size) + var(--space-3));
  right: calc(var(--space-4) + var(--safe-r));
  min-width: 176px;
  padding: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-md) + var(--space-2));
  transform: scale(var(--motion-scale-menu)) translateY(-6px);
  transform-origin: top right;
  opacity: 0;
  transition: transform var(--motion-fast) var(--ease-out),
              opacity var(--motion-fast) var(--ease-out);
}
.overlay.is-open .lang-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.lang-option {
  display: grid;
  grid-template-columns: 22px auto 1fr;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--fg);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  min-height: 44px;
  text-align: left;
}
.lang-option:hover { background: var(--bg-subtle); }
.lang-option.is-active { color: var(--gold); }
.lang-option .lang-flag {
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 2px;
}
.lang-option .lang-code {
  font-weight: 700;
  letter-spacing: 0.06em;
  min-width: 1.75em;
}
.lang-option .lang-name { justify-self: start; }
.corner .lang-flag {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ——— home calling card ——— */
.stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(var(--chrome) + var(--space-4)) var(--space-5);
}

.calling-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-4);
  max-width: 36rem;
  width: 100%;
}

.portrait {
  position: relative;
  width: min(42vw, 220px);
  height: min(42vw, 220px);
  min-width: 148px;
  min-height: 148px;
  border-radius: 50%;
  padding: 6px;
  border: 1px solid color-mix(in oklab, var(--gold) 55%, transparent);
  box-shadow: 0 0 0 8px color-mix(in oklab, var(--gold) 8%, transparent);
  background: var(--bg-elevated);
  overflow: hidden;
}
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  position: relative;
  z-index: 0;
}
.portrait-caption {
  position: absolute;
  inset: 6px;
  z-index: 2;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 1.1rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.02em;
  word-break: keep-all;
  white-space: pre-line;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  opacity: 0;
  pointer-events: none;
  user-select: none;
  transition: opacity var(--motion-fast) var(--ease-out);
}
.portrait:hover .portrait-caption,
.portrait:focus-within .portrait-caption,
.portrait:active .portrait-caption {
  opacity: 1;
}

.identity {
  display: grid;
  gap: var(--space-2);
  justify-items: center;
}
.identity h1 {
  font-size: var(--text-3xl);
  color: var(--gold);
  font-weight: 600;
}
.identity .meta {
  color: var(--fg-muted);
  font-size: var(--text-lg);
  letter-spacing: 0.04em;
  font-weight: 500;
}

.mail-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  padding: 10px 14px;
  min-height: 44px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  transition: color var(--motion-quick) var(--ease-out),
              border-color var(--motion-quick) var(--ease-out);
}
.mail-link:hover { color: var(--gold); border-color: var(--border); }
.mail-link svg { width: 16px; height: 16px; }

.social {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.social a {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  transition: color var(--motion-quick) var(--ease-out),
              border-color var(--motion-quick) var(--ease-out),
              transform var(--motion-quick) var(--ease-out);
}
.social a:hover { color: var(--gold); border-color: var(--gold); }
.social a:active { transform: scale(0.96); }
.social svg { width: 20px; height: 20px; }

/* ——— dock ——— */
.dock {
  position: fixed;
  z-index: 30;
  display: flex;
  gap: var(--space-1);
  padding: 8px;
  background: color-mix(in oklab, var(--bg-elevated) 92%, transparent);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  left: calc(var(--space-4) + var(--safe-l));
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  border-radius: calc(var(--radius-pill) + 4px);
}
.dock-btn {
  width: var(--dock-size);
  height: var(--dock-size);
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  border-radius: var(--radius-pill);
  padding: 0;
  transition: color var(--motion-quick) var(--ease-out),
              background var(--motion-quick) var(--ease-out);
}
.dock-btn svg { width: 22px; height: 22px; }
.dock-btn:hover,
.dock-btn.is-active {
  color: var(--gold);
  background: var(--gold-dim);
}

@media (orientation: portrait), (max-width: 768px) {
  .dock {
    left: 50%;
    top: auto;
    bottom: calc(12px + var(--safe-b));
    transform: translateX(-50%);
    flex-direction: row;
  }
  .stage { padding-bottom: calc(96px + var(--safe-b)); }
  .portrait {
    width: min(56vw, 200px);
    height: min(56vw, 200px);
  }
}

@media (orientation: portrait) {
  .mail-link [data-i18n="contact"] { display: none; }
}

/* ——— modal ——— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  padding-top: calc(var(--space-5) + var(--safe-t));
  padding-bottom: calc(var(--space-5) + var(--safe-b));
}
.modal[hidden] { display: none !important; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in oklab, #000 62%, transparent);
}
.modal-sheet {
  position: relative;
  width: min(920px, 100%);
  max-height: min(86dvh, 860px);
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: scale(var(--motion-scale-modal));
  animation: modal-in var(--motion-fast) var(--ease-out) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(var(--motion-scale-modal)); }
  to { opacity: 1; transform: scale(1); }
}
.modal-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}
.modal-head h2 {
  flex: 1;
  font-size: var(--text-lg);
  font-family: var(--font-body);
  letter-spacing: 0;
  font-weight: 600;
}
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: var(--radius-pill);
  padding: 0;
  flex-shrink: 0;
  transition: color var(--motion-quick) var(--ease-out),
              border-color var(--motion-quick) var(--ease-out);
}
.icon-btn:hover { color: var(--gold); border-color: var(--gold); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn[hidden] { display: none !important; }
.modal-body {
  padding: var(--space-5);
  overflow: auto;
  flex: 1;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: var(--space-4);
}
.badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: var(--radius-lg);
  min-height: 44px;
  text-align: center;
  transition: border-color var(--motion-quick) var(--ease-out),
              transform var(--motion-quick) var(--ease-out);
}
.badge:hover { border-color: var(--gold); transform: translateY(-2px); }
.badge img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}
.badge span {
  font-size: var(--text-xs);
  color: var(--fg-muted);
  line-height: var(--leading-snug);
}

.detail {
  display: grid;
  gap: var(--space-4);
  justify-items: center;
}
.detail-logo {
  width: min(160px, 40vw);
  height: auto;
  object-fit: contain;
}
.detail-proof {
  width: min(420px, 100%);
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.kv {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(7rem, 32%) 1fr;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.kv:last-child { border-bottom: 0; }
.kv .k {
  color: var(--fg-subtle);
  font-size: var(--text-sm);
  font-weight: 500;
}
.kv .v {
  color: var(--fg);
  font-size: var(--text-sm);
  background: var(--bg-subtle);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  min-width: 0;
  word-break: break-word;
}
.kv .v a { color: var(--gold); }
.kv .v ul { margin: 0; padding-left: 1.1rem; }

.loading {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: var(--fg-muted);
  gap: var(--space-3);
}
.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ——— inner pages ——— */
.page {
  min-height: 100dvh;
  padding: calc(var(--chrome) + var(--space-4)) var(--space-5) var(--space-7);
  max-width: 1080px;
  margin: 0 auto;
}
.page-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.page-head h1 {
  font-size: var(--text-2xl);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2em 0;
  min-width: 0;
  word-break: keep-all;
}
.page-head .crumb {
  color: inherit;
}
.page-head.is-reading .crumb,
body.is-reading .page-head .crumb {
  color: var(--gold);
  cursor: pointer;
}
.page-head.is-reading .crumb:hover,
body.is-reading .page-head .crumb:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.page-head .crumb-sep {
  color: var(--fg-subtle);
  font-weight: 400;
  margin: 0 0.15em;
}
.page-head .crumb-leaf {
  color: var(--fg);
  font-weight: 600;
  min-width: 0;
}

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  align-items: center;
}
.search-bar select,
.search-bar input {
  height: 44px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font: inherit;
  min-width: 0;
}
.search-bar input { flex: 1; min-width: 12rem; }
.search-bar select { max-width: 11rem; }
.search-bar button {
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--bg);
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  padding: 12px 16px;
  min-height: 44px;
  font: inherit;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab[aria-selected="true"] {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}
.item-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 44px;
  align-items: start;
  transition: border-color var(--motion-quick) var(--ease-out);
}
.item-card:hover { border-color: color-mix(in oklab, var(--gold) 50%, var(--border)); }
.item-card.is-playing {
  border-color: var(--gold);
}
.item-card img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}
.item-card h3 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  letter-spacing: 0;
  margin-bottom: 4px;
}
.item-card p {
  margin: 0 0 var(--space-3);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  text-wrap: pretty;
}
.actions, .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.actions { margin-bottom: var(--space-3); }
.chip, .tag {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font-size: var(--text-xs);
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  min-height: 32px;
}
.tag { cursor: pointer; }
.tag:hover { color: var(--gold); border-color: var(--gold); }
.chip.primary, a.chip.primary {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
  font-weight: 600;
}

.cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-5);
}
.cover {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-align: center;
  cursor: pointer;
}
.cover img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.cover h3 {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  letter-spacing: 0;
}
.cover .sub { color: var(--fg-subtle); font-size: var(--text-xs); }

.reader { display: grid; gap: var(--space-4); }
.reader[hidden], .covers[hidden] { display: none !important; }
.reader-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: center;
}
.reader-nav input, .reader-nav select {
  height: 44px;
  background: var(--bg-elevated);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font: inherit;
}
.reader-nav input[type="number"] {
  width: 4.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.page-frame {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: var(--space-2);
  align-items: center;
  padding: 0.5rem 1.5rem;
  max-width: 100%;
  min-width: 0;
}
.page-frame img {
  max-width: 100%;
  max-height: 80dvh;
  height: auto;
  width: auto;
  object-fit: contain;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-sm);
}
.page-mover {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg);
  flex-shrink: 0;
}
.page-mover[aria-disabled="true"] { opacity: 0.35; }
.reader-title {
  text-align: center;
  display: grid;
  gap: 4px;
}
.reader-title time { color: var(--fg-subtle); font-size: var(--text-sm); }
.portrait-only { display: none !important; }

@media (orientation: portrait) {
  body[data-page="cartoon"] .page {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
    overflow-x: hidden;
  }
  body.is-reading[data-page="cartoon"] .page {
    padding-bottom: calc(88px + var(--safe-b));
  }
  body.is-reading[data-page="cartoon"] .page-head {
    margin-bottom: var(--space-3);
  }
  body.is-reading .reader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    width: 100%;
  }
  body.is-reading .reader-title {
    order: 0;
    width: 100%;
  }
  body.is-reading .reader-title h2 {
    font-size: var(--text-lg);
  }
  body.is-reading .page-frame {
    order: 1;
    grid-template-columns: minmax(0, 1fr);
    padding: 0.5rem 0.25rem;
    width: 100%;
  }
  body.is-reading .page-frame img {
    max-height: calc(100dvh - var(--chrome) - 11rem);
    width: auto;
    max-width: 100%;
  }
  body.is-reading .reader-nav {
    order: 2;
    position: fixed;
    left: 50%;
    bottom: calc(12px + var(--safe-b));
    transform: translateX(-50%);
    z-index: 25;
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 8px 10px;
    background: color-mix(in oklab, var(--bg-elevated) 92%, transparent);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius-pill) + 4px);
    backdrop-filter: blur(12px);
    flex-wrap: nowrap;
  }
  .landscape-only { display: none !important; }
  .portrait-only { display: grid !important; }
}

.player {
  position: sticky;
  bottom: calc(12px + var(--safe-b));
  margin-top: var(--space-6);
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  z-index: 10;
}
.player img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}
.player-meta { min-width: 0; }
.player-meta strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  margin: 8px 0 4px;
  cursor: pointer;
  position: relative;
}
.timeline .bar {
  height: 100%;
  width: 0;
  background: var(--gold);
  border-radius: inherit;
}
.times {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  color: var(--fg-subtle);
  font-size: var(--text-xs);
}
.player-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.tool-wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: calc(var(--chrome) + var(--space-4)) var(--space-5) var(--space-7);
}
#container {
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
}
#container #title {
  font-family: var(--font-display);
  text-align: center;
  padding: 0 0 var(--space-5);
  font-size: var(--text-2xl);
}
#fileAttachmentSection {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
}
#dropZone {
  border: 1px dashed color-mix(in oklab, var(--gold) 55%, var(--border));
  color: var(--fg-muted);
  border-radius: var(--radius-md);
}
#dropZone.hover { background: var(--bg-subtle); }
.radio-button.selected { background: var(--gold); color: var(--bg); }
.radio-button:not(.selected) { background: var(--bg-subtle); color: var(--fg-muted); }
table, th, td { border-color: var(--border) !important; color: var(--fg); }
th { background: var(--bg-subtle) !important; }
td { background: transparent !important; }
#clearHistoryButton { background: var(--danger); color: #fff; }
#downloadAllButton, #downloadAllButton2, .downloadAllButton, #exportPdf, #exportPng {
  background: var(--gold);
  color: var(--bg);
}

.toast-container {
  position: fixed;
  right: var(--space-4);
  bottom: calc(var(--space-4) + var(--safe-b));
  z-index: 80;
  display: grid;
  gap: var(--space-2);
  max-width: min(22rem, calc(100vw - 2rem));
}
.toast {
  background: var(--bg-elevated);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: var(--text-sm);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.toast.show { opacity: 1; }
.toast.fade-out { opacity: 0; transition: opacity 0.6s var(--ease-out); }

.empty {
  color: var(--fg-subtle);
  text-align: center;
  padding: var(--space-7);
}

/* ——— service tools ——— */
.tool {
  display: grid;
  gap: var(--space-4);
}
.dropzone {
  display: flex;
  min-height: 9rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  border: 1px dashed color-mix(in oklab, var(--gold) 55%, var(--border));
  padding: var(--space-5);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--fg-muted);
  background: var(--bg-elevated);
  position: relative;
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.dropzone.is-over,
.dropzone.hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--bg-subtle);
}
.tool-panel {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.field {
  display: grid;
  gap: var(--space-2);
}
.field-label {
  color: var(--fg-subtle);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.seg button,
.chip-opt {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font: inherit;
  font-size: var(--text-sm);
  padding: 8px 12px;
  min-height: 44px;
  border-radius: var(--radius-sm);
}
.seg button.is-on,
.chip-opt.is-on {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
  font-weight: 600;
}
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}
.field-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  min-height: 44px;
}
.field-row input[type="number"],
.field-row input[type="text"],
.field-row select {
  height: 44px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font: inherit;
  min-width: 0;
}
.field-row input[type="number"] { width: 6.5rem; }
.field-row select { min-width: 12rem; flex: 1; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  cursor: pointer;
}
.toggle input { width: 18px; height: 18px; accent-color: var(--gold); }
.tool-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.btn {
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn.primary {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
  font-weight: 600;
}
.btn.primary:hover { color: var(--bg); }
.btn.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn:disabled { opacity: 0.4; }
.note {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--fg-muted);
}
.result-list {
  display: grid;
  gap: var(--space-3);
}
.result-card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 0;
}
.result-card img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}
.result-card .meta { min-width: 0; }
.result-card .meta strong {
  display: block;
  font-size: var(--text-sm);
  word-break: break-all;
}
.result-card .meta span {
  color: var(--fg-subtle);
  font-size: var(--text-xs);
}
.hash-card {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 0;
}
.hash-card h3 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  letter-spacing: 0;
  word-break: break-all;
}
.hash-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  gap: var(--space-2);
  align-items: start;
  font-size: var(--text-xs);
}
.hash-row .k { color: var(--fg-subtle); font-weight: 600; padding-top: 4px; }
.hash-row code {
  font-family: var(--font-mono);
  word-break: break-all;
  background: var(--bg-subtle);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: block;
}
.pdf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}
.pdf-card {
  position: relative;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: grab;
}
.pdf-card.dragging { opacity: 0.5; }
.pdf-card canvas,
.pdf-card img {
  width: 100%;
  height: auto;
  background: #fff;
  display: block;
}
.pdf-card .pdf-cap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  font-size: var(--text-xs);
  color: var(--fg-muted);
}
.pdf-card .pdf-del {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  border-radius: var(--radius-sm);
}
.pdf-card .pdf-del:hover { color: var(--danger); }
.exif-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 0;
}
.exif-card img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}
.exif-groups { display: grid; gap: var(--space-2); min-width: 0; }
.exif-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.exif-group summary {
  cursor: pointer;
  padding: 10px 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: var(--text-sm);
  list-style: none;
}
.exif-group summary::-webkit-details-marker { display: none; }
.exif-group .kv { padding-left: 12px; padding-right: 12px; }

@media (max-width: 640px) {
  .result-card {
    grid-template-columns: 56px 1fr;
  }
  .result-card .dl {
    grid-column: 1 / -1;
    width: 100%;
  }
  .result-card .dl .btn { width: 100%; }
  .hash-row { grid-template-columns: 1fr auto; }
  .hash-row .k { grid-column: 1 / -1; }
  .exif-card { grid-template-columns: 1fr; }
  .exif-card img { width: 100%; height: 180px; }
  .tool-wrap, .page {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
  .field-row select { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
