/* Archive presentation layer. Game artwork stays in its original palette. */
:root, html[data-theme="dark"] {
  color-scheme: dark;
  --archive-bg: #10141e;
  --archive-surface: #1a2030;
  --archive-surface-raised: #252e42;
  --archive-text: #f3ebd9;
  --archive-muted: #b0b7c8;
  --archive-border: #3b455a;
  --archive-accent: #dfc080;
  --archive-on-accent: #1c2331;
  --archive-navy: #c6d4ff;
  --archive-shadow: 0 10px 30px #060a1329;
  --archive-focus: #edcb87;
}
html[data-theme="chocotto"] {
  color-scheme: light;
  --archive-bg: #ffebc8;
  --archive-surface: #fff8eb;
  --archive-surface-raised: #f8e5c8;
  --archive-text: #292b41;
  --archive-muted: #6e6267;
  --archive-border: #cdb99f;
  --archive-accent: #243c87;
  --archive-on-accent: #fffaf0;
  --archive-navy: #202b60;
  --archive-shadow: 0 10px 30px #4a33120a;
  --archive-focus: #1c388c;
}
html[data-theme] {
  --bg-dark: var(--archive-bg);
  --bg-main: var(--archive-bg);
  --bg-container: var(--archive-surface);
  --bg-card: var(--archive-surface);
  --bg-panel: var(--archive-surface);
  --bg-panel-sub: var(--archive-surface-raised);
  --panel-bg: var(--archive-surface);
  --card-bg: var(--archive-surface);
  --panel-border: var(--archive-border);
  --border-panel: var(--archive-border);
  --border-light: var(--archive-border);
  --choco-border: var(--archive-border);
  --choco-border-light: var(--archive-border);
  --choco-brown-main: var(--archive-text);
  --choco-brown: var(--archive-text);
  --choco-brown-deep: var(--archive-text);
  --choco-brown-mid: var(--archive-muted);
  --choco-orange: var(--archive-accent);
  --choco-orange-hover: var(--archive-accent);
  --accent-gold: var(--archive-accent);
  --gold-primary: var(--archive-accent);
  --text-main: var(--archive-text);
  --text-heading: var(--archive-text);
  --text-sub: var(--archive-muted);
  --text-secondary: var(--archive-muted);
  --text-muted: var(--archive-muted);
  --text-dim: var(--archive-muted);
  --header-bg: var(--archive-surface);
  --font-primary: 'M PLUS Rounded 1c', Meiryo, sans-serif;
  background: var(--archive-bg);
}
.archive-public-notice {
  margin-block: 12px 20px;
  padding: 10px 14px;
  border: 1px solid var(--archive-border);
  border-radius: 10px;
  background: var(--archive-surface);
  color: var(--archive-text);
  font-size: .875rem;
  line-height: 1.5;
}
.archive-public-notice p { margin: 0; }
.archive-public-notice p + p { margin-top: 4px; }
html[data-theme] body {
  background: var(--archive-bg) !important;
  background-image: none !important;
  color: var(--archive-text) !important;
}
html[data-theme] :focus-visible { outline: 2px solid var(--archive-focus); outline-offset: 4px; }
html[data-theme] .ambient-glow, html[data-theme] .ambient-glow-bottom { display: none; }
html[data-theme] .site-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px 16px;
  width: 100%;
  margin: 0 0 28px;
  padding: 21px 24px 0;
  border: 1px solid var(--archive-border);
  border-radius: 12px;
  color: var(--archive-text);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow);
  position: relative;
  z-index: 30;
}
html[data-theme] .site-nav .nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  width: fit-content;
  font-size: 19px;
  line-height: 1.35;
  color: var(--archive-text);
  font-weight: 800;
  letter-spacing: .03em;
  text-decoration: none;
}
.archive-brand-mark { width: 36px; height: 40px; color: var(--archive-accent); flex: 0 0 auto; }
.archive-brand-copy { display: grid; gap: 3px; }
.archive-brand-copy small { font: 600 10px/1.4 'Josefin Sans', sans-serif; letter-spacing: .28em; color: var(--archive-muted); }
.archive-theme-switch { display: inline-flex; align-items: center; padding: 3px; border: 1px solid var(--archive-border); border-radius: 24px; gap: 2px; }
.archive-theme-switch button { border: 0; border-radius: 20px; padding: 7px 15px; background: transparent; color: var(--archive-muted); font: 700 12px/1.4 var(--font-primary); cursor: pointer; min-height: 32px; }
.archive-theme-switch button[aria-pressed="true"] { background: var(--archive-accent); color: var(--archive-on-accent); }
.archive-theme-switch button:hover { color: var(--archive-text); }
.archive-theme-switch button[aria-pressed="true"]:hover { color: var(--archive-on-accent); }
html[data-theme] .site-nav .nav-links { grid-column: 1 / -1; display: flex; flex-wrap: nowrap; align-items: stretch; justify-content: space-between; gap: 8px; padding: 0; border-top: 1px solid var(--archive-border); width: 100%; overflow-x: auto; margin: 0; scrollbar-width: thin; }
html[data-theme] .site-nav .nav-links a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: 1 0 auto; padding: 13px 12px 12px; border: 0 !important; border-bottom: 3px solid transparent !important; border-radius: 0; color: var(--archive-muted) !important; background: transparent !important; box-shadow: none; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
html[data-theme] .site-nav .nav-links a.active { color: var(--archive-accent) !important; border-bottom-color: var(--archive-accent) !important; background: transparent !important; box-shadow: none; }
html[data-theme] .site-nav .nav-links a:hover { color: var(--archive-text) !important; background: color-mix(in srgb, var(--archive-text) 5%, transparent) !important; }
.archive-nav-icon { width: 19px; height: 19px; flex: 0 0 auto; }
.archive-skip { position: fixed; left: 16px; top: -80px; z-index: 10000; background: var(--archive-accent); color: var(--archive-on-accent); padding: 10px 18px; border-radius: 6px; }
.archive-skip:focus { top: 12px; }
.archive-skip:not(:focus) { clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.archive-folder-path, .archive-remembered-folder {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  grid-column: 1 / -1;
  margin-bottom: 10px;
}
.archive-remembered-folder[hidden] { display: none; }
.archive-folder-path code { overflow-wrap: anywhere; user-select: text; color: var(--archive-text); }
.archive-folder-path button, .archive-remembered-folder button {
  padding: 4px 8px;
  border: 1px solid var(--archive-border);
  border-radius: 6px;
  background: var(--archive-surface-raised);
  color: var(--archive-text);
  font: inherit;
  font-size: .84rem;
  cursor: pointer;
}
.archive-remembered-folder [data-folder-choose] {
  border-color: var(--archive-accent);
  background: var(--archive-accent);
  color: var(--archive-on-accent);
  font-weight: 700;
}
.archive-remembered-folder button:disabled { opacity: .55; cursor: default; }
:is(.archive-folder-path, .archive-remembered-folder) [role="status"]:not(:empty) {
  flex-basis: 100%;
  color: var(--archive-muted);
  font-size: .84rem;
}
.game-element { display: inline-flex !important; align-items: center; justify-content: center; gap: 5px; vertical-align: middle; color: var(--archive-text) !important; background: var(--archive-surface-raised) !important; border: 1px solid var(--archive-border) !important; border-radius: 5px; padding: 2px 7px; min-height: 25px; line-height: 1.4; font-size: 12px; font-weight: 700; }
.game-element__icon { display: inline-block; width: 20px; height: 20px; object-fit: contain; image-rendering: pixelated; flex: 0 0 auto; }
.archive-pixel { image-rendering: pixelated; object-fit: contain; }
@media (max-width: 650px) {
  html[data-theme] .site-nav { gap: 16px 10px; padding: 16px 14px 0; margin-bottom: 22px; }
  html[data-theme] .site-nav .nav-brand { font-size: 15px; gap: 8px; }
  .archive-brand-mark { width: 28px; height: 34px; }
  .archive-brand-copy small { font-size: 9px; letter-spacing: .2em; }
  .archive-theme-switch button { font-size: 11px; padding: 7px 9px; }
  html[data-theme] .site-nav .nav-links { justify-content: flex-start; gap: 5px; }
  html[data-theme] .site-nav .nav-links a { padding: 11px 9px; font-size: 12px; }
}
@media (max-width: 390px) {
  html[data-theme] .site-nav { grid-template-columns: 1fr; }
  .archive-theme-switch { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
