﻿:root {
  color-scheme: light;
  --page: #f6f8fb;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-soft: rgba(255, 255, 255, 0.72);
  --surface-muted: rgba(245, 248, 252, 0.9);
  --text: #1d2733;
  --muted: #687586;
  --line: rgba(31, 41, 55, 0.12);
  --accent: #3a8f7b;
  --accent-soft: #e5f4f0;
  --accent-strong: #206f5f;
  --sky: #4b8fd8;
  --amber: #d89b2b;
  --rose: #d96374;
  --shadow: 0 18px 48px rgba(29, 39, 51, 0.13);
  --shadow-soft: 0 10px 28px rgba(29, 39, 51, 0.08);
  --radius: 8px;
  --blur: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

body.dark {
  color-scheme: dark;
  --page: #111827;
  --surface: rgba(21, 28, 38, 0.9);
  --surface-soft: rgba(21, 28, 38, 0.74);
  --surface-muted: rgba(31, 41, 55, 0.78);
  --text: #f4f7fb;
  --muted: #a9b4c2;
  --line: rgba(255, 255, 255, 0.14);
  --accent: #69b7a4;
  --accent-soft: rgba(105, 183, 164, 0.16);
  --accent-strong: #a8eadc;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.24);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select {
  font: inherit;
}

button,
select,
input {
  accent-color: var(--accent);
}

.wallpaper-stage {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: var(--page);
}

.wallpaper-video,
.wallpaper-vignette {
  position: absolute;
  inset: 0;
}

.wallpaper-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  filter: none;
  transition: opacity 220ms ease, filter 220ms ease;
}

body.dark .wallpaper-video {
  opacity: 1;
  filter: none;
}

.wallpaper-vignette {
  display: none;
}

body.dark .wallpaper-vignette {
  display: none;
}

.app-shell,
body.sidebar-collapsed .app-shell {
  display: block;
  min-height: 100vh;
}

.glass-panel,
.sidebar,
.controls-dock .topbar-actions,
.restore-button,
.sidebar-restore-button {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur)) saturate(1.1);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.1);
}

.sidebar,
body.sidebar-collapsed .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 272px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  border-width: 0 1px 0 0;
  transform: translateX(0);
  transition: transform 180ms ease;
}

body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.sidebar-head,
.brand,
.topbar,
.topbar-actions,
.wallpaper-picker,
.component-toggle,
.profile-body,
.section-heading,
.with-control,
.game-meta {
  display: flex;
  align-items: center;
}

.sidebar-head,
.section-heading,
.game-meta {
  justify-content: space-between;
}

.brand {
  min-width: 0;
  gap: 12px;
}

.brand-mark,
.avatar,
.tool-symbol {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
}

.brand-mark {
  width: 42px;
  height: 42px;
}

.brand strong,
.brand small {
  display: block;
  white-space: nowrap;
}

.brand strong {
  font-size: 0.98rem;
}

.brand small,
.eyebrow,
.panel-label,
.profile-facts dt,
.tool-item span,
.game-meta,
.wallpaper-picker span,
.component-toggle span {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--accent-strong);
  border-color: rgba(58, 143, 123, 0.22);
  background: var(--accent-soft);
}

.nav-icon {
  width: 22px;
  flex: 0 0 22px;
  text-align: center;
}

.sidebar-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.sidebar-panel p {
  margin: 0;
  line-height: 1.65;
}

.panel-label,
.eyebrow {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-label {
  margin-bottom: 6px !important;
}

.collapse-button,
.sidebar-restore-button,
.menu-button,
.icon-button,
.segmented-control button,
.wallpaper-picker select,
.restore-button,
.component-toggle {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-muted);
  cursor: pointer;
}

.collapse-button,
.sidebar-restore-button,
.menu-button,
.icon-button {
  display: grid;
  place-items: center;
}

.collapse-button {
  width: 34px;
  height: 34px;
}

.sidebar-restore-button {
  position: fixed;
  top: 70px;
  left: 0;
  z-index: 35;
  display: none;
  width: 34px;
  height: 42px;
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

body.sidebar-collapsed .sidebar-restore-button {
  display: grid;
}

body.sidebar-collapsed .collapse-button {
  display: none;
}

.dashboard {
  min-width: 0;
  padding: 24px 28px 36px 300px;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 10;
  justify-content: flex-end;
  gap: 14px;
  margin-bottom: 16px;
  pointer-events: none;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.controls-dock .menu-button,
.controls-dock .topbar-actions {
  pointer-events: auto;
}

.controls-dock .topbar-actions {
  padding: 10px;
  border-radius: var(--radius);
}

.menu-button,
.icon-button {
  width: 40px;
  height: 40px;
}

.menu-button {
  display: none;
}

.wallpaper-picker,
.component-toggle {
  gap: 8px;
}

.wallpaper-picker select {
  max-width: 172px;
  min-height: 40px;
  padding: 0 32px 0 11px;
  outline: none;
}

.wallpaper-picker option {
  color: #1d2733;
}

.component-toggle {
  min-height: 40px;
  padding: 0 11px;
}

.component-toggle input {
  width: 16px;
  height: 16px;
}

.wallpaper-showcase {
  min-height: clamp(320px, 42vh, 430px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.dark .wallpaper-showcase {
  background: transparent;
}

.grid-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  margin-top: 14px;
}

.section-card {
  min-width: 0;
  padding: 20px;
  border-radius: var(--radius);
}

.games-card {
  grid-column: 1 / -1;
}

.section-heading {
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2,
.profile-body h3,
.game-item h3,
.tool-item strong {
  margin: 0;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
}

.section-heading h2 {
  font-size: 1.2rem;
}

.profile-body {
  gap: 16px;
  align-items: flex-start;
}

.avatar {
  width: 66px;
  height: 66px;
  font-size: 1.75rem;
}

.profile-body p,
.tool-item p,
.game-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.profile-body p {
  margin-top: 8px;
}

.profile-facts {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.profile-facts div,
.tool-item,
.game-item,
.segmented-control {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.profile-facts div {
  padding: 12px;
}

.profile-facts dt,
.profile-facts dd {
  margin: 0;
}

.profile-facts dd {
  margin-top: 4px;
  font-weight: 700;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tool-item {
  display: grid;
  gap: 10px;
  min-height: 136px;
  padding: 16px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.tool-item:hover,
.game-item:hover {
  transform: translateY(-2px);
  border-color: rgba(58, 143, 123, 0.28);
  box-shadow: var(--shadow-soft);
}

.tool-symbol {
  width: 38px;
  height: 38px;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
}

.segmented-control button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.segmented-control button.active {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.game-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.game-item {
  display: grid;
  gap: 10px;
  min-height: 178px;
  padding: 16px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.game-cover {
  height: 70px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--game-color) 78%, white), rgba(255, 255, 255, 0.42)),
    var(--game-color);
}

.game-meta {
  gap: 10px;
  margin-top: auto;
}

.game-meta strong {
  color: var(--accent-strong);
}

.restore-button {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: none;
  min-height: 40px;
  padding: 0 16px;
}

body.wallpaper-only .app-shell {
  display: none;
}

body.wallpaper-only .restore-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition:
    opacity 520ms ease,
    transform 560ms ease;
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

[data-reveal="sidebar"] {
  transform: translate3d(-20px, 0, 0);
}

[data-reveal="dock"] {
  transform: translate3d(0, -12px, 0);
  --reveal-delay: 100ms;
}

[data-reveal="field"] {
  transform: translate3d(0, 24px, 0);
  --reveal-delay: 180ms;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}

@media (max-width: 1180px) {
  .game-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .sidebar,
  body.sidebar-collapsed .sidebar {
    width: min(320px, 86vw);
    transform: translateX(-104%);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .dashboard {
    padding: 18px;
  }

  .menu-button {
    display: grid;
  }

  .collapse-button,
  body.sidebar-collapsed .collapse-button,
  body.sidebar-collapsed .sidebar-restore-button {
    display: none;
  }

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

/* Independent module scenes: tools, gallery and games keep their own scroll. */
.tool-page-panel,
.photo-page-panel,
.game-page-panel {
  --module-accent: var(--accent);
  position: relative;
  isolation: isolate;
  height: calc(100vh - 118px);
  min-height: 620px;
  overflow: hidden;
}

.tool-page-panel { --module-accent: var(--sky); }
.photo-page-panel { --module-accent: var(--rose); }
.game-page-panel { --module-accent: var(--amber); }

.tool-page-panel::before,
.photo-page-panel::before,
.game-page-panel::before {
  content: "";
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--module-accent);
  transform-origin: left center;
  animation: moduleAccentIn 520ms ease both;
}

.module-page-mark {
  position: absolute;
  z-index: -1;
  top: 56px;
  right: 34px;
  color: var(--module-accent);
  font-size: 6.4rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0.055;
  user-select: none;
  pointer-events: none;
}

.module-page-count {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 5px;
  color: var(--muted);
  white-space: nowrap;
}

.module-page-count strong {
  color: var(--module-accent);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.module-page-count span {
  font-size: 0.72rem;
  font-weight: 700;
}

.tool-catalog-view,
.converter-workspace,
.photo-page-head,
.photo-album-browser,
.photo-explorer,
.game-page-head,
.game-scroll-area {
  position: relative;
  z-index: 1;
}

.tool-catalog-view,
.converter-workspace {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 10px;
  scrollbar-color: var(--module-accent) transparent;
  scrollbar-width: thin;
}

.tool-catalog-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
}

.tool-page-head {
  max-width: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.converter-card-grid {
  align-content: start;
}

.converter-card {
  transform-style: preserve-3d;
}

.converter-card::after {
  content: attr(data-symbol);
  position: absolute;
  right: 14px;
  bottom: -18px;
  color: var(--tool-color);
  font-size: 7rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0.06;
  pointer-events: none;
  transition: opacity 260ms ease, transform 320ms ease;
}

.converter-card:hover::after,
.converter-card:focus-visible::after {
  opacity: 0.13;
  transform: translate(-8px, -8px) rotate(-5deg);
}

.converter-card-symbol,
.converter-card-body,
.converter-card-enter {
  position: relative;
  z-index: 1;
  transition: transform 220ms ease;
}

.converter-card:hover .converter-card-symbol,
.converter-card:focus-visible .converter-card-symbol {
  transform: translateY(-3px) rotate(-4deg);
}

.converter-card:hover .converter-card-body,
.converter-card:focus-visible .converter-card-body {
  transform: translateX(4px);
}

.photo-page-panel {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
}

.photo-page-head-side,
.game-page-head-side {
  display: flex;
  align-items: center;
  gap: 18px;
}

.photo-album-browser {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 10px;
  scrollbar-color: var(--module-accent) transparent;
  scrollbar-width: thin;
}

.photo-album-grid {
  align-content: start;
}

.photo-album-card {
  animation: moduleItemIn 420ms ease both;
  animation-delay: calc(min(var(--album-index), 8) * 55ms);
}

.photo-album-card:focus-visible {
  outline: 2px solid var(--module-accent);
  outline-offset: 4px;
}

.photo-album-card:hover .photo-paper-front,
.photo-album-card:focus-visible .photo-paper-front {
  border-color: color-mix(in srgb, var(--module-accent) 58%, white);
}

.photo-album-card:hover .photo-paper-front > img,
.photo-album-card:focus-visible .photo-paper-front > img {
  filter: saturate(1.08) contrast(1.03);
}

.photo-album-card:hover .photo-album-copy strong,
.photo-album-card:focus-visible .photo-album-copy strong {
  color: var(--module-accent);
}

.photo-paper-front > img,
.photo-album-copy strong {
  transition: filter 260ms ease, color 220ms ease;
}

.photo-load-sentinel::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--module-accent);
  border-radius: 50%;
  animation: moduleSpin 700ms linear infinite;
}

.photo-load-sentinel {
  grid-template-columns: auto auto;
  justify-content: center;
  gap: 9px;
}

.photo-explorer {
  min-height: 0;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.photo-explorer-grid {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 8px;
  scrollbar-color: var(--module-accent) transparent;
  scrollbar-width: thin;
}

.photo-file-item {
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.photo-file-item:hover,
.photo-file-item:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--module-accent) 54%, var(--line));
}

.game-page-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.game-page-head-side {
  justify-content: flex-end;
}

.game-scroll-area {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 5px 12px 24px 4px;
  scrollbar-color: var(--module-accent) transparent;
  scrollbar-width: thin;
}

.game-page-list {
  padding-bottom: 10px;
}

.game-page-panel .game-page-list .game-item {
  position: relative;
  opacity: 1;
  transform: translateY(0);
  animation: moduleItemIn 420ms ease both;
}

.game-page-panel .game-page-list .game-item::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--game-color);
  transform: scaleY(0.18);
  transform-origin: top;
  transition: transform 300ms ease;
}

.game-page-panel .game-page-list .game-item:hover,
.game-page-panel .game-page-list .game-item:focus-visible {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--game-color) 62%, rgba(255, 255, 255, 0.18));
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.28);
  outline: none;
}

.game-page-panel .game-page-list .game-item:hover::before,
.game-page-panel .game-page-list .game-item:focus-visible::before {
  transform: scaleY(1);
}

.game-page-panel .game-cover {
  overflow: hidden;
}

.game-page-panel .game-cover img {
  transition: transform 380ms cubic-bezier(0.2, 0.75, 0.25, 1), filter 260ms ease;
}

.game-page-panel .game-item:hover .game-cover img,
.game-page-panel .game-item:focus-visible .game-cover img {
  transform: scale(1.055);
  filter: saturate(1.08) contrast(1.03);
}

.game-load-sentinel {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.8rem;
}

.game-load-sentinel[hidden] {
  display: none;
}

.game-load-sentinel i {
  width: 18px;
  height: 18px;
  display: none;
  border: 2px solid var(--line);
  border-top-color: var(--module-accent);
  border-radius: 50%;
}

.game-load-sentinel.loading i {
  display: block;
  animation: moduleSpin 700ms linear infinite;
}

.game-load-sentinel.complete::before {
  content: "";
  width: 20px;
  height: 2px;
  background: var(--module-accent);
}

.game-page-panel.detail-active {
  grid-template-rows: minmax(0, 1fr);
}

.game-page-panel.detail-active::before {
  background: var(--game-detail-accent, var(--module-accent));
}

.game-page-panel.detail-active > .game-page-head,
.game-page-panel.detail-active > .game-scroll-area {
  display: none;
}

.module-game-detail[hidden] {
  display: none;
}

.module-game-detail {
  min-height: 0;
  display: grid;
  grid-row: 1 / -1;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  animation: moduleGameDetailIn 360ms ease both;
}

.module-game-detail-toolbar {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.module-game-detail-toolbar button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.module-game-detail-toolbar button:hover,
.module-game-detail-toolbar button:focus-visible {
  color: var(--game-detail-accent, var(--module-accent));
  border-color: var(--game-detail-accent, var(--module-accent));
  transform: translateX(-3px);
  outline: none;
}

.module-game-detail-toolbar > div {
  min-width: 0;
}

.module-game-detail-toolbar > div > span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-game-detail-toolbar b {
  color: var(--game-detail-accent, var(--module-accent));
  font-size: 1.15rem;
  letter-spacing: 0;
}

.module-game-detail-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 10px;
  scrollbar-color: var(--game-detail-accent, var(--module-accent)) transparent;
  scrollbar-width: thin;
}

.module-game-detail-content {
  min-height: 100%;
}

.module-game-detail-hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.22fr);
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.module-game-detail-cover {
  position: relative;
  min-height: 360px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #ffffff;
  background: color-mix(in srgb, var(--game-detail-accent, var(--module-accent)) 72%, #27313d);
}

.module-game-detail-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid color-mix(in srgb, var(--game-detail-accent, var(--module-accent)) 48%, transparent);
  pointer-events: none;
}

.module-game-detail-cover > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 600ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.module-game-detail-hero:hover .module-game-detail-cover > img {
  transform: scale(1.035);
}

.module-game-detail-cover > span {
  max-width: 82%;
  font-size: 2.2rem;
  font-weight: 900;
  text-align: center;
}

.module-game-detail-cover > small {
  position: absolute;
  z-index: 1;
  left: 14px;
  bottom: 14px;
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(15, 23, 28, 0.76);
  font-size: 0.72rem;
}

.module-game-detail-info {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 19px;
  padding: 32px;
}

.module-game-detail-tags,
.module-game-detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.module-game-detail-tags span {
  padding: 5px 8px;
  color: var(--game-detail-accent, var(--module-accent));
  border: 1px solid color-mix(in srgb, var(--game-detail-accent, var(--module-accent)) 45%, var(--line));
  border-radius: 4px;
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 700;
}

.module-game-detail-info h2,
.module-game-detail-info p,
.module-game-detail-article h3,
.module-game-detail-article header p {
  margin: 0;
}

.module-game-detail-info h2 {
  font-size: 2rem;
  line-height: 1.2;
}

.module-game-detail-info > p {
  color: var(--muted);
  line-height: 1.75;
}

.module-game-detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.module-game-detail-meta > div {
  min-width: 0;
  padding: 0 14px;
  border-left: 1px solid var(--line);
}

.module-game-detail-meta > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.module-game-detail-meta dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.7rem;
}

.module-game-detail-meta dd {
  min-height: 24px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-game-detail-author img,
.module-game-detail-author > span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  border-radius: 50%;
  object-fit: cover;
  color: #ffffff;
  background: var(--game-detail-accent, var(--module-accent));
  font-size: 0.7rem;
}

.module-game-detail-actions a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 700;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.module-game-detail-actions a.primary,
.module-game-detail-actions a:hover {
  color: #ffffff;
  border-color: var(--game-detail-accent, var(--module-accent));
  background: var(--game-detail-accent, var(--module-accent));
  transform: translateY(-2px);
}

.module-game-detail-article {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 42px clamp(18px, 4vw, 64px) 58px;
}

.module-game-detail-article > header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.module-game-detail-article > header > span {
  color: var(--game-detail-accent, var(--module-accent));
  font-size: 1.8rem;
  font-weight: 900;
}

.module-game-detail-article header p {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.module-game-detail-article h3 {
  margin-top: 2px;
  font-size: 1.3rem;
}

.module-game-detail-body {
  display: grid;
  gap: 18px;
  color: var(--muted);
  line-height: 1.9;
}

.module-game-detail-body p {
  width: min(1120px, 100%);
  margin: 0;
  padding-left: 18px;
  border-left: 2px solid color-mix(in srgb, var(--game-detail-accent, var(--module-accent)) 58%, var(--line));
}

.module-game-detail-image {
  display: grid;
  gap: 8px;
  margin: 6px 0;
}

.module-game-detail-image img {
  width: 100%;
  max-height: 760px;
  display: block;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.module-game-detail-image figcaption {
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.module-game-detail-loading,
.module-game-detail-error {
  min-height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.module-game-detail-loading::before {
  content: "";
  width: 24px;
  height: 24px;
  margin-bottom: -40px;
  border: 2px solid var(--line);
  border-top-color: var(--game-detail-accent, var(--module-accent));
  border-radius: 50%;
  animation: moduleSpin 700ms linear infinite;
}

@keyframes moduleGameDetailIn {
  from { opacity: 0; translate: 22px 0; }
  to { opacity: 1; translate: 0 0; }
}

.game-search-field input:focus,
.game-type-field select:focus,
.photo-search-field input:focus {
  border-color: var(--module-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--module-accent) 18%, transparent);
}

@keyframes moduleAccentIn {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes moduleItemIn {
  from { opacity: 0; translate: 0 16px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes moduleSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .photo-page-head-side,
  .game-page-head-side {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .photo-page-head-side .module-page-count,
  .game-page-head-side .module-page-count {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .tool-page-panel,
  .photo-page-panel,
  .game-page-panel {
    height: calc(100svh - 92px);
    min-height: 600px;
    padding: 16px;
  }

  .module-page-mark {
    top: 76px;
    right: 14px;
    font-size: 3.6rem;
  }

  .tool-page-head {
    flex-direction: column;
    gap: 10px;
  }

  .tool-page-head .module-page-count {
    justify-content: flex-start;
  }

  .game-page-actions {
    flex-wrap: wrap;
  }

  .photo-page-head-side,
  .game-page-head-side,
  .photo-search-field,
  .game-search-field {
    width: 100%;
  }

  .photo-search-field input {
    width: 100%;
  }

  .game-type-field {
    min-width: 120px;
  }

  .photo-album-browser,
  .game-scroll-area,
  .tool-catalog-view,
  .converter-workspace {
    padding-right: 5px;
  }

  .module-game-detail {
    gap: 10px;
  }

  .module-game-detail-toolbar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding-bottom: 10px;
  }

  .module-game-detail-toolbar button {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .module-game-detail-toolbar button strong,
  .module-game-detail-toolbar b {
    display: none;
  }

  .module-game-detail-scroll {
    padding-right: 5px;
  }

  .module-game-detail-hero {
    grid-template-columns: 1fr;
  }

  .module-game-detail-cover {
    min-height: 220px;
    max-height: 270px;
  }

  .module-game-detail-info {
    gap: 15px;
    padding: 22px 18px;
  }

  .module-game-detail-info h2 {
    font-size: 1.5rem;
  }

  .module-game-detail-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 0;
  }

  .module-game-detail-meta > div:nth-child(3) {
    grid-column: 1 / -1;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .module-game-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .module-game-detail-actions a {
    justify-content: center;
  }

  .module-game-detail-article {
    padding: 30px 4px 40px;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: relative;
    top: 0;
    align-items: flex-start;
  }

  .topbar-actions {
    max-width: calc(100vw - 36px);
  }

  .wallpaper-picker {
    width: 100%;
    justify-content: flex-end;
  }

  .wallpaper-picker select {
    max-width: min(220px, 68vw);
  }

  .wallpaper-showcase {
    min-height: 300px;
  }

  .section-card {
    padding: 18px;
  }

  .tool-grid,
  .game-list {
    grid-template-columns: 1fr;
  }

  .with-control,
  .profile-body {
    flex-direction: column;
    align-items: stretch;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    flex: 1;
  }
}




/* Game sharing module */
.games-card {
  background: rgba(255, 255, 255, 0.94);
}

body.dark .games-card {
  background: rgba(18, 24, 33, 0.92);
}

.game-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.game-item {
  position: relative;
  display: grid;
  grid-template-rows: 160px minmax(0, 1fr);
  min-height: 360px;
  overflow: hidden;
  padding: 0;
  color: var(--text);
  background: rgba(15, 23, 28, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
}

body:not(.dark) .game-item {
  color: #f6f8fb;
}

.game-item:hover {
  transform: translateY(-3px);
  border-color: rgba(58, 143, 123, 0.42);
}

.game-cover {
  height: 160px;
  border-radius: 0;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--game-color) 76%, white), rgba(255, 255, 255, 0.22)),
    var(--game-color);
}

.game-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.game-cover span {
  display: grid;
  place-items: center;
  height: 100%;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.game-content {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.game-source-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: rgba(229, 237, 246, 0.72);
  font-size: 0.82rem;
}

.game-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.game-author img,
.game-author span:first-child {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.game-author span:first-child {
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
}

.recommend-dot,
.platform-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.recommend-dot {
  background: #ff8a2a;
}

.platform-dot {
  background: #55bb58;
}

.game-item h3 {
  color: #ffffff;
  font-size: 1.02rem;
  line-height: 1.35;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.game-item p {
  color: rgba(229, 237, 246, 0.68);
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.game-meta {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(229, 237, 246, 0.55);
}

.game-meta strong {
  min-width: 58px;
  padding: 4px 8px;
  border-radius: 4px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.22);
  text-align: center;
}

.game-empty {
  grid-column: 1 / -1;
  padding: 34px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.game-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.game-pagination button,
.game-pagination span {
  min-width: 36px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-muted);
}

.game-pagination button.active {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.game-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.detail-page {
  min-height: 100vh;
  padding: 26px;
  color: #eaf1f7;
  background: #111518;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

.detail-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin-bottom: 18px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #d7e2ec;
  background: rgba(255, 255, 255, 0.06);
}

.detail-hero,
.detail-article {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: #171c20;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(260px, 42%) minmax(0, 1fr);
  overflow: hidden;
}

.detail-cover {
  min-height: 320px;
  background: linear-gradient(135deg, #3a8f7b, #5867a8);
}

.detail-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.detail-head {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 30px;
}

.detail-tags,
.detail-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-tags span,
.detail-price {
  padding: 5px 10px;
  border-radius: 999px;
  color: #d7f7ef;
  background: rgba(58, 143, 123, 0.18);
  font-size: 0.84rem;
}

.detail-title {
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1.2;
}

.detail-intro {
  margin: 0;
  color: #aab7c4;
  font-size: 1.02rem;
  line-height: 1.8;
}

.detail-meta-row {
  color: #7f8c99;
}

.detail-action {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-action a {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(58, 143, 123, 0.78);
}

.detail-article {
  margin-top: 18px;
  padding: 30px;
}

.detail-article h2 {
  margin: 0 0 14px;
  color: #ffffff;
}

.detail-content {
  display: grid;
  gap: 14px;
  color: #c7d1dc;
  line-height: 1.9;
}

.detail-content p {
  margin: 0;
}

.detail-error {
  padding: 36px;
  color: #c7d1dc;
  text-align: center;
}

@media (max-width: 1320px) {
  .game-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .game-list {
    grid-template-columns: 1fr;
  }

  .detail-page {
    padding: 16px;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-cover {
    min-height: 220px;
  }

  .detail-head,
  .detail-article {
    padding: 20px;
  }
}

/* Focused games view opened from the sidebar */
.wallpaper-showcase {
  position: relative;
}

.game-focus-panel {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 24, 33, 0.9);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate3d(0, 18px, 0) scale(0.985);
  pointer-events: none;
  transition: opacity 220ms ease, transform 260ms ease;
  overflow: hidden;
}

body.game-focus-active .game-focus-panel {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  pointer-events: auto;
}

.game-focus-panel[hidden] {
  display: none;
}

.game-focus-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #ffffff;
}

.game-focus-head h2 {
  margin: 0;
  font-size: 1.18rem;
}

.game-focus-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  overflow: auto;
  padding-right: 4px;
}

.game-focus-list .game-item {
  min-height: 338px;
}

.game-focus-panel .game-pagination {
  margin-top: 0;
}

/* Keep the bottom game module compact as the dashboard preview. */
.games-card .game-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.games-card .game-item {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  min-height: 178px;
  padding: 16px;
  overflow: visible;
  color: var(--text);
  background: var(--surface-muted);
  border-color: var(--line);
  box-shadow: none;
}

.games-card .game-source-line {
  display: none;
}

.games-card .game-cover {
  height: 70px;
  border-radius: var(--radius);
}

.games-card .game-cover img {
  border-radius: var(--radius);
}

.games-card .game-cover span {
  color: rgba(255, 255, 255, 0.86);
}

.games-card .game-content {
  display: contents;
  padding: 0;
}

.games-card .game-item h3 {
  color: var(--text);
  font-size: 1rem;
}

.games-card .game-item p {
  color: var(--muted);
  -webkit-line-clamp: 2;
}

.games-card .game-meta {
  padding-top: 0;
  border-top: 0;
  color: var(--muted);
}

.games-card .game-meta strong {
  min-width: auto;
  padding: 0;
  color: var(--accent-strong);
  background: transparent;
}

.detail-image-block {
  margin: 8px 0;
}

.detail-image-block img {
  width: 100%;
  max-height: 560px;
  display: block;
  border-radius: 8px;
  object-fit: cover;
  background: #20262b;
}

.detail-image-block figcaption {
  margin-top: 8px;
  color: #7f8c99;
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 1320px) {
  .game-focus-list,
  .games-card .game-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .game-focus-panel {
    position: relative;
    min-height: 640px;
  }

  .game-focus-list,
  .games-card .game-list {
    grid-template-columns: 1fr;
  }
}

/* Sidebar games opens a standalone page, not an overlay inside the overview. */
.game-page-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  min-height: calc(100vh - 118px);
  margin-top: 16px;
  padding: 20px;
  border-radius: var(--radius);
  background: rgba(18, 24, 33, 0.9);
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition: opacity 260ms ease, transform 300ms ease;
}

.game-page-panel[hidden] {
  display: none;
}

body.game-page-active .game-page-panel {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

body.game-page-active .wallpaper-showcase,
body.game-page-active .grid-layout {
  display: none;
}

.anime-resource-page-panel {
  --module-accent: #a55f82;
}

.anime-resource-subtitle {
  max-width: 620px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

body.anime-resource-page-active .anime-resource-page-panel {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

body.anime-resource-page-active .wallpaper-showcase,
body.anime-resource-page-active .grid-layout {
  display: none;
}

.anime-resource-page-panel .anime-resource-item .game-meta strong {
  max-width: 54%;
  overflow: hidden;
  color: var(--game-color);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sidebar tools opens an in-page offline conversion workspace. */
.tool-page-panel {
  display: grid;
  gap: 18px;
  min-height: calc(100vh - 118px);
  margin-top: 16px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur)) saturate(1.1);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.1);
}

.tool-page-panel[hidden] {
  display: none;
}

body.tool-page-active .wallpaper-showcase,
body.tool-page-active .grid-layout {
  display: none;
}

body.tool-page-active .tool-page-panel {
  animation: dashboardCardIn 360ms ease both;
}

/* Standalone resume with three vertically snapped sections. */
.resume-page-panel {
  --resume-accent: var(--accent);
  --resume-accent-soft: var(--accent-soft);
  --resume-progress: 0%;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 118px);
  min-height: 620px;
  margin-top: 16px;
  padding: 22px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur)) saturate(1.1);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.1);
  transition: border-color 260ms ease, box-shadow 260ms ease;
}

.resume-page-panel[data-resume-active="work"] {
  --resume-accent: var(--amber);
  --resume-accent-soft: color-mix(in srgb, var(--amber) 16%, transparent);
}

.resume-page-panel[data-resume-active="projects"] {
  --resume-accent: var(--rose);
  --resume-accent-soft: color-mix(in srgb, var(--rose) 16%, transparent);
}

.resume-page-panel::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--resume-accent);
  transform-origin: left center;
  animation: resumeAccentIn 520ms ease both;
  transition: background-color 260ms ease;
}

.resume-page-panel[hidden] {
  display: none;
}

body.profile-page-active .wallpaper-showcase,
body.profile-page-active .grid-layout {
  display: none;
}

body.profile-page-active .resume-page-panel {
  animation: dashboardCardIn 360ms ease both;
}

.resume-page-head,
.resume-identity,
.resume-section-nav,
.resume-slide-head,
.resume-project-title,
.resume-project-links {
  display: flex;
  align-items: center;
}

.resume-page-head {
  position: relative;
  z-index: 2;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 4px 14px;
  border-bottom: 1px solid var(--line);
}

.resume-identity {
  min-width: 0;
  gap: 14px;
}

.resume-avatar {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #ffffff;
  border-radius: 6px;
  background: var(--resume-accent);
  font-size: 1.18rem;
  font-weight: 800;
  box-shadow: 8px 8px 0 var(--resume-accent-soft);
  transition: background-color 260ms ease, box-shadow 260ms ease, transform 220ms ease;
}

.resume-identity:hover .resume-avatar {
  transform: translate(-2px, -2px) rotate(-2deg);
}

.resume-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resume-page-head h2,
.resume-page-head p,
.resume-slide-head h3,
.resume-slide-head p,
.resume-entry h4,
.resume-entry p,
.resume-project h4,
.resume-project p {
  margin: 0;
}

.resume-page-head h2 {
  font-size: 1.22rem;
}

.resume-page-head .resume-identity > div > p:last-child {
  max-width: 720px;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resume-page-position {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--muted);
}

.resume-page-position strong {
  color: var(--resume-accent);
  font-size: 1.65rem;
  transition: color 260ms ease;
}

.resume-page-position strong.is-changing {
  animation: resumeNumberIn 360ms ease both;
}

.resume-section-nav {
  position: relative;
  z-index: 2;
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.resume-section-nav button {
  position: relative;
  min-height: 36px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  background: transparent;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, background-color 200ms ease;
}

.resume-section-nav button span {
  color: var(--resume-accent);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  transition: color 200ms ease;
}

.resume-section-nav button strong {
  font-size: 0.8rem;
}

.resume-section-nav button:hover,
.resume-section-nav button.active {
  color: #ffffff;
  border-color: var(--resume-accent);
  background: var(--resume-accent);
}

.resume-section-nav button.active span {
  color: #ffffff;
}

.resume-scroll-shell {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.resume-scroll {
  height: 100%;
  min-height: 0;
  padding-right: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.resume-scroll::-webkit-scrollbar {
  display: none;
}

.resume-progress-rail {
  position: absolute;
  z-index: 4;
  top: 9%;
  right: 4px;
  bottom: 9%;
  width: 9px;
  pointer-events: none;
}

.resume-progress-rail::before,
.resume-progress-rail > span {
  content: "";
  position: absolute;
  top: 0;
  left: 4px;
  width: 1px;
}

.resume-progress-rail::before {
  height: 100%;
  background: var(--line);
}

.resume-progress-rail > span {
  min-height: 8px;
  height: var(--resume-progress);
  background: var(--resume-accent);
  transition: height 100ms linear, background-color 260ms ease;
}

.resume-progress-rail i {
  position: absolute;
  left: 1px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--resume-accent);
  border-radius: 50%;
  background: var(--surface);
  transition: border-color 260ms ease, transform 220ms ease;
}

.resume-progress-rail i:nth-of-type(1) { top: 0; }
.resume-progress-rail i:nth-of-type(2) { top: 50%; }
.resume-progress-rail i:nth-of-type(3) { bottom: 0; }

.resume-page-panel[data-resume-active="education"] .resume-progress-rail i:nth-of-type(1),
.resume-page-panel[data-resume-active="work"] .resume-progress-rail i:nth-of-type(2),
.resume-page-panel[data-resume-active="projects"] .resume-progress-rail i:nth-of-type(3) {
  background: var(--resume-accent);
  transform: scale(1.5);
}

.resume-slide {
  position: relative;
  min-height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 28px;
  padding: 26px 32px 34px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.resume-slide-mark {
  position: absolute;
  z-index: -1;
  top: 12px;
  right: 34px;
  color: var(--resume-accent);
  font-size: 7rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 420ms ease, transform 520ms ease, color 260ms ease;
  user-select: none;
}

.resume-slide.is-active .resume-slide-mark {
  opacity: 0.07;
  transform: translateY(0);
}

.resume-slide-head {
  gap: 16px;
}

.resume-slide-head > span {
  color: var(--resume-accent);
  font-size: 2rem;
  font-weight: 800;
  transition: color 260ms ease;
}

.resume-slide-head p {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.resume-slide-head h3 {
  margin-top: 2px;
  font-size: 1.3rem;
}

.resume-timeline {
  position: relative;
  display: grid;
  align-content: start;
  padding-left: 20px;
}

.resume-timeline::before {
  content: "";
  position: absolute;
  top: 25px;
  bottom: 25px;
  left: 4px;
  width: 1px;
  background: var(--line);
}

.resume-entry {
  position: relative;
  display: grid;
  grid-template-columns: minmax(110px, 0.28fr) minmax(0, 1fr);
  gap: 26px;
  padding: 20px 4px;
  border-top: 1px solid var(--line);
  transition: transform 220ms ease, border-color 220ms ease;
}

.resume-entry::before {
  content: "";
  position: absolute;
  top: 26px;
  left: -19px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--resume-accent);
  box-shadow: 0 0 0 1px var(--resume-accent);
  transition: transform 220ms ease, background-color 260ms ease, box-shadow 260ms ease;
}

.resume-entry:hover {
  transform: translateX(7px);
  border-color: color-mix(in srgb, var(--resume-accent) 55%, var(--line));
}

.resume-entry:hover::before {
  transform: scale(1.45);
}

.resume-entry:last-child {
  border-bottom: 1px solid var(--line);
}

.resume-entry-date {
  padding-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.resume-entry-main > p {
  color: var(--resume-accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.resume-entry h4 {
  margin-top: 5px;
  font-size: 1.08rem;
}

.resume-entry-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.75;
}

.resume-skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.resume-skill-list span {
  padding: 5px 8px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-muted);
  font-size: 0.72rem;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.resume-skill-list span:hover {
  color: var(--resume-accent);
  border-color: var(--resume-accent);
  background: var(--surface);
  transform: translateY(-2px);
}

.resume-highlights {
  display: grid;
  gap: 7px;
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.resume-highlights li::marker {
  color: var(--resume-accent);
}

.resume-project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 16px;
}

.resume-project {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transform-style: preserve-3d;
  transition: transform 120ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.resume-project:hover {
  border-color: color-mix(in srgb, var(--resume-accent) 58%, var(--line));
  box-shadow: var(--shadow-soft);
}

.resume-project::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  border-radius: inherit;
  pointer-events: none;
  transition: border-color 220ms ease;
}

.resume-project:hover::after {
  border-color: color-mix(in srgb, var(--resume-accent) 38%, transparent);
}

.resume-project-media {
  position: relative;
  height: 150px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #ffffff;
  background: linear-gradient(135deg, var(--sky), var(--accent));
  transform: translateZ(14px);
}

.resume-project:nth-child(even) .resume-project-media {
  background: linear-gradient(135deg, var(--rose), var(--amber));
}

.resume-project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resume-project-media > span {
  font-size: 2.4rem;
  font-weight: 800;
}

.resume-project-media small {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(16, 24, 32, 0.76);
  font-size: 0.7rem;
}

.resume-project-body {
  padding: 16px;
  transform: translateZ(8px);
}

.resume-project-title {
  justify-content: space-between;
  gap: 12px;
}

.resume-project-title time {
  color: var(--muted);
  font-size: 0.74rem;
}

.resume-project-body > p {
  min-height: 46px;
  margin-top: 9px;
  color: var(--muted);
  line-height: 1.55;
}

.resume-project-links {
  gap: 8px;
  margin-top: 14px;
}

.resume-project-links a {
  padding: 7px 10px;
  color: var(--resume-accent);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 700;
}

.resume-project-links a:hover {
  color: #ffffff;
  border-color: var(--resume-accent);
  background: var(--resume-accent);
}

.resume-slide.is-active .resume-entry {
  animation: resumeContentIn 440ms ease both;
  animation-delay: calc(var(--entry-index, 0) * 70ms);
}

.resume-slide.is-active .resume-project {
  animation: resumeProjectIn 440ms ease both;
  animation-delay: calc(var(--project-index, 0) * 70ms);
}

.resume-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 6px;
}

@media (max-width: 760px) {
  .resume-page-panel {
    height: calc(100svh - 92px);
    min-height: 600px;
    padding: 16px;
  }

  .resume-page-head {
    align-items: flex-start;
  }

  .resume-page-head .resume-identity > div > p:last-child {
    display: none;
  }

  .resume-page-position {
    flex: 0 0 auto;
  }

  .resume-section-nav button {
    min-width: 0;
    padding-inline: 8px;
  }

  .resume-slide {
    gap: 20px;
    padding: 22px 4px 28px;
  }

  .resume-scroll {
    padding-right: 14px;
  }

  .resume-slide-mark {
    right: 8px;
    font-size: 4.2rem;
  }

  .resume-progress-rail {
    right: 1px;
  }

  .resume-section-nav button {
    gap: 4px;
  }

  .resume-section-nav button span {
    display: none;
  }

  .resume-entry {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .resume-entry:hover {
    transform: none;
  }

  .resume-project-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes resumeAccentIn {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes resumeNumberIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes resumeContentIn {
  from { opacity: 0; clip-path: inset(0 0 26% 0); }
  to { opacity: 1; clip-path: inset(0 0 0 0); }
}

@keyframes resumeProjectIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .resume-page-panel::before,
  .resume-page-position strong,
  .resume-slide.is-active .resume-entry,
  .resume-slide.is-active .resume-project {
    animation: none;
  }

  .resume-project {
    transform: none;
  }
}

/* Photo wall */
.photo-page-panel {
  display: grid;
  align-content: start;
  gap: 24px;
  min-height: calc(100vh - 118px);
  margin-top: 16px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur)) saturate(1.1);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.1);
}

.photo-page-panel[hidden],
.photo-explorer[hidden],
.photo-fullscreen-viewer[hidden] {
  display: none;
}

body.photo-page-active .wallpaper-showcase,
body.photo-page-active .grid-layout {
  display: none;
}

body.photo-page-active .photo-page-panel {
  animation: dashboardCardIn 360ms ease both;
}

.photo-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.photo-page-head h2,
.photo-explorer-toolbar h3 {
  margin: 0;
}

.photo-page-head > div > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
}

.photo-search-field input {
  width: min(360px, 38vw);
  height: 42px;
  padding: 0 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  outline: none;
}

.photo-search-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.photo-album-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 52px 32px;
  padding: 20px 12px;
}

.photo-album-card {
  position: relative;
  min-width: 0;
  height: 420px;
  padding: 0;
  color: var(--text);
  text-align: left;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.photo-paper {
  position: absolute;
  top: 8px;
  left: 50%;
  width: min(88%, 330px);
  height: 320px;
  padding: 9px;
  border: 1px solid rgba(31, 41, 55, 0.14);
  border-radius: 3px;
  background: #f8fafc;
  box-shadow: 0 14px 34px rgba(29, 39, 51, 0.18);
  transform-origin: center 88%;
  transition: transform 380ms cubic-bezier(0.2, 0.75, 0.25, 1), box-shadow 260ms ease;
}

.photo-paper-back {
  transform: translateX(-50%) rotate(-5deg) translate(-8px, 10px);
  background: color-mix(in srgb, var(--surface-muted) 86%, white);
}

.photo-paper-middle {
  transform: translateX(-50%) rotate(4deg) translate(9px, 5px);
  background: color-mix(in srgb, var(--surface-muted) 72%, white);
}

.photo-paper-back,
.photo-paper-middle {
  overflow: hidden;
}

.photo-paper-back > img,
.photo-paper-middle > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: saturate(0.88) brightness(0.94);
}

.photo-paper-front {
  overflow: hidden;
  transform: translateX(-50%);
  background: #ffffff;
}

.photo-paper-front > img,
.photo-paper-front > span:first-child {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  object-fit: cover;
  color: #ffffff;
  background: var(--accent);
  font-size: 2.4rem;
  font-weight: 800;
}

.photo-album-card:hover .photo-paper-back {
  transform: translateX(-50%) rotate(-10deg) translate(-40px, 3px);
}

.photo-album-card:hover .photo-paper-middle {
  transform: translateX(-50%) rotate(9deg) translate(42px, -1px);
}

.photo-album-card:hover .photo-paper-front {
  transform: translateX(-50%) translateY(-8px) scale(1.015);
  box-shadow: 0 22px 42px rgba(29, 39, 51, 0.24);
}

.photo-album-hover {
  position: absolute;
  inset: auto 9px 9px;
  display: grid;
  gap: 2px;
  padding: 42px 14px 14px;
  color: #ffffff;
  background: linear-gradient(to bottom, transparent, rgba(10, 18, 26, 0.88));
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.photo-album-hover strong {
  font-size: 1.05rem;
}

.photo-album-hover small {
  color: rgba(255, 255, 255, 0.76);
}

.photo-album-card:hover .photo-album-hover,
.photo-album-card:focus-visible .photo-album-hover {
  opacity: 1;
  transform: translateY(0);
}

.photo-album-copy {
  position: absolute;
  inset: 350px 6% auto;
  display: grid;
  gap: 7px;
  text-align: center;
}

.photo-album-copy > span {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-album-copy strong {
  font-size: 1.05rem;
}

.photo-album-copy time {
  padding: 3px 6px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-muted);
  font-size: 0.75rem;
}

.photo-album-copy > small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-load-sentinel {
  min-height: 42px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.photo-load-sentinel[hidden] {
  display: none;
}

.photo-load-sentinel.error {
  color: #b45353;
}

.photo-empty {
  grid-column: 1 / -1;
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

.photo-explorer {
  display: grid;
  gap: 18px;
}

.photo-explorer-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.photo-explorer-toolbar button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  cursor: pointer;
  font-size: 1.45rem;
}

.photo-explorer-toolbar span {
  color: var(--muted);
  font-size: 0.82rem;
}

.photo-explorer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.photo-file-item {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 8px;
  color: var(--text);
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
}

.photo-file-item:hover,
.photo-file-item:focus-visible {
  border-color: var(--line);
  background: var(--accent-soft);
}

.photo-file-thumb {
  aspect-ratio: 1 / 0.76;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-muted);
}

.photo-file-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 220ms ease;
}

.photo-file-item:hover img {
  transform: scale(1.045);
}

.photo-file-item strong,
.photo-file-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-file-item strong {
  font-size: 0.86rem;
}

.photo-file-item small {
  color: var(--muted);
  font-size: 0.74rem;
}

.photo-fullscreen-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(5, 10, 16, 0.94);
}

.photo-fullscreen-viewer figure {
  max-width: min(94vw, 1600px);
  max-height: 92vh;
  display: grid;
  gap: 10px;
  margin: 0;
}

.photo-fullscreen-viewer img {
  max-width: 100%;
  max-height: 86vh;
  display: block;
  object-fit: contain;
}

.photo-fullscreen-viewer figcaption {
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.photo-viewer-close {
  position: fixed;
  top: 18px;
  right: 20px;
  width: 42px;
  height: 42px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  font-size: 1.35rem;
}

body.photo-viewer-open {
  overflow: hidden;
}

body.dark .photo-paper {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.38);
}

body.dark .photo-paper-front {
  background: #e9eef3;
}

@media (max-width: 1180px) {
  .photo-album-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .photo-page-panel {
    min-height: auto;
    padding: 16px;
  }

  .photo-page-head {
    flex-direction: column;
  }

  .photo-search-field,
  .photo-search-field input {
    width: 100%;
  }

  .photo-album-grid {
    grid-template-columns: 1fr;
    padding-inline: 0;
  }

  .photo-album-card {
    height: 410px;
  }

  .photo-explorer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tool-catalog-view[hidden],
.converter-workspace[hidden] {
  display: none;
}

.tool-page-head {
  max-width: 720px;
  margin-bottom: 24px;
}

.tool-page-head h2,
.converter-workspace h3,
.converter-workspace h4 {
  margin: 0;
}

.tool-page-head h2 {
  font-size: 1.24rem;
}

.tool-page-copy {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.converter-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.converter-card {
  --tool-color: var(--accent);
  position: relative;
  min-height: 224px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  overflow: hidden;
  padding: 20px;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  box-shadow: 0 8px 22px rgba(29, 39, 51, 0.07);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.converter-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--tool-color);
}

.converter-card:hover,
.converter-card:focus-visible {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--tool-color) 64%, var(--line));
  box-shadow: 0 16px 34px rgba(29, 39, 51, 0.14);
  outline: none;
}

.converter-card-top,
.converter-detail-title,
.converter-action-group,
.converter-queue-head,
.converter-row-actions {
  display: flex;
  align-items: center;
}

.converter-card-top {
  justify-content: space-between;
  gap: 12px;
}

.converter-card-symbol {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #ffffff;
  font-weight: 800;
  border-radius: var(--radius);
  background: var(--tool-color, var(--accent));
}

.converter-card-body {
  display: grid;
  align-content: start;
  gap: 9px;
}

.converter-card-body strong {
  font-size: 1.08rem;
}

.converter-card-body span,
.converter-card small {
  color: var(--muted);
  line-height: 1.58;
}

.converter-card small {
  color: var(--accent-strong);
  font-size: 0.78rem;
}

.converter-card small.unavailable {
  color: #9a5d21;
}

.converter-card-enter {
  justify-self: end;
  color: var(--tool-color);
  font-size: 1.35rem;
  line-height: 1;
  transition: transform 180ms ease;
}

.converter-card:hover .converter-card-enter {
  transform: translateX(4px);
}

.converter-workspace {
  min-width: 0;
  animation: dashboardCardIn 320ms ease both;
}

.converter-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.converter-back-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  cursor: pointer;
}

.converter-back-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.converter-detail-title {
  min-width: 0;
  gap: 14px;
}

.converter-detail-title p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.converter-state {
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 4px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.8rem;
  white-space: nowrap;
}

.converter-state.unavailable {
  color: #9a5d21;
  border-color: rgba(216, 155, 43, 0.34);
  background: rgba(216, 155, 43, 0.14);
}

.converter-form {
  display: grid;
}

.converter-import-band {
  display: grid;
  grid-template-columns: minmax(300px, 0.86fr) minmax(360px, 1.14fr);
  gap: 28px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.converter-dropzone {
  min-height: 154px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed color-mix(in srgb, var(--accent) 50%, var(--line));
  border-radius: var(--radius);
  background: var(--accent-soft);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.converter-dropzone:hover,
.converter-dropzone.dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 76%, var(--surface));
  transform: translateY(-2px);
}

.converter-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.converter-dropzone strong {
  color: var(--text);
  font-size: 0.98rem;
}

.converter-dropzone small {
  line-height: 1.45;
}

.converter-import-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #ffffff;
  border-radius: var(--radius);
  background: var(--accent);
  font-size: 1.35rem;
  line-height: 1;
}

.converter-settings {
  display: grid;
  align-content: center;
  gap: 22px;
}

.converter-format-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.converter-format-field select {
  width: 100%;
  min-height: 44px;
  padding: 8px 34px 8px 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  outline: none;
}

.converter-format-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.converter-action-group {
  justify-content: flex-end;
  gap: 10px;
}

.converter-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.converter-button.primary {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.converter-button.secondary {
  color: var(--text);
  background: var(--surface-muted);
}

.converter-button:not(:disabled):hover {
  border-color: var(--accent);
  box-shadow: 0 5px 14px rgba(29, 39, 51, 0.1);
}

.converter-button:disabled,
.converter-back-button:disabled,
.converter-format-field select:disabled,
.converter-dropzone:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.5;
}

.converter-queue-section {
  min-width: 0;
  padding-top: 24px;
}

.converter-queue-head {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.converter-queue-head h4 {
  font-size: 1rem;
}

.converter-queue-head p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.converter-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.converter-table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
  background: var(--surface-soft);
}

.converter-table th,
.converter-table td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
  vertical-align: middle;
}

.converter-table th {
  color: var(--muted);
  background: var(--surface-muted);
  font-weight: 600;
  white-space: nowrap;
}

.converter-table tbody tr:last-child td {
  border-bottom: 0;
}

.converter-file-name {
  display: block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.converter-empty-row td {
  height: 112px;
  color: var(--muted);
  text-align: center;
}

.converter-row-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface-muted);
  white-space: nowrap;
}

.converter-row-status.processing {
  color: #2d6f9f;
  background: rgba(75, 143, 216, 0.14);
}

.converter-row-status.completed {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.converter-row-status.failed {
  color: #a6424e;
  background: rgba(217, 99, 116, 0.14);
}

.converter-progress-track {
  width: 96px;
  height: 3px;
  display: block;
  overflow: hidden;
  margin-top: 5px;
  border-radius: 2px;
  background: var(--line);
}

.converter-progress-track span {
  height: 100%;
  display: block;
  background: var(--sky);
  transition: width 120ms linear;
}

.converter-row-actions {
  gap: 7px;
}

.converter-row-actions button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--accent-strong);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-muted);
  cursor: pointer;
}

.converter-row-actions button:hover {
  border-color: var(--accent);
}

.converter-row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.converter-feedback {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
}

body.dark .converter-card {
  background: #1c2936;
  border-color: rgba(204, 222, 235, 0.24);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

body.dark .converter-card:hover,
body.dark .converter-card:focus-visible {
  border-color: color-mix(in srgb, var(--tool-color) 70%, #ffffff 12%);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(121, 210, 188, 0.14);
}

body.dark .converter-table-wrap {
  border-color: rgba(204, 222, 235, 0.2);
}

body.dark .converter-table tbody tr:hover {
  background: rgba(105, 183, 164, 0.05);
}

@media (max-width: 1040px) {
  .converter-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .converter-import-band {
    grid-template-columns: minmax(260px, 0.8fr) minmax(300px, 1.2fr);
  }
}

@media (max-width: 840px) {
  .converter-detail-head {
    grid-template-columns: 1fr auto;
  }

  .converter-back-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .converter-import-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .tool-page-panel {
    min-height: auto;
    padding: 16px;
  }

  .converter-card-grid {
    grid-template-columns: 1fr;
  }

  .converter-detail-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .converter-state {
    justify-self: start;
  }

  .converter-import-band {
    gap: 18px;
  }

  .converter-action-group,
  .converter-queue-head {
    align-items: stretch;
    flex-direction: column;
  }

  .converter-action-group .converter-button,
  .converter-queue-head .converter-button {
    width: 100%;
  }
}

.game-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #ffffff;
}

.game-page-head h2 {
  margin: 0;
  font-size: 1.18rem;
}

.game-page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-search-field,
.game-type-field {
  display: block;
}

.game-search-field input,
.game-type-field select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-muted);
  outline: none;
}

.game-search-field input {
  width: 230px;
  padding: 0 12px;
}

.game-type-field select {
  min-width: 132px;
  padding: 0 30px 0 10px;
}

.game-search-field input:focus,
.game-type-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.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;
}

.game-page-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-content: start;
}

.game-page-list .game-item {
  min-height: 342px;
}

.game-page-panel .game-pagination {
  justify-content: center;
  margin-top: 8px;
}

.game-page-panel .segmented-control {
  background: rgba(31, 41, 55, 0.72);
}

.game-page-panel .game-pagination button,
.game-page-panel .game-pagination span {
  color: #d9e5ef;
  background: rgba(31, 41, 55, 0.78);
  border-color: rgba(255, 255, 255, 0.12);
}

.game-page-panel .game-pagination button.active {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

/* Retire the previous overview overlay behavior. */
.game-focus-panel,
body.game-focus-active .game-focus-panel,
.game-focus-list,
.game-focus-head {
  all: unset;
}

@media (max-width: 1180px) {
  .game-page-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .game-page-panel {
    min-height: auto;
    padding: 16px;
  }

  .game-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .game-page-actions {
    width: 100%;
  }

  .game-search-field {
    flex: 1;
  }

  .game-search-field input,
  .game-type-field select {
    width: 100%;
  }

  .game-page-list {
    grid-template-columns: 1fr;
  }
}

/* Fix standalone game page visibility and match the sidebar palette. */
.game-page-panel {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur)) saturate(1.1);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.1);
}

.game-page-head {
  color: var(--text);
}

.game-page-panel .segmented-control {
  background: var(--surface-muted);
}

.game-page-panel .game-page-list .game-item {
  opacity: 1;
  transform: none;
}

body.dark .games-card .game-item,
body.dark .game-page-panel .game-item {
  background: #1c2936;
  border-color: rgba(204, 222, 235, 0.24);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

body.dark .games-card .game-item:hover,
body.dark .game-page-panel .game-item:hover {
  border-color: rgba(121, 210, 188, 0.76);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(121, 210, 188, 0.14);
}

/* Music library and persistent player */
.music-page-panel {
  --module-accent: #b75f73;
  position: relative;
  isolation: isolate;
  height: calc(100vh - 118px);
  min-height: 620px;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  margin-top: 16px;
  padding: 24px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur)) saturate(1.1);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.1);
}

.music-page-panel::before {
  content: "";
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--music-detail-color, var(--module-accent));
  transform-origin: left center;
  animation: moduleAccentIn 520ms ease both;
}

.music-page-panel[hidden],
.music-catalog-view[hidden],
.music-album-detail[hidden],
.global-music-player[hidden] {
  display: none;
}

body.music-page-active .wallpaper-showcase,
body.music-page-active .grid-layout {
  display: none;
}

body.music-page-active .music-page-panel {
  animation: dashboardCardIn 360ms ease both;
}

.music-catalog-view {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 22px;
}

.music-page-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.music-page-head h2,
.music-detail-copy h2,
.music-detail-copy h3 {
  margin: 0;
}

.music-page-head > div:first-child > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
}

.music-page-head-side {
  display: flex;
  align-items: center;
  gap: 18px;
}

.music-search-field input {
  width: min(340px, 34vw);
  height: 42px;
  padding: 0 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  outline: none;
}

.music-search-field input:focus {
  border-color: var(--module-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--module-accent) 18%, transparent);
}

.music-album-browser,
.music-detail-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--music-detail-color, var(--module-accent)) transparent;
}

.music-album-browser {
  padding: 6px 10px 30px 2px;
}

.music-album-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 22px;
}

.music-album-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 28px;
  padding: 12px;
  overflow: hidden;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-muted) 88%, transparent);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  animation: moduleItemIn 420ms ease both;
  animation-delay: calc(min(var(--music-index), 8) * 55ms);
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.music-album-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--music-color);
  transform: scaleY(0.28);
  transform-origin: top;
  transition: transform 280ms ease;
}

.music-album-card:hover,
.music-album-card:focus-visible {
  z-index: 2;
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--music-color) 60%, var(--line));
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.2);
  outline: none;
}

.music-album-card:hover::before,
.music-album-card:focus-visible::before {
  transform: scaleY(1);
}

.music-album-art {
  position: relative;
  z-index: 1;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: visible;
  border-radius: 5px;
  background: var(--music-color);
}

.music-album-art > img,
.music-album-art > span:first-child {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  object-fit: cover;
  overflow: hidden;
  border-radius: inherit;
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  transition: transform 300ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.music-album-disc {
  position: absolute;
  z-index: 0;
  top: 8%;
  right: -22%;
  width: 84%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: #20242b;
  box-shadow: inset 0 0 0 16px #171a20, inset 0 0 0 18px rgba(255, 255, 255, 0.08);
  transition: transform 380ms cubic-bezier(0.2, 0.75, 0.25, 1), right 380ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.music-album-disc i {
  width: 25%;
  aspect-ratio: 1;
  border: 7px solid var(--music-color);
  border-radius: 50%;
  background: #e6e9ee;
}

.music-album-card:hover .music-album-disc,
.music-album-card:focus-visible .music-album-disc {
  right: -34%;
  transform: rotate(38deg);
}

.music-album-card:hover .music-album-art > img,
.music-album-card:focus-visible .music-album-art > img {
  transform: translateX(-4px) scale(1.025);
}

.music-album-play {
  position: absolute;
  z-index: 3;
  inset: auto 8px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  color: #fff;
  border-radius: 4px;
  background: rgba(12, 16, 22, 0.76);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 700;
  opacity: 0;
  transform: translateY(7px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.music-album-card:hover .music-album-play,
.music-album-card:focus-visible .music-album-play {
  opacity: 1;
  transform: translateY(0);
}

.music-album-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
}

.music-album-copy > span:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.music-album-copy small,
.music-album-copy time,
.music-album-copy em,
.music-album-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-album-copy small {
  color: var(--music-color);
  font-weight: 800;
  text-transform: uppercase;
}

.music-album-copy strong {
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-album-meta {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.music-album-meta b {
  padding: 0 6px;
  color: var(--music-color);
}

.music-empty {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.music-album-detail {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  animation: moduleGameDetailIn 360ms ease both;
}

.music-detail-toolbar {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.music-detail-toolbar button {
  min-width: 0;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  cursor: pointer;
}

.music-detail-toolbar > div {
  min-width: 0;
}

.music-detail-toolbar > div span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-detail-toolbar > b {
  color: var(--music-detail-color, var(--module-accent));
  font-size: 0.76rem;
  letter-spacing: 0;
}

.music-detail-scroll {
  padding: 8px 10px 28px 2px;
}

.music-detail-hero {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  min-height: 330px;
  padding: 20px clamp(16px, 4vw, 52px) 34px;
  border-bottom: 1px solid var(--line);
}

.music-detail-cover {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--music-detail-color, var(--module-accent)) 38%, var(--line));
  border-radius: 6px;
  color: #fff;
  background: var(--music-detail-color, var(--module-accent));
  box-shadow: 18px 18px 0 color-mix(in srgb, var(--music-detail-color, var(--module-accent)) 14%, transparent), var(--shadow);
  font-size: 3rem;
}

.music-detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-detail-copy {
  min-width: 0;
  display: grid;
  justify-items: start;
  gap: 9px;
}

.music-detail-genre {
  margin: 0;
  color: var(--music-detail-color, var(--module-accent));
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.music-detail-copy h2 {
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.04;
}

.music-detail-copy h3 {
  color: var(--music-detail-color, var(--module-accent));
  font-size: 1.25rem;
}

.music-detail-copy > p:not(.music-detail-genre) {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.music-detail-facts {
  display: flex;
  gap: 16px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.78rem;
}

.music-play-album {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 9px;
  padding: 0 18px;
  color: #fff;
  border: 0;
  border-radius: 21px;
  background: var(--music-detail-color, var(--module-accent));
  cursor: pointer;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--music-detail-color, var(--module-accent)) 28%, transparent);
}

.music-track-list {
  padding: 22px 0;
}

.music-track-head,
.music-track-row {
  display: grid;
  grid-template-columns: 54px minmax(220px, 1.6fr) minmax(150px, 1fr) 84px;
  align-items: center;
  gap: 12px;
}

.music-track-head {
  padding: 0 14px 10px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.music-track-row {
  width: 100%;
  min-height: 62px;
  padding: 8px 14px;
  color: var(--text);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  transition: background-color 180ms ease, transform 180ms ease;
}

.music-track-row:hover,
.music-track-row:focus-visible,
.music-track-row.active {
  background: color-mix(in srgb, var(--music-detail-color, var(--module-accent)) 11%, transparent);
  outline: none;
}

.music-track-row:hover {
  transform: translateX(4px);
}

.music-track-number i {
  display: none;
  color: var(--music-detail-color, var(--module-accent));
  font-style: normal;
}

.music-track-row:hover .music-track-number b,
.music-track-row.active .music-track-number b {
  display: none;
}

.music-track-row:hover .music-track-number i,
.music-track-row.active .music-track-number i {
  display: inline;
}

.music-track-name {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.music-track-name strong,
.music-track-name small,
.music-track-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-track-name small,
.music-track-artist,
.music-track-row time,
.music-track-number {
  color: var(--muted);
  font-size: 0.76rem;
}

.music-track-row.active .music-track-name strong {
  color: var(--music-detail-color, var(--module-accent));
}

.global-music-player {
  --player-color: var(--accent);
  position: fixed;
  z-index: 80;
  left: calc(50% + 136px);
  bottom: 18px;
  width: min(calc(100vw - 340px), 980px);
  min-height: 72px;
  display: grid;
  grid-template-columns: 50px minmax(140px, 1fr) auto minmax(220px, 1.35fr) auto;
  align-items: center;
  gap: 13px;
  padding: 10px 42px 10px 12px;
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--player-color) 40%, var(--line));
  background: color-mix(in srgb, var(--surface) 94%, var(--player-color) 6%);
  box-shadow: 0 20px 46px rgba(8, 15, 24, 0.3);
  transform: translateX(-50%);
  animation: musicPlayerIn 320ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

body.sidebar-collapsed .global-music-player {
  left: 50%;
  width: min(calc(100vw - 56px), 980px);
}

.music-player-close {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 1.15rem;
}

.music-player-close:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.music-player-cover {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  border-radius: 5px;
  background: var(--player-color);
  font-size: 1.3rem;
}

.music-player-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-player-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.music-player-copy strong,
.music-player-copy span,
.music-player-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-player-copy span,
.music-player-copy small {
  color: var(--muted);
  font-size: 0.72rem;
}

.music-player-copy small {
  color: var(--player-color);
  font-weight: 700;
}

.global-music-player.queue-finished .music-player-toggle {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--player-color) 18%, transparent);
}

.music-player-transport,
.music-player-timeline,
.music-player-volume {
  display: flex;
  align-items: center;
}

.music-player-transport {
  gap: 4px;
}

.music-player-transport button,
.music-player-volume button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.music-player-transport button:hover,
.music-player-volume button:hover {
  background: var(--surface-muted);
}

.music-player-transport .music-player-toggle {
  color: #fff;
  background: var(--player-color);
}

.music-player-timeline {
  min-width: 0;
  gap: 8px;
}

.music-player-timeline span {
  width: 34px;
  color: var(--muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.music-player-timeline input,
.music-player-volume input {
  min-width: 0;
  height: 4px;
  cursor: pointer;
}

.music-player-timeline input {
  flex: 1;
}

.music-player-volume {
  gap: 4px;
}

.music-player-volume input {
  width: 72px;
}

body.dark .music-album-card {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(31, 41, 55, 0.82);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

body.dark .global-music-player {
  background: color-mix(in srgb, #161e29 94%, var(--player-color) 6%);
}

body.music-player-open .music-album-browser,
body.music-player-open .music-detail-scroll,
body.music-player-open .photo-album-browser,
body.music-player-open .photo-explorer-grid,
body.music-player-open .game-scroll-area,
body.music-player-open .module-game-detail-scroll,
body.music-player-open .tool-catalog-view,
body.music-player-open .converter-workspace,
body.music-player-open .resume-viewport {
  padding-bottom: 110px;
}

/* Keep photo filenames attached to their thumbnails in the explorer grid. */
.photo-explorer {
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.photo-explorer-grid {
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
}

.photo-file-item {
  height: auto;
  align-self: start;
  grid-template-rows: auto auto auto;
  align-content: start;
}

@keyframes musicPlayerIn {
  from { opacity: 0; transform: translate(-50%, 18px) scale(0.98); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@media (max-width: 1360px) {
  .music-album-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .global-music-player {
    grid-template-columns: 48px minmax(120px, 1fr) auto minmax(180px, 1fr);
  }

  .music-player-volume {
    display: none;
  }
}

@media (max-width: 880px) {
  .music-page-panel {
    height: calc(100vh - 92px);
    min-height: 540px;
    padding: 16px;
  }

  .music-page-head,
  .music-page-head-side {
    flex-direction: column;
    align-items: stretch;
  }

  .music-page-head-side {
    gap: 10px;
  }

  .music-search-field,
  .music-search-field input {
    width: 100%;
  }

  .music-album-grid {
    grid-template-columns: 1fr;
  }

  .music-detail-hero {
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 24px;
    min-height: 240px;
    padding-inline: 8px;
  }

  .music-track-head,
  .music-track-row {
    grid-template-columns: 42px minmax(0, 1fr) 70px;
  }

  .music-track-head span:nth-child(3),
  .music-track-row .music-track-artist {
    display: none;
  }

  .global-music-player,
  body.sidebar-collapsed .global-music-player {
    left: 12px;
    right: 12px;
    bottom: 10px;
    width: auto;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    padding-right: 38px;
    transform: none;
  }

  .music-player-timeline {
    grid-column: 1 / -1;
    width: 100%;
  }

  @keyframes musicPlayerIn {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}

@media (max-width: 560px) {
  .music-album-card {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 18px;
  }

  .music-detail-toolbar > b,
  .music-detail-toolbar > div {
    display: none;
  }

  .music-detail-toolbar {
    grid-template-columns: auto;
  }

  .music-detail-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .music-detail-cover {
    width: min(72vw, 260px);
  }

  .music-detail-copy {
    justify-items: center;
  }

  .music-player-cover {
    display: none;
  }

  .global-music-player,
  body.sidebar-collapsed .global-music-player {
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto 28px;
    grid-template-areas:
      "copy transport close"
      "timeline timeline timeline";
    gap: 8px 6px;
    padding: 10px 9px 9px 12px;
  }

  .music-player-close {
    position: static;
    grid-area: close;
    align-self: start;
    width: 28px;
    height: 28px;
  }

  .music-player-copy {
    grid-area: copy;
    gap: 2px;
  }

  .music-player-copy strong {
    font-size: 0.82rem;
  }

  .music-player-copy span,
  .music-player-copy small {
    font-size: 0.66rem;
  }

  .music-player-transport {
    grid-area: transport;
  }

  .music-player-transport button {
    width: 31px;
    height: 31px;
  }

  .music-player-timeline {
    grid-area: timeline;
    gap: 6px;
  }

  .music-player-timeline span {
    width: 30px;
    font-size: 0.62rem;
  }

  body.music-player-open .music-album-browser,
  body.music-player-open .music-detail-scroll,
  body.music-player-open .photo-album-browser,
  body.music-player-open .photo-explorer-grid,
  body.music-player-open .game-scroll-area,
  body.music-player-open .module-game-detail-scroll,
  body.music-player-open .tool-catalog-view,
  body.music-player-open .converter-workspace,
  body.music-player-open .resume-viewport {
    padding-bottom: 128px;
  }
}

body.dark .game-page-panel .game-meta {
  border-top-color: rgba(204, 222, 235, 0.16);
}

body.game-page-active .game-page-panel {
  animation: dashboardCardIn 360ms ease both;
}

body.anime-resource-page-active .anime-resource-page-panel {
  animation: dashboardCardIn 360ms ease both;
}

.game-page-panel .game-pagination button,
.game-page-panel .game-pagination span {
  color: var(--text);
  background: var(--surface-muted);
  border-color: var(--line);
}

.game-page-panel .game-pagination button.active {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

@keyframes dashboardCardIn {
  from {
    opacity: 0;
    transform: translate3d(0, 22px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* The reveal animation also writes transform on the sidebar. Keep the mobile
   drawer state authoritative after that entrance animation has finished. */
@media (max-width: 1080px) {
  body:not(.nav-open) .sidebar[data-reveal],
  body.sidebar-collapsed:not(.nav-open) .sidebar[data-reveal] {
    transform: translateX(-104%);
  }

  body.nav-open .sidebar[data-reveal] {
    transform: translateX(0);
  }
}
