:root {
  --desktop-bg: #008080;
  --window-bg: #c0c0c0;
  --panel-bg: #ffffff;
  --surface-bg: #f1f1f1;
  --input-bg: #ffffff;
  --title-bg: #000080;
  --title-text: #ffffff;
  --border-light: #ffffff;
  --border-dark: #808080;
  --border-black: #000000;
  --text: #111111;
  --text-muted: #333333;
  --accent-text: #000080;
  --control-text: #000000;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "MS Sans Serif", Tahoma, sans-serif;
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  background: var(--desktop-bg);
  color-scheme: light;
}

body[data-theme="dark"] {
  --desktop-bg: #101826;
  --window-bg: #273041;
  --panel-bg: #1a2230;
  --surface-bg: #20293a;
  --input-bg: #111827;
  --title-bg: #0c1220;
  --title-text: #eef2ff;
  --border-light: #5f6b85;
  --border-dark: #050910;
  --border-black: #000000;
  --text: #e5e9f2;
  --text-muted: #b0b9cb;
  --accent-text: #89a8ff;
  --control-text: #f3f6ff;
  color-scheme: dark;
}

body[data-theme="light"] {
  color-scheme: light;
}

.boot-splash {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 12%, rgba(0, 224, 255, 0.15), transparent 34%),
    radial-gradient(circle at 86% 85%, rgba(96, 34, 228, 0.22), transparent 38%),
    linear-gradient(165deg, #071125 0%, #111829 50%, #0a111f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  overflow: hidden;
}

.boot-splash.is-completing {
  animation: boot-splash-fade 560ms ease forwards;
}

.boot-splash.is-paused .boot-progress-shine,
.boot-splash.is-paused .boot-cursor {
  animation-play-state: paused;
}

.boot-splash.is-paused .boot-led {
  background: #f3c66b;
  box-shadow: 0 0 14px rgba(243, 198, 107, 0.9);
}

.boot-splash.is-bypassing .boot-led {
  background: #7ef3ff;
  box-shadow: 0 0 18px #7ef3ff, 0 0 28px #00f5ff;
}

.boot-splash.is-bypassing .boot-status,
.boot-splash.is-bypassing .boot-percent {
  color: #b7fcff;
  text-shadow: 0 0 8px rgba(126, 243, 255, 0.8);
}

.boot-splash.is-bypassing .boot-progress {
  animation: boot-bypass-pulse 540ms ease-in-out infinite alternate;
}

.boot-splash.is-completing .boot-grid-overlay {
  animation: boot-grid-sweep 560ms ease forwards;
}

.boot-terminal-frame {
  position: relative;
  width: min(900px, 94vw);
  max-height: calc(100vh - 28px);
  background: #1a2233;
  border-top: 2px solid #c4ccd8;
  border-left: 2px solid #c4ccd8;
  border-right: 2px solid #434f61;
  border-bottom: 2px solid #434f61;
  box-shadow: 0 26px 64px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.boot-splash.is-completing .boot-terminal-frame {
  animation: boot-frame-exit 560ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.boot-crt {
  position: relative;
  overflow: hidden;
}

.boot-crt::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 60%, rgba(0, 255, 180, 0.08) 100%);
  animation: boot-flicker 0.15s infinite alternate;
  pointer-events: none;
  z-index: 2;
  display: none;
}

.boot-crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(255, 255, 255, 0.07) 2px,
    rgba(255, 255, 255, 0.07) 4px
  );
  animation: boot-scanline 4s linear infinite;
  pointer-events: none;
  z-index: 2;
  display: none;
}

html.crt-effect-active .boot-crt::before,
body.crt-effect-active .boot-crt::before,
html.crt-effect-active .boot-crt::after,
body.crt-effect-active .boot-crt::after {
  display: block;
}

.boot-grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 224, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 224, 255, 0.08) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.34;
  pointer-events: none;
}

.boot-glow {
  position: absolute;
  inset: -20% 50% auto -14%;
  height: 360px;
  border-radius: 999px;
  background: rgba(0, 224, 255, 0.15);
  filter: blur(70px);
  pointer-events: none;
}

.boot-header {
  position: relative;
  z-index: 3;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: linear-gradient(180deg, #202d45 0%, #172238 100%);
  border-bottom: 1px solid #3a485f;
  color: #dce5f7;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.boot-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.boot-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #1df2ff;
  box-shadow: 0 0 14px rgba(29, 242, 255, 0.9);
}

.boot-header-title {
  font-weight: 700;
}

.boot-header-right {
  color: #97abcf;
  font-size: 11px;
}

.boot-body {
  position: relative;
  z-index: 3;
  padding: 20px;
}

.boot-branding {
  margin-bottom: 16px;
}

.boot-branding-title {
  color: #e4c278;
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.boot-branding-subtitle {
  margin-top: 6px;
  font-size: 11px;
  color: #8aa2cc;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.boot-progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.boot-status {
  color: #7ef3ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.boot-percent {
  color: #7ef3ff;
  font-size: 22px;
  font-weight: 700;
}

.boot-bar-shell {
  height: 24px;
  margin-top: 8px;
  margin-bottom: 14px;
  background: #0f1a2b;
  border-top: 2px solid #0a0f19;
  border-left: 2px solid #0a0f19;
  border-right: 2px solid #293b56;
  border-bottom: 2px solid #293b56;
  padding: 3px;
}

.boot-progress {
  position: relative;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #00f5ff 0%, #00f5ff 50%, #7ef3ff 100%);
  box-shadow:
    0 0 12px #00f5ff,
    0 0 24px #00f5ff,
    0 0 40px #00f5ff;
  transition: width 420ms cubic-bezier(0.23, 1, 0.32, 1);
  overflow: hidden;
}

.boot-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: boot-shimmer 1.8s linear infinite;
}

.boot-progress-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(95deg, transparent 0%, rgba(255, 255, 255, 0.4) 48%, transparent 100%);
  animation: boot-shine 1.8s linear infinite;
}

.boot-log {
  height: 172px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 10px 12px;
  background: rgba(8, 15, 26, 0.9);
  border-top: 2px solid #0a0f19;
  border-left: 2px solid #0a0f19;
  border-right: 2px solid #293b56;
  border-bottom: 2px solid #293b56;
  color: #c7d6f2;
  font-size: 12px;
  line-height: 1.35;
}

.boot-log > div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}

.boot-log > div:last-child {
  margin-bottom: 0;
}

.boot-cursor {
  display: inline-block;
  width: 8px;
  height: 13px;
  margin-left: 4px;
  background: #35e3ff;
  vertical-align: -2px;
  animation: boot-cursor-blink 1s step-end infinite;
}

.boot-footer {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #9eb0cf;
  font-size: 11px;
}

.boot-footer-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.boot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ce7fb;
  box-shadow: 0 0 10px rgba(44, 231, 251, 0.8);
}

@keyframes boot-cursor-blink {
  from,
  to {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

@keyframes boot-shine {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(120%);
  }
}

@keyframes boot-scanline {
  0% {
    transform: translateY(-100%);
  }

  100% {
    transform: translateY(100%);
  }
}

@keyframes boot-flicker {
  0% {
    opacity: 0.85;
  }

  100% {
    opacity: 1;
  }
}

@keyframes boot-shimmer {
  0% {
    transform: translateX(-150%);
  }

  100% {
    transform: translateX(400%);
  }
}

@keyframes boot-bypass-pulse {
  0% {
    filter: saturate(1) brightness(1);
    box-shadow:
      0 0 12px #00f5ff,
      0 0 24px #00f5ff,
      0 0 40px #00f5ff;
  }

  100% {
    filter: saturate(1.2) brightness(1.18);
    box-shadow:
      0 0 18px #7ef3ff,
      0 0 34px #00f5ff,
      0 0 56px #00f5ff;
  }
}

@keyframes boot-frame-exit {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }

  100% {
    opacity: 0;
    transform: scale(1.02) translateY(-14px);
    filter: blur(2px);
  }
}

@keyframes boot-grid-sweep {
  0% {
    opacity: 0.34;
  }

  100% {
    opacity: 0;
  }
}

@keyframes boot-splash-fade {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

/* ── Global CRT Screen Effect ────────────────────────────────── */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
  overflow: hidden;
  display: none;
}

html.crt-effect-active .crt-overlay,
body.crt-effect-active .crt-overlay {
  display: block;
}

.crt-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0px,
    rgba(255, 255, 255, 0) 2px,
    rgba(0, 0, 0, 0.16) 2px,
    rgba(0, 0, 0, 0.16) 4px
  );
  pointer-events: none;
  z-index: 1;
}

.crt-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 62%,
    rgba(0, 0, 0, 0.25) 86%,
    rgba(0, 0, 0, 0.55) 100%
  );
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 2;
}

.crt-flicker {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 65%, rgba(0, 255, 180, 0.025) 100%);
  animation: crt-flicker-pulse 0.15s infinite alternate;
  pointer-events: none;
  z-index: 3;
}

.crt-beam {
  position: absolute;
  top: -100%;
  left: 0;
  right: 0;
  height: 35%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 255, 255, 0.035) 50%,
    transparent 100%
  );
  animation: crt-beam-sweep 7s linear infinite;
  pointer-events: none;
  z-index: 4;
}

@keyframes crt-flicker-pulse {
  0% {
    opacity: 0.95;
  }
  100% {
    opacity: 1;
  }
}

@keyframes crt-beam-sweep {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(400vh);
  }
}

.desktop {
  height: calc(100vh - 36px);
  position: relative;
  padding: 8px;
  background-color: #000;
  background-image: none;
  overflow: hidden;
}

.desktop-wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.65;
}

.desktop-wallpaper-media {
  width: 100%;
  height: 100%;
  border: 0;
}

.desktop-wallpaper-media {
  position: absolute;
  inset: 0;
}

#desktop-wallpaper-image {
  object-fit: cover;
}

/* Desktop Icons */
.desktop-icons {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  pointer-events: none;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 104px;
  height: 104px;
  position: absolute;
  padding: 4px 6px;
  background: transparent;
  border: 2px solid transparent;
  cursor: pointer;
  touch-action: none;
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
}

.desktop-icon img {
  width: auto;
  height: auto;
  max-width: 76px;
  max-height: 76px;
  object-fit: contain;
  display: block;
  image-rendering: pixelated;
}

.desktop-icon::after {
  content: attr(title);
  margin-top: 4px;
  width: 100%;
  text-align: center;
  font-size: 12px;
  line-height: 1.15;
  color: #f4f7ff;
  text-shadow: 1px 1px 0 #000;
  white-space: normal;
  overflow-wrap: anywhere;
}

.desktop-icon:focus,
.desktop-icon.selected {
  border-color: var(--title-bg, #000080);
  background: rgba(0, 0, 128, 0.18);
  outline: 1px dotted var(--title-text);
  outline-offset: -3px;
}

.desktop-icon:hover {
  background: rgba(0, 0, 128, 0.1);
  border-color: rgba(0, 0, 128, 0.4);
}

.desktop-icon.dragging {
  opacity: 0.92;
}

.mobile-home-shell {
  display: none;
}

.mobile-home-header {
  display: none;
}

.mobile-launcher-grid {
  display: none;
}

.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 99;
}

.window,
.titlebar,
.taskbar,
.start-btn,
.win-btn,
.win-input,
.control,
.menu-item,
.inset {
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
}

.window {
  position: absolute;
  background: var(--window-bg);
  display: flex;
  flex-direction: column;
  min-width: 300px;
  min-height: 160px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}

.resize-grip {
  width: 16px;
  height: 16px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: nwse-resize;
  z-index: 1;
}

.resize-footer {
  height: 18px;
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  padding-right: 2px;
  padding-bottom: 1px;
  background: var(--window-bg);
  border-top: 1px solid #a8a8a8;
}

.resize-preview-frame {
  position: absolute;
  pointer-events: none;
  box-sizing: border-box;
  border: 1px dashed #000080;
  background: rgba(0, 0, 128, 0.08);
  z-index: 920;
}

.resize-grip::before {
  content: "\25E2";
	position: relative;
	right: 0;
	bottom: 0;
  font-size: 14px;
  line-height: 1;
  color: #000080;
  font-weight: 700;
  pointer-events: none;
}

.titlebar {
  background: linear-gradient(90deg, #000080 0%, #1084d0 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  cursor: move;
  -webkit-user-select: none;
  user-select: none;
}

.window.is-inactive .titlebar {
  background: linear-gradient(90deg, #707070 0%, #a0a0a0 100%);
  color: #d0d0d0;
}

.titlebar-text {
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 12px;
}

.window-controls {
  display: flex;
  gap: 4px;
}

.control {
  min-width: 22px;
  height: 20px;
  background: var(--window-bg);
  color: var(--control-text);
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
}

.control:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.window-body {
  flex: 1;
  overflow: auto;
  padding: 10px;
  background: var(--window-bg);
}

.dev-placeholder-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 140px;
}

.dev-placeholder-title {
  font-size: 13px;
  font-weight: 700;
}

.dev-placeholder-copy {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.window.is-resizing {
  will-change: width, height;
}

.window.is-resizing .window-body {
  overflow: hidden;
}

.window.is-resizing * {
  transition: none !important;
}

/* ── Virtual Tabletop / Online Game Board ───────────────────────────────── */

.game-board-container {
  width: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
  position: relative;
}

.game-board-mobile-nav {
  display: none;
}

.game-board-content-area {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  position: relative;
}

.board-view-wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.board-canvas-container {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: auto;
  display: flex;
  background: #1c1c1c;
  position: relative;
  min-height: 0;
  touch-action: none;
}

.map-tools-panel {
  width: 360px;
  min-width: 360px;
  height: 100%;
  border-left: 1px solid #999;
  background: #e8e8e8;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
  overflow-y: auto;
  box-sizing: border-box;
}

.game-board-floating-toolbar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  gap: 6px;
  background: rgba(192, 192, 192, 0.96);
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
  padding: 4px 6px;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.55);
  max-width: calc(100% - 16px);
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: auto;
}

.gb-quick-tools,
.gb-quick-zoom {
  display: flex;
  gap: 3px;
  align-items: center;
}

.gb-quick-tools .win-btn,
.gb-quick-zoom .win-btn {
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 700;
  min-height: 28px;
}

.gb-quick-tools .win-btn.active {
  background: #000080;
  color: #fff;
  border-top: 2px solid #000;
  border-left: 2px solid #000;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}

.gb-zoom-label {
  font-size: 11px;
  font-weight: 700;
  color: #000;
  background: #fff;
  border-top: 1px solid var(--border-dark);
  border-left: 1px solid var(--border-dark);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 2px 6px;
  min-width: 38px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.game-board-placement-banner {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffc0;
  border: 2px solid #000080;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #000;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  max-width: calc(100% - 16px);
}

.game-board-placement-banner .win-btn {
  padding: 2px 8px;
  font-size: 11px;
}

.collapse-tools-btn {
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

@media (orientation: portrait), (max-width: 600px) {
  .hidden-portrait {
    display: none !important;
  }
}

/* ── Soundboard ─────────────────────────────────────────────────────────── */

.soundboard-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 6px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.soundboard-category-title {
  margin: 8px 0 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text, #000);
}

.soundboard-tile-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  text-align: left;
  min-height: 36px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  font-size: 11px;
  background: var(--surface-bg, #c0c0c0);
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
}

.soundboard-tile-btn:active {
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

.soundboard-tile-btn .soundboard-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.soundboard-tile-btn .soundboard-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.inline-label {
  font-size: 12px;
  font-weight: 700;
}

.mode-group,
.element-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.win-btn,
.start-btn,
.menu-item {
  background: var(--window-bg);
  color: var(--text);
  cursor: pointer;
  padding: 4px 10px;
  font-size: 12px;
}

.win-btn.primary {
  font-weight: 700;
}

.win-btn.active {
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

.win-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.win-input {
  width: 68px;
  padding: 4px;
  background: var(--input-bg);
  color: var(--text);
}

.inset {
  background: var(--panel-bg);
  padding: 8px;
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.result-panel,
.tip-panel {
  background: var(--window-bg);
}

.result-image-wrap {
  width: 188px;
  height: 188px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-bg);
  border: 1px solid #777;
}

.result-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  display: none;
}

.fallback-value {
  font-size: 56px;
  font-weight: 700;
}

.result-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.result-subtitle {
  font-size: 12px;
}

.dice-display {
  width: fit-content;
  max-width: 100%;
  height: auto;
  margin: 0 auto 8px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding: 12px;
  background: var(--surface-bg);
  border: 1px solid #777;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
}

.dice-display img {
  width: 80px;
  height: 80px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.tip-panel h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.tip-panel {
  margin-top: 10px;
}

.tip-panel p {
  margin: 0 0 8px;
  font-size: 12px;
}

/* ─── Dice Roller Components ─────────────────────────────── */

/* Reroll counter badge in toolbar */
.dice-reroll-badge {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
  padding: 2px 6px;
  background: var(--surface-bg);
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}


/* Critical Hit banner */
.dice-crit-indicator {
  padding: 6px 10px;
  margin-bottom: 6px;
  background: #8b0000;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  line-height: 1.4;
  border-top: 2px solid rgba(255,255,255,0.3);
  border-left: 2px solid rgba(255,255,255,0.3);
  border-right: 2px solid rgba(0,0,0,0.5);
  border-bottom: 2px solid rgba(0,0,0,0.5);
}

/* Perfect Defense banner */
.dice-perfect-defense {
  padding: 6px 10px;
  margin-bottom: 6px;
  background: #000080;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  line-height: 1.4;
  border-top: 2px solid rgba(255,255,255,0.3);
  border-left: 2px solid rgba(255,255,255,0.3);
  border-right: 2px solid rgba(0,0,0,0.5);
  border-bottom: 2px solid rgba(0,0,0,0.5);
}

/* Collapsible Roll Log section */
.dice-log-section {
  margin-top: 8px;
  flex-shrink: 0;
}

.dice-log-toggle {
  width: 100%;
  text-align: left;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: var(--panel-bg);
  color: var(--text);
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
  -webkit-user-select: none;
  user-select: none;
}

.dice-log-toggle:hover {
  background: rgba(0, 0, 128, 0.07);
}

.dice-log-body {
  background: var(--panel-bg);
  padding: 6px 8px;
  border: 1px solid var(--border-dark);
  border-top: none;
  max-height: 120px;
  overflow-y: auto;
}

.dice-log-gamelog-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.dice-log-gamelog-hint a {
  color: var(--accent-text, #000080);
  text-decoration: underline;
  cursor: pointer;
}

#roll-log {
  margin: 0;
  padding-left: 16px;
  font-size: 11px;
}

#roll-log li {
  margin-bottom: 3px;
  line-height: 1.3;
}

/* ─── Dice Roller — Split Layout & High-Density UI ──────────────────────── */

/* Window body becomes an edge-to-edge column with no unused silver void */
.app-window[data-window="dice-roller"] .window-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  height: 100%;
  padding: 6px;
  overflow: hidden;
  box-sizing: border-box;
}

/* Toolbar rows */
.app-window[data-window="dice-roller"] .toolbar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.app-window[data-window="dice-roller"] .inline-label {
  flex-shrink: 0;
  font-size: 11px;
}

.app-window[data-window="dice-roller"] .dice-reroll-badge {
  margin-left: auto;
  font-size: 11px;
}

/* Split container for wide desktop */
.app-window[data-window="dice-roller"] .dice-split-container {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 6px;
  width: 100%;
  margin-top: 2px;
}

/* Left main column: Result Well */
.app-window[data-window="dice-roller"] .dice-main-col {
  flex: 1 1 56%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.app-window[data-window="dice-roller"] .dice-main-col .result-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 8px;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  box-sizing: border-box;
  background: var(--surface-bg, #f1f1f1);
}

/* Empty state preview */
.app-window[data-window="dice-roller"] .dice-empty-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0.75;
  padding: 16px 0;
}

.app-window[data-window="dice-roller"] .dice-empty-preview.hidden {
  display: none !important;
}

.app-window[data-window="dice-roller"] .dice-empty-box {
  width: 52px;
  height: 52px;
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
  background: var(--window-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

/* Dice display */
.app-window[data-window="dice-roller"] .dice-display {
  width: 100%;
  max-width: 100%;
  margin: 0 0 6px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 8px;
}

.app-window[data-window="dice-roller"] .result-title {
  text-align: center;
  margin-bottom: 3px;
  font-size: 13px;
}

.app-window[data-window="dice-roller"] .result-subtitle {
  text-align: center;
  font-size: 11px;
}

/* Crit & Perfect Defense indicators */
.app-window[data-window="dice-roller"] .dice-crit-indicator,
.app-window[data-window="dice-roller"] .dice-perfect-defense {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 6px;
}

/* Right Column: Persistent Sunken Roll History */
.app-window[data-window="dice-roller"] .dice-log-col {
  flex: 1 1 44%;
  display: flex;
  flex-direction: column;
  min-width: 210px;
  min-height: 0;
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  background: var(--panel-bg);
}

.app-window[data-window="dice-roller"] .dice-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  background: var(--window-bg);
  border-bottom: 1px solid var(--border-dark);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.app-window[data-window="dice-roller"] .dice-log-count-badge {
  font-size: 10px;
  font-weight: normal;
  color: var(--text-muted);
}

.app-window[data-window="dice-roller"] .dice-log-body-stream {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 6px;
  min-height: 0;
  background: var(--panel-bg);
}

.app-window[data-window="dice-roller"] .dice-log-body-stream .dice-log-gamelog-hint {
  margin: 0 0 4px;
  font-size: 10px;
  color: var(--text-muted);
  border-bottom: 1px dotted var(--border-dark);
  padding-bottom: 2px;
}

.app-window[data-window="dice-roller"] .dice-log-body-stream ul {
  margin: 0;
  padding-left: 14px;
  list-style-type: square;
}

.app-window[data-window="dice-roller"] .dice-log-body-stream li {
  margin-bottom: 3px;
  line-height: 1.25;
  font-size: 11px;
  font-family: monospace;
}

/* Bottom Status Bar */
.app-window[data-window="dice-roller"] .dice-log-status-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 2px 0;
  font-size: 11px;
  background: var(--window-bg);
  border-top: 1px solid #808080;
  flex-shrink: 0;
}

.app-window[data-window="dice-roller"] .dice-status-segment {
  padding: 1px 6px;
  border-top: 1px solid var(--border-dark);
  border-left: 1px solid var(--border-dark);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  font-size: 11px;
}

.app-window[data-window="dice-roller"] .dice-status-segment.fill {
  flex: 1;
}

/* Mobile & <=900px Responsive Stacking */
@media (max-width: 900px) {
  .app-window[data-window="dice-roller"] .dice-split-container {
    flex-direction: column;
  }
  .app-window[data-window="dice-roller"] .dice-log-col {
    min-height: 110px;
    max-height: 160px;
  }
}





.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.character-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-dark);
  cursor: pointer;
  padding: 6px;
  contain: layout paint;
  content-visibility: auto;
  contain-intrinsic-size: 180px 170px;
}

.character-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  margin-bottom: 6px;
}

.app-window[data-window="arsenal-cards"] .window-body {
  contain: layout paint;
}

.app-window[data-window="arsenal-cards"].is-resizing .character-card img {
  opacity: 0.45;
}

.character-card-title {
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  line-height: 1.2;
}

/* ─── Card Browser High-Density Explorer (Variant 2) ───────────────────── */

.card-browser-window-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 4px;
  overflow: hidden;
  gap: 4px;
  box-sizing: border-box;
}

.card-browser-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 2px 2px;
  flex-shrink: 0;
}

.card-search-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-bg, #fff);
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  padding: 1px 4px;
}

.card-search-icon {
  font-size: 11px;
  -webkit-user-select: none;
  user-select: none;
}

.card-search-input {
  border: none !important;
  font-family: var(--font-win95);
  font-size: 11px;
  padding: 2px;
  outline: none;
  width: 130px;
  background: transparent;
}

.card-filter-group {
  display: flex;
  gap: 2px;
}

.card-filter-group .win-btn {
  font-size: 11px;
  padding: 2px 6px;
}

.card-filter-group .win-btn.active {
  font-weight: 700;
  color: var(--accent-text, #000080);
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  background: var(--window-bg);
}

.card-browser-split {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 6px;
  width: 100%;
}

.card-grid-container {
  flex: 1 1 60%;
  overflow-y: auto;
  padding: 6px;
  background: var(--panel-bg);
  min-height: 0;
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

.character-card.is-selected {
  outline: 2px solid #000080;
  background: rgba(0, 0, 128, 0.12);
}

/* Docked Inspection Pane */
.card-inspection-pane {
  flex: 0 0 250px;
  width: 250px;
  display: flex;
  flex-direction: column;
  background: var(--window-bg);
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  padding: 6px;
  gap: 6px;
  min-height: 0;
  box-sizing: border-box;
}

.inspection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 12px;
  border-bottom: 1px solid var(--border-dark);
  padding-bottom: 3px;
  flex-shrink: 0;
}

.inspection-status-tag {
  font-size: 10px;
  color: var(--text-muted);
  padding: 1px 4px;
  border-top: 1px solid var(--border-dark);
  border-left: 1px solid var(--border-dark);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.inspection-card-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 180px;
  background: #111;
  overflow: hidden;
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  perspective: 1000px;
  flex-shrink: 0;
}

.inspection-actions {
  flex-shrink: 0;
}

.inspection-tactics {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px;
  font-size: 11px;
  background: var(--surface-bg, #fff);
  min-height: 60px;
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

.card-browser-status-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 2px 0;
  font-size: 11px;
  background: var(--window-bg);
  border-top: 1px solid #808080;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .card-browser-split {
    flex-direction: column;
  }
  .card-inspection-pane {
    width: 100%;
    flex: 0 0 auto;
    max-height: 220px;
  }
}

.card-popup {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.card-popup-inner {
  width: min(360px, 100%);
  max-width: 100%;
  height: min(520px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
}

.card-popup-inner.is-maximized {
  width: 100%;
  height: 100%;
}

.card-popup-inner.is-maximized > .window-body {
  padding: 4px;
}

.card-popup-inner > .window-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.card-viewer {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  height: auto;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
}

.card-viewer.is-flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}

.card-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f3f3f3;
}

.card-back {
  transform: rotateY(180deg);
}

.card-popup-actions {
  margin-top: 10px;
  justify-content: flex-end;
}

.card-popup-inner.is-maximized .card-popup-actions {
  margin-top: 6px;
}

.placeholder-box h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.placeholder-box p {
  margin: 0;
  font-size: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  align-items: center;
}

.settings-label {
  font-size: 12px;
  font-weight: 700;
}

.settings-section-title {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-text);
}

.settings-select {
  width: 100%;
}

.settings-checkbox {
  width: 16px;
  height: 16px;
  justify-self: start;
  margin: 0;
}

.settings-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.settings-slider {
  flex: 1;
  height: 18px;
  cursor: pointer;
  accent-color: var(--navy-classic, #000080);
}

.settings-volume-label {
  font-size: 11px;
  font-family: var(--font-mono, "Courier New", monospace);
  font-weight: 700;
  min-width: 36px;
  text-align: right;
  color: var(--text-color, #000000);
}

.settings-actions {
  margin-top: 10px;
}

.music-player-window-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.music-now-playing {
  background: var(--surface-bg);
}

.music-track-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.music-track-meta {
  font-size: 12px;
  margin-bottom: 8px;
}

.music-seek,
.music-volume {
  width: 100%;
}

.music-controls {
  margin-bottom: 0;
}

.music-volume-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.music-volume {
  max-width: 120px;
}

.music-playlist-wrap {
  background: var(--panel-bg);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.music-playlist-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.music-playlist {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 130px;
  overflow: auto;
}

.music-playlist-item {
  margin: 0;
}

.music-playlist-button {
  width: 100%;
  text-align: left;
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
  background: var(--window-bg);
}

.music-playlist-button.active {
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  background: var(--surface-bg);
  font-weight: 700;
}

.floating-music-player {
  position: fixed;
  right: 16px;
  bottom: 74px;
  width: 256px;
  height: auto;
  min-height: 0;
  max-height: 132px;
  z-index: 950;
  background: var(--window-bg);
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
  padding: 6px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.floating-music-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  cursor: move;
}

.floating-music-title {
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-music-meta {
  font-size: 11px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.floating-music-controls {
  display: flex;
  gap: 6px;
}

.floating-music-controls .win-btn,
.floating-music-restore {
  min-height: 24px;
}

.docs-window-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 10px;
  min-height: 0;
}

.docs-folder-pane,
.docs-detail-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel-bg);
}

.docs-pane-title,
.docs-folder-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.docs-actions {
  margin-bottom: 8px;
}

.docs-search-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.docs-search-input {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  background: var(--input-bg);
  font-family: "Courier New", monospace;
  font-size: 12px;
}

.docs-search-summary {
  min-height: 16px;
  font-size: 11px;
  color: var(--text-muted);
}

.docs-folder-list,
.docs-folder-items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
}

.docs-folder-children {
  margin: 6px 0 0;
  padding: 0 0 0 12px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.docs-folder-node.nested .docs-folder-button {
  font-size: 11px;
}

.docs-folder-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  font-size: 12px;
  padding: 6px 8px;
  cursor: pointer;
  background: var(--window-bg);
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
}

.docs-folder-button img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  image-rendering: pixelated;
}

.docs-folder-toggle {
  width: 24px;
  font-size: 10px;
  letter-spacing: -0.2px;
  color: var(--text-muted);
  flex: 0 0 24px;
}

.docs-folder-button.active {
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  background: var(--surface-bg);
  font-weight: 700;
}

.docs-folder-button:disabled,
.docs-actions .win-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.docs-folder-items {
  flex: 1;
  min-height: 0;
}

.docs-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.docs-file-item::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  background: url("Assets/images/icons/Desktop/folder-documents.png") center/contain no-repeat;
  image-rendering: pixelated;
}

.docs-file-item.active {
  background: var(--surface-bg);
  outline: 1px dotted var(--accent-text);
}

.docs-preview-pane {
  margin-top: 10px;
  background: var(--panel-bg);
  min-height: 84px;
}

.docs-preview-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.docs-preview-body {
  font-size: 12px;
  white-space: normal;
  line-height: 1.35;
  max-height: 160px;
  overflow: auto;
}

.docs-file-editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  height: 100%;
}

.docs-file-editor-hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.docs-file-editor {
  width: 100%;
  flex: 1;
  min-height: 140px;
  resize: vertical;
  padding: 8px;
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  background: var(--input-bg);
  color: var(--text);
  font-family: "Courier New", monospace;
  font-size: 12px;
  line-height: 1.4;
}

.character-sheet-window-body {
  min-height: 0;
}

.character-sheet-pane {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
  background: var(--panel-bg);
}

/* Toolbar */
.character-sheet-actions {
  margin-bottom: 0;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border-dark);
  gap: 6px;
  flex-wrap: nowrap;
  align-items: stretch;
}

.character-sheet-tab-group {
  display: flex;
  gap: 2px;
  align-items: stretch;
}

.character-sheet-util-group {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}

.character-sheet-toolbar-divider {
  width: 2px;
  background: var(--border-dark);
  align-self: stretch;
  margin: 0 4px;
  flex-shrink: 0;
}

/* Tab buttons — pressed-in look when active */
.character-sheet-tab {
  font-size: 12px;
  padding: 4px 12px;
  position: relative;
  border-bottom: none;
  z-index: 1;
}

.character-sheet-tab.is-active {
  background: var(--window-bg);
  font-weight: 700;
  color: var(--accent-text);
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

.character-sheet-util-group .win-btn {
  font-size: 11px;
  padding: 3px 8px;
}

/* Status Bar */
.character-sheet-status {
  margin: 6px 0 6px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-bg);
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  min-height: 22px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.character-sheet-status.status-saved {
  color: #006400;
  font-weight: 600;
}

.character-sheet-status.status-error {
  color: #8b0000;
  font-weight: 600;
}

/* Content area */
.character-sheet-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  font-size: 12px;
  line-height: 1.4;
}

/* Section headings inside character sheet */
.character-sheet-content h1,
.character-sheet-content h2,
.character-sheet-content h3,
.character-sheet-content h4 {
  margin: 14px 0 6px;
  padding: 4px 6px 4px 10px;
  border-left: 4px solid #000080;
  background: var(--surface-bg);
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
}

.character-sheet-content h1 {
  font-size: 14px;
  border-left-width: 5px;
  background: var(--window-bg);
}

.character-sheet-content h2 {
  font-size: 13px;
}

.character-sheet-content h3 {
  font-size: 12px;
  border-left-color: var(--border-dark);
  background: transparent;
  color: var(--text-muted);
}

.character-sheet-content h4 {
  font-size: 11px;
  border-left-color: var(--border-dark);
  background: transparent;
  color: var(--text-muted);
}

.character-sheet-content p {
  margin: 4px 0;
  line-height: 1.4;
}

/* Tables */
.character-sheet-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 12px;
  table-layout: fixed;
}

.character-sheet-content thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.character-sheet-content thead th {
  background: #000080;
  color: #ffffff;
  font-weight: 700;
  text-align: left;
  padding: 5px 8px;
  border-right: 1px solid #1a3da0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.character-sheet-content thead th:last-child {
  border-right: none;
}

.character-sheet-content tbody tr:nth-child(even) {
  background: var(--surface-bg);
}

.character-sheet-content tbody tr:nth-child(odd) {
  background: var(--panel-bg);
}

.character-sheet-content tbody tr:hover {
  background: rgba(0, 0, 128, 0.06);
}

.character-sheet-content tbody td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-dark);
  border-right: 1px solid var(--border-dark);
  vertical-align: top;
  min-width: 60px;
  overflow-wrap: break-word;
  font-size: 12px;
}

.character-sheet-content tbody td:last-child {
  border-right: none;
}

/* Editable cells */
.character-sheet-editable-cell {
  background: var(--input-bg);
  cursor: text;
  min-height: 20px;
  outline: 1px solid transparent;
  transition: outline-color 0.1s, background 0.1s;
  border-radius: 0;
}

.character-sheet-editable-cell:hover {
  outline: 1px solid var(--border-dark);
  background: var(--input-bg);
}

.character-sheet-editable-cell:focus {
  outline: 2px solid #000080;
  background: #ffffff;
  color: #000;
}

body[data-theme="dark"] .character-sheet-editable-cell:focus {
  background: #1a2035;
  color: var(--text);
}

/* Skill hide button */
.character-sheet-skill-hide-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  margin-right: 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #8b0000;
  background: var(--window-bg);
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
  border-top: 1px solid var(--border-light);
  border-left: 1px solid var(--border-light);
  border-right: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
}

.character-sheet-skill-hide-btn:hover {
  background: #8b0000;
  color: #ffffff;
}

.character-sheet-skill-hidden {
  display: none;
}

/* ─── Character Sheet Tactical HUD (Variant 2 — Session Density) ───────── */

.character-hud-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px;
}

/* Hunter Dossier header bar */
.hud-dossier-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--panel-bg);
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
}

.hud-field {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
}

.hud-field input[type="text"] {
  font-family: var(--font-win95);
  font-size: 12px;
  padding: 2px 6px;
  background: var(--surface-bg, #fff);
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

/* Vitals HUD grid */
.hud-vitals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 600px) {
  .hud-vitals-grid {
    grid-template-columns: 1fr;
  }
}

.hud-vital-card {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  background: var(--surface-bg, #fff);
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

.hud-vital-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 6px;
}

.hud-vital-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.hud-stepper-btn {
  width: 32px;
  height: 28px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-vital-readout {
  font-family: var(--font-win95-title, Tahoma);
  font-size: 30px;
  font-weight: 700;
  min-width: 52px;
  text-align: center;
  line-height: 1;
}

/* Pip bar */
.hud-pip-bar {
  display: flex;
  gap: 3px;
  height: 12px;
  background: var(--window-bg, #c0c0c0);
  padding: 2px;
  border-top: 1px solid var(--border-dark);
  border-left: 1px solid var(--border-dark);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  overflow: hidden;
}

.hud-pip {
  flex: 1;
  min-width: 4px;
  height: 100%;
  background: #a0a0a0;
}

.hud-pip.active-hp {
  background: #008000;
}

.hud-pip.active-hp.low {
  background: #c00000;
}

.hud-pip.active-san {
  background: #000080;
}

/* Combat & Secondary Stat row */
.hud-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hud-stat-pill {
  flex: 1;
  min-width: 110px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: var(--panel-bg);
  border-top: 1px solid var(--border-light);
  border-left: 1px solid var(--border-light);
  border-right: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
  font-size: 11px;
}

.hud-mini-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hud-mini-stepper button {
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.hud-mini-readout {
  font-weight: 700;
  font-size: 13px;
  min-width: 18px;
  text-align: center;
}

/* Quick Actions toolbar */
.hud-actions-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.hud-action-btn {
  flex: 1;
  min-width: 130px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* Loadout 4-slot grid */
.hud-loadout-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

@media (max-width: 650px) {
  .hud-loadout-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.hud-slot-card {
  display: flex;
  flex-direction: column;
  padding: 5px 8px;
  background: var(--surface-bg, #fff);
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

.hud-slot-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.hud-slot-input {
  border: none;
  font-family: var(--font-win95);
  font-size: 11px;
  padding: 2px 0;
  background: transparent;
  width: 100%;
}

.hud-slot-input:focus {
  outline: 1px dotted #000080;
}

/* Quick Skills compact strip */
.hud-skills-box {
  padding: 6px 8px;
  background: var(--panel-bg);
  border-top: 2px solid var(--border-dark);
  border-left: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

.hud-skills-header {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

.hud-skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 4px;
}

.hud-skill-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  background: var(--surface-bg, #fff);
  border-top: 1px solid var(--border-dark);
  border-left: 1px solid var(--border-dark);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  font-size: 11px;
}

.hud-skill-input {
  width: 36px;
  text-align: center;
  font-size: 11px;
  padding: 1px 2px;
  border-top: 1px solid var(--border-dark);
  border-left: 1px solid var(--border-dark);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}


.docs-viewer-window-body {
  min-height: 0;
  display: flex;
}

.docs-viewer-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
}

.docs-viewer-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.docs-viewer-body {
  max-height: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.docs-plain-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.35;
  font-size: 12px;
}

.docs-markdown {
  color: #111;
  line-height: 1.45;
  font-size: 12px;
}

.docs-markdown h1,
.docs-markdown h2,
.docs-markdown h3,
.docs-markdown h4,
.docs-markdown h5,
.docs-markdown h6 {
  margin: 12px 0 6px;
  line-height: 1.25;
}

.docs-markdown h1 {
  font-size: 18px;
  border-bottom: 2px solid var(--border-dark);
  padding-bottom: 4px;
}

.docs-markdown h2 {
  font-size: 15px;
  border-bottom: 1px solid var(--border-dark);
  padding-bottom: 2px;
}

.docs-markdown h3 {
  font-size: 13px;
}

.docs-markdown p {
  margin: 6px 0;
}

.docs-markdown ul,
.docs-markdown ol {
  margin: 6px 0 6px 20px;
  padding: 0;
}

.docs-markdown li {
  margin: 2px 0;
}

.docs-markdown hr {
  border: 0;
  border-top: 1px solid var(--border-dark);
  margin: 10px 0;
}

.docs-markdown blockquote {
  margin: 8px 0;
  padding: 4px 8px;
  border-left: 3px solid var(--border-dark);
  background: var(--surface-bg);
}

.docs-markdown code {
  background: var(--surface-bg);
  border: 1px solid var(--border-dark);
  padding: 0 2px;
  font-size: 11px;
}

.docs-markdown pre {
  margin: 8px 0;
  padding: 8px;
  border: 1px solid var(--border-dark);
  background: var(--panel-bg);
  overflow: auto;
}

.docs-markdown pre code {
  border: 0;
  background: transparent;
  padding: 0;
  white-space: pre;
}

.docs-markdown a {
  color: var(--accent-text);
  text-decoration: underline;
}

.docs-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.docs-markdown th,
.docs-markdown td {
  border: 1px solid var(--border-dark);
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}

.docs-markdown th {
  background: var(--surface-bg);
}

.docs-folder-description {
  margin: 0 0 8px;
  font-size: 12px;
}

.docs-file-item {
  font-size: 12px;
  padding: 5px 8px;
  background: var(--panel-bg);
  border: 1px solid var(--border-dark);
}

.journal-window-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 6px;
}

.journal-nav-tabs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  border-bottom: 2px solid var(--border-dark);
  padding-bottom: 4px;
}

.journal-mobile-nav-tabs {
  display: none;
  gap: 4px;
  flex-shrink: 0;
  border-bottom: 2px solid var(--border-dark);
  padding-bottom: 4px;
}

.journal-back-btn {
  display: none;
}

.journal-content-row {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.journal-list-pane,
.journal-detail-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel-bg);
  padding: 8px;
}

.journal-toolbar {
  margin-bottom: 6px;
  display: flex;
  gap: 6px;
}

.journal-search-box {
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.journal-search-row {
  display: flex;
  gap: 4px;
}

.journal-search-input {
  flex: 1;
  font-size: 11px;
}

.journal-search-clear-btn {
  padding: 2px 6px;
  font-size: 11px;
}

.journal-mood-filter-select {
  width: 100%;
  font-size: 11px;
  padding: 2px 4px;
}

.journal-search-summary {
  font-size: 10px;
  color: var(--text-muted);
}

.journal-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.journal-item {
  padding: 6px 8px;
  cursor: pointer;
  background: var(--panel-bg);
  border: 1px solid var(--border-dark);
  transition: background 0.1s ease;
}

.journal-item:hover {
  background: var(--surface-bg);
}

/* Win95 Active Navy Selection */
.journal-item.active {
  background: #000080 !important;
  color: #ffffff !important;
  border-color: #000040;
}

.journal-item.active .journal-item-title {
  color: #ffffff !important;
}

.journal-item.active .journal-item-meta {
  color: #d0d0ff !important;
}

.journal-item.active mark {
  background: #ffff00;
  color: #000000;
}

.journal-item-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.2;
}

.journal-item-meta {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.journal-item-category-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 6px;
  background: var(--surface-bg);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-dark);
  margin-top: 6px;
}

.journal-form-grid {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.journal-input {
  width: 100%;
}

.journal-body {
  width: 100%;
  flex: 1;
  min-height: 120px;
  resize: vertical;
  margin-bottom: 6px;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  box-sizing: border-box;
}

.journal-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* Monster Bestiary Detail Pokédex Formatting */
.pokedex-card {
  width: 100%;
  max-width: 780px;
  background: #0d0f14;
  color: #e2e8f0;
  font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border: 2px solid #2a2e3d;
  box-shadow: inset 1px 1px 0 #3a4055, inset -1px -1px 0 #050608, 0 8px 24px rgba(0, 0, 0, 0.7);
  padding: 12px;
  box-sizing: border-box;
  margin: 0 auto;
}

.pokedex-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #18090a 0%, #151824 100%);
  border: 2px solid #8e151b;
  box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.2);
  padding: 8px 12px;
  margin-bottom: 12px;
}

.pokedex-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pokedex-title-text {
  font-size: 20px;
  font-weight: 800;
  color: #ff4d4d;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
  text-shadow: 0 0 8px rgba(255, 50, 50, 0.5);
}

.pokedex-cp-badge {
  background: #8e151b;
  color: #ffffff;
  font-family: 'Courier Prime', monospace;
  font-weight: 800;
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid #ff6666;
  border-radius: 2px;
  letter-spacing: 0.5px;
}

.pokedex-tags-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pokedex-type-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 2px;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
}

.pokedex-type-tag.spirit { background: #3b0764; color: #e9d5ff; border-color: #7e22ce; }
.pokedex-type-tag.undead { background: #450a0a; color: #fecdd3; border-color: #9f1239; }
.pokedex-type-tag.beast { background: #365314; color: #d9f99d; border-color: #4d7c0f; }
.pokedex-type-tag.humanoid { background: #1e3a8a; color: #bfdbfe; border-color: #1d4ed8; }
.pokedex-type-tag.boss { background: #701a75; color: #f5d0fe; border-color: #a21caf; }

.pokedex-variant-selector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  background: #12151f;
  padding: 6px;
  border: 1px solid #232838;
  border-radius: 3px;
  flex-wrap: wrap;
}

.pokedex-variant-tab-btn {
  background: #1a1e2b;
  color: #94a3b8;
  border: 1px solid #334155;
  font-family: 'Work Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pokedex-variant-tab-btn:hover {
  background: #252b3d;
  color: #f1f5f9;
}

.pokedex-variant-tab-btn.active {
  background: #8e151b;
  color: #ffffff;
  border-color: #ff4d4d;
  box-shadow: 0 0 8px rgba(255, 77, 77, 0.4);
}

.pokedex-grid-layout {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 600px) {
  .pokedex-grid-layout {
    grid-template-columns: 1fr;
  }
}

.pokedex-portrait-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pokedex-portrait-frame {
  width: 130px;
  height: 130px;
  background: #000000;
  border: 2px solid #8e151b;
  box-shadow: inset 0 0 12px rgba(255, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.pokedex-portrait-frame img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  transform: scale(1.25);
  transition: transform 0.2s ease;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.9));
}

.pokedex-portrait-frame img.no-zoom {
  transform: scale(1.0);
}

.pokedex-portrait-frame::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
}

.pokedex-audio-btn {
  width: 100%;
  padding: 5px 8px;
  background: #181920;
  color: #ffcc00;
  border: 1px solid #554400;
  font-family: 'Work Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.pokedex-audio-btn:hover {
  background: #2a2b36;
  color: #ffee55;
  border-color: #aa8800;
}

.pokedex-stats-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pokedex-stat-boxes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.pokedex-stat-box {
  background: #14161f;
  border: 1px solid #232736;
  padding: 6px 4px;
  text-align: center;
  border-radius: 2px;
}

.pokedex-stat-box.hp { border-color: #7f1d1d; background: #280d0e; }
.pokedex-stat-box.mv { border-color: #14532d; background: #0b2214; }
.pokedex-stat-box.def { border-color: #1e3a8a; background: #0c1836; }
.pokedex-stat-box.san { border-color: #581c87; background: #200b33; }
.pokedex-stat-box.armor { border-color: #713f12; background: #281807; }

.pokedex-stat-label {
  font-family: 'Courier Prime', monospace;
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.pokedex-stat-box.hp .pokedex-stat-label { color: #fca5a5; }
.pokedex-stat-box.mv .pokedex-stat-label { color: #86efac; }
.pokedex-stat-box.def .pokedex-stat-label { color: #93c5fd; }
.pokedex-stat-box.san .pokedex-stat-label { color: #f0abfc; }
.pokedex-stat-box.armor .pokedex-stat-label { color: #fde047; }

.pokedex-stat-val {
  font-family: 'Courier Prime', monospace;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
}

.pokedex-logic-banner {
  background: #090c10;
  border: 1px solid #1e293b;
  padding: 6px 10px;
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.8);
}

.pokedex-logic-prefix {
  color: #facc15;
  font-weight: 700;
}

.pokedex-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #ff5555;
  border-bottom: 1px solid #441111;
  padding-bottom: 3px;
  margin: 10px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pokedex-moves-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.pokedex-move-card {
  background: #131620;
  border: 1px solid #272d40;
  padding: 8px 10px;
  border-left: 3px solid #ff4444;
}

.pokedex-move-card.melee { border-left-color: #ef4444; }
.pokedex-move-card.range { border-left-color: #3b82f6; }
.pokedex-move-card.special { border-left-color: #eab308; }
.pokedex-move-card.signature { border-left-color: #a855f7; }
.pokedex-move-card.passive { border-left-color: #10b981; }

.pokedex-move-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.pokedex-move-name {
  font-weight: 700;
  font-size: 12px;
  color: #f8fafc;
}

.pokedex-move-badge {
  font-family: 'Courier Prime', monospace;
  font-size: 10px;
  font-weight: 700;
  background: #1e293b;
  color: #facc15;
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid #334155;
}

.pokedex-move-desc {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.35;
}

.pokedex-weakness-card {
  background: #2a1f06;
  border: 1px solid #854d0e;
  border-left: 4px solid #eab308;
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 11px;
  color: #fef08a;
}

.pokedex-unique-card {
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.4;
  border-radius: 2px;
}

.pokedex-unique-card.dread {
  background: #250b0e;
  border: 1px solid #7f1d1d;
  border-left: 4px solid #ef4444;
  color: #fecaca;
}

.pokedex-unique-card.jumpscare {
  background: #271607;
  border: 1px solid #78350f;
  border-left: 4px solid #f59e0b;
  color: #fde68a;
}

.pokedex-unique-card.clues {
  background: #0d1e2b;
  border: 1px solid #1e3a5f;
  border-left: 4px solid #38bdf8;
  color: #bae6fd;
}

.pokedex-lore-card {
  background: #0f1117;
  border: 1px solid #1e2433;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.5;
  font-style: italic;
}

/* Journal Keyword Highlighting for Elements, Buffs, and Debuffs */
.journal-kw-element {
  color: #38bdf8 !important;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}

.journal-kw-buff {
  color: #4ade80 !important;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.journal-kw-debuff {
  color: #ff3333 !important;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(255, 51, 51, 0.5);
}

.pokedex-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.pokedex-index-tile {
  background: #141722;
  border: 1px solid #293047;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pokedex-index-tile:hover {
  background: #1e2436;
  border-color: #ff4d4d;
  transform: translateY(-1px);
}

.pokedex-index-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #000;
  border: 1px solid #3d4766;
  flex-shrink: 0;
}

.pokedex-index-info {
  flex: 1;
  min-width: 0;
}

.pokedex-index-name {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 2px;
}

.pokedex-index-cat {
  font-size: 10px;
  color: #ff9999;
  text-transform: uppercase;
}

.chat-window-body {
  position: relative;
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 10px;
  min-height: 0;
}

.chat-sidebar,
.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel-bg);
}

.chat-section-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--accent-text);
}

.chat-identity {
  font-size: 11px;
  margin-bottom: 8px;
}

.chat-buddy-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  min-height: 0;
}

.chat-buddy-item {
  margin: 0;
}

.chat-buddy-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px;
  cursor: pointer;
  text-align: left;
  background: var(--panel-bg);
  border: 1px solid var(--border-dark);
  font-size: 12px;
}

.chat-buddy-btn.active {
  background: var(--surface-bg);
  outline: 1px dotted var(--accent-text);
}

.chat-buddy-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-presence-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 10px;
  border: 1px solid var(--border-dark);
}

.chat-presence-dot.online {
  background: #29b329;
}

.chat-presence-dot.away {
  background: #d89c00;
}

.chat-presence-dot.offline {
  background: var(--text-muted);
}

.chat-active-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.chat-active-meta {
  min-width: 0;
}

.chat-active-name {
  font-size: 13px;
  font-weight: 700;
}

.chat-active-presence {
  font-size: 11px;
  color: var(--text-muted);
}

.chat-active-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.chat-active-controls .win-btn {
  min-width: 72px;
}

.chat-transcript {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--panel-bg);
  border: 1px solid var(--border-dark);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.chat-line {
  max-width: 86%;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 7px;
  border: 1px solid var(--border-dark);
  font-size: 12px;
  line-height: 1.3;
}

.chat-line.them {
  align-self: flex-start;
  background: color-mix(in srgb, var(--surface-bg) 78%, var(--desktop-bg) 22%);
}

.chat-line.me {
  align-self: flex-end;
  background: color-mix(in srgb, var(--surface-bg) 70%, var(--window-bg) 30%);
}

.chat-line-author {
  font-size: 11px;
  font-weight: bold;
  color: var(--navy, #000080);
  margin-bottom: 2px;
  display: block;
}

.chat-line-time {
  font-size: 10px;
  color: var(--text-muted);
}

.chat-system-line {
  align-self: center;
  width: 100%;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-bg);
  border: 1px dashed var(--border-dark);
  padding: 5px;
}

.chat-typing-line {
  align-self: flex-start;
  max-width: 86%;
  padding: 5px 7px;
  border: 1px dashed var(--border-dark);
  background: var(--surface-bg);
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.chat-typing-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chat-typing-blip 0.9s infinite ease-in-out;
}

.chat-typing-dot:nth-child(2) {
  animation-delay: 0.14s;
}

.chat-typing-dot:nth-child(3) {
  animation-delay: 0.28s;
}

.chat-compose {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-input-label {
  font-size: 11px;
  font-weight: 700;
}

.chat-message-input {
  width: 100%;
}

.chat-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chat-status-line {
  margin-top: 7px;
  font-size: 10px;
  color: var(--text-muted);
}

.chat-mini-popout {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 170px;
  max-height: 240px;
  padding: 6px;
  background: var(--window-bg);
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-mini-popout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #000080;
}

.chat-mini-popout-header .control {
  min-width: 20px;
  height: 18px;
}

.chat-mini-buddy-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: auto;
}

@keyframes chat-typing-blip {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-1px);
  }
}


.taskbar {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 36px;
  background: var(--window-bg);
  padding: 2px 4px;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  z-index: 950;
}

.taskbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.task-buttons {
  display: flex;
  gap: 6px;
  overflow: auto;
  max-width: 70vw;
}

.task-button {
  min-width: 120px;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.start-menu {
  position: fixed;
  left: 6px;
  bottom: 40px;
  width: min(540px, calc(100vw - 12px));
  background: var(--window-bg);
  padding: 6px 6px 6px 32px;
  z-index: 960;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}

.start-menu-sidebar {
  position: absolute;
  left: 3px;
  top: 3px;
  bottom: 3px;
  width: 24px;
  background: linear-gradient(180deg, #000080 0%, #1084d0 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  box-sizing: border-box;
}

.start-menu-sidebar-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #ffffff;
  font-family: var(--font-win);
  font-size: 13px;
  font-weight: normal;
  letter-spacing: 0.12em;
  text-shadow: 1px 1px 0 #000000;
  -webkit-user-select: none;
  user-select: none;
}

.start-menu-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.start-menu-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.start-menu-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #000080;
  padding-left: 2px;
}

.start-menu-group,
.start-menu-recent {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.start-menu-recent {
  min-height: 80px;
}

.start-menu-empty {
  padding: 8px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-bg);
  border: 1px dashed var(--border-dark);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 4px 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: normal;
  color: var(--text-color);
  background: var(--window-bg);
  border: 1px solid transparent;
  cursor: pointer;
  box-sizing: border-box;
  border-radius: 0;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: #000080;
  color: #ffffff;
  border-color: #000080;
  outline: none;
}

.menu-item-icon {
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  flex-shrink: 0;
}

.menu-item-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-menu {
  position: fixed;
  z-index: 980;
  min-width: 180px;
  max-width: 260px;
  padding: 4px;
  background: var(--window-bg);
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}

.context-menu-item {
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  background: var(--window-bg);
}

.context-menu-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.context-menu-item:hover:not(:disabled),
.context-menu-item:focus-visible {
  background: var(--accent-text);
  color: var(--title-text);
  outline: none;
}

.menu-item {
  text-align: left;
}

.taskbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 2px 10px;
  background: var(--panel-bg);
  border: 1px solid var(--border-dark);
  box-sizing: border-box;
  font-size: 11px;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  margin-left: auto;
}

.taskbar-status-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

#app-version {
  font-size: 10px;
  line-height: 1.1;
  color: var(--text-muted);
  white-space: nowrap;
}

#app-update-status {
  font-size: 10px;
  line-height: 1.1;
  color: #000080;
  font-weight: bold;
  white-space: nowrap;
}

#update-now-btn {
  margin: 0;
  padding: 2px 8px;
  font-size: 10px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

#clock {
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
  color: var(--text);
  margin-left: 2px;
}

.notification-tray {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tray-btn {
  width: 22px;
  height: 20px;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  background: var(--window-bg);
  cursor: pointer;
}

.tray-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: #8b0000;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.notification-center {
  position: fixed;
  right: 8px;
  bottom: 44px;
  width: min(380px, calc(100vw - 16px));
  max-height: 320px;
  background: var(--window-bg);
  z-index: 970;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 6px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}

.notification-center-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}

.tray-clear-btn {
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}

.notification-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  min-height: 0;
}

.notification-empty {
  padding: 8px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-bg);
  border: 1px dashed var(--border-dark);
}

.notification-item {
  padding: 6px 8px;
  background: var(--panel-bg);
  border: 1px solid var(--border-dark);
  font-size: 12px;
}

.notification-item-title {
  font-weight: 700;
  margin-bottom: 3px;
}

.notification-item-body {
  line-height: 1.3;
}

.notification-toast-container {
  position: fixed;
  right: 8px;
  bottom: 44px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 990;
  pointer-events: none;
}

.notification-toast {
  width: min(280px, calc(100vw - 16px));
  padding: 8px;
  background: var(--window-bg);
  border-top: 2px solid var(--border-light);
  border-left: 2px solid var(--border-light);
  border-right: 2px solid var(--border-dark);
  border-bottom: 2px solid var(--border-dark);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.notification-toast.is-hiding {
  animation: toast-out 180ms ease-in forwards;
}

.notification-toast-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 3px;
}

.notification-toast-body {
  font-size: 12px;
  line-height: 1.35;
}

.search-btn {
  min-width: 72px;
}

.search-panel {
  position: fixed;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 16px));
  max-height: min(72vh, 520px);
  background: var(--window-bg);
  z-index: 975;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 8px;
}

.search-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.search-panel-title {
  font-size: 12px;
  font-weight: 700;
}

.search-panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.search-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 14px;
}

.search-summary {
  font-size: 12px;
  color: var(--text-muted);
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  min-height: 0;
}

.search-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-bg);
  border: 1px dashed var(--border-dark);
}

.search-result {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--border-dark);
  cursor: pointer;
}

.search-result:hover,
.search-result.active {
  background: var(--surface-bg);
}

.search-result-title {
  font-size: 12px;
  font-weight: 700;
}

.search-result-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.search-result-body {
  font-size: 11px;
  line-height: 1.3;
  color: var(--text);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  body {
    height: 100dvh;
    overflow: hidden;
  }

  .boot-body {
    padding: 14px;
  }

  .boot-branding-title {
    font-size: 18px;
  }

  .boot-branding-subtitle {
    letter-spacing: 0.15em;
  }

  .boot-percent {
    font-size: 16px;
  }

  .boot-log {
    height: 142px;
  }

  .boot-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-topbar {
    height: 28px;
    padding-top: var(--safe-area-top);
    padding-left: calc(4px + var(--safe-area-left));
    padding-right: calc(4px + var(--safe-area-right));
  }

  .desktop {
    height: calc(100dvh - 28px - 52px - var(--safe-area-top) - var(--safe-area-bottom));
    margin-top: calc(28px + var(--safe-area-top));
    padding: 6px;
    overflow: auto;
  }

  .window.app-window {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    left: 0 !important;
    top: 0 !important;
    margin-bottom: 10px;
    min-height: 260px;
    max-height: initial;
  }

  .window.app-window .titlebar {
    cursor: default;
  }

  .window.app-window .window-body {
    padding: 8px;
  }

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

  .result-image-wrap {
    width: min(60vw, 220px);
    height: min(60vw, 220px);
  }

  .dice-display img {
    width: 64px;
    height: 64px;
  }

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

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .settings-actions {
    gap: 6px;
  }

  .music-controls {
    gap: 6px;
  }

  .docs-window-body {
    grid-template-columns: 1fr;
  }

  .chat-window-body {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    max-height: 160px;
  }

  .chat-buddy-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-mini-popout {
    right: 8px;
    top: 8px;
    width: 160px;
  }

  .docs-actions {
    gap: 6px;
  }

  .journal-mobile-nav-tabs {
    display: flex;
  }

  .journal-back-btn {
    display: inline-flex;
  }

  .journal-content-row {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
  }

  .journal-content-row.show-list .journal-list-pane {
    display: flex !important;
    flex: 1;
    width: 100%;
  }

  .journal-content-row.show-list .journal-detail-pane {
    display: none !important;
  }

  .journal-content-row.show-detail .journal-list-pane {
    display: none !important;
  }

  .journal-content-row.show-detail .journal-detail-pane {
    display: flex !important;
    flex: 1;
    width: 100%;
  }

  .hunt-window-body {
    grid-template-columns: 1fr;
  }

  .hunt-form-grid,
  .journal-form-grid {
    grid-template-columns: 1fr;
  }

  .music-volume {
    max-width: 100px;
  }

  .control {
    min-width: 28px;
    height: 24px;
  }

  .win-btn,
  .start-btn,
  .menu-item {
    min-height: 30px;
    padding: 5px 10px;
  }

  .taskbar {
    height: calc(52px + var(--safe-area-bottom));
    padding: 2px calc(4px + var(--safe-area-right)) calc(2px + var(--safe-area-bottom)) calc(4px + var(--safe-area-left));
    gap: 6px;
  }

  .taskbar-left {
    flex: 1;
    min-width: 0;
    gap: 4px;
  }

  .start-btn {
    min-width: 78px;
    font-weight: 700;
  }

  .task-buttons {
    max-width: none;
    flex: 1;
    gap: 4px;
  }

  .task-button {
    min-width: 96px;
    max-width: 140px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .start-menu {
    left: 4px;
    right: 4px;
    width: auto;
    bottom: calc(56px + var(--safe-area-bottom));
    max-height: 48vh;
    overflow: auto;
  }

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

  .taskbar-right {
    min-width: auto;
    max-width: 42vw;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 1px 3px;
    background: var(--panel-bg);
  }

  #app-version,
  #app-update-status {
    display: none;
  }

  #clock {
    font-size: 11px;
    justify-self: auto;
  }

  #update-now-btn {
    font-size: 10px;
    padding: 1px 5px;
  }

  .notification-center {
    right: 4px;
    bottom: 56px;
    width: min(320px, calc(100vw - 8px));
  }

  .notification-toast-container {
    right: 4px;
    bottom: 56px;
  }

  .search-panel {
    width: min(520px, calc(100vw - 8px));
    max-height: calc(100vh - 88px);
    bottom: 56px;
  }
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape), (max-width: 1024px) and (orientation: landscape) {
  .card-popup {
    padding: 2px;
  }

  .card-popup-inner {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
  }

  .card-popup-inner > .window-body {
    padding: 4px;
  }

  .card-popup-actions {
    margin-top: 6px;
  }

  .desktop {
    overflow: hidden;
  }

  .desktop-icons {
    display: none;
  }

  .mobile-home-shell {
    position: absolute;
    inset: 0;
    z-index: 9;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 8px 28px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background:
      linear-gradient(rgba(7, 17, 37, 0.45), rgba(7, 17, 37, 0.45)),
      radial-gradient(circle at 10% 20%, rgba(0, 245, 255, 0.18), transparent 38%),
      radial-gradient(circle at 82% 74%, rgba(0, 0, 128, 0.35), transparent 44%);
  }

  .mobile-home-header {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #e4f8ff;
    text-transform: uppercase;
    text-shadow: 1px 1px 0 #000;
  }

  .mobile-launcher-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-launcher-item {
    border-top: 2px solid var(--border-light);
    border-left: 2px solid var(--border-light);
    border-right: 2px solid var(--border-dark);
    border-bottom: 2px solid var(--border-dark);
    background: rgba(192, 192, 192, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 94px;
    padding: 6px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    transition: transform 120ms ease, opacity 120ms ease;
  }

  .mobile-launcher-item.dragging {
    opacity: 0.86;
    z-index: 2;
    border-top: 2px solid var(--border-dark);
    border-left: 2px solid var(--border-dark);
    border-right: 2px solid var(--border-light);
    border-bottom: 2px solid var(--border-light);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
  }

  .mobile-launcher-item.drop-target {
    outline: 2px dotted #000080;
    outline-offset: -3px;
  }

  .mobile-launcher-item img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    image-rendering: pixelated;
  }

  .mobile-launcher-item span {
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    line-height: 1.1;
  }

  .window.app-window {
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    left: 0 !important;
    top: 0 !important;
    margin-bottom: 0;
    min-height: 0;
  }

  .resize-footer {
    display: none;
  }

  #mobile-home-btn {
    display: inline-block !important;
    min-width: 64px;
  }

  #mobile-home-btn.active {
    border-top: 2px solid var(--border-dark);
    border-left: 2px solid var(--border-dark);
    border-right: 2px solid var(--border-light);
    border-bottom: 2px solid var(--border-light);
    background: #d5d5d5;
  }

  .task-buttons {
    max-width: calc(100vw - 190px);
  }

  .music-playlist {
    max-height: none;
    flex: 1;
  }

  .chat-buddy-list {
    grid-template-columns: 1fr;
  }

  .chat-mini-popout {
    width: 150px;
  }

  /* Game Board mobile responsive modes */
  .game-board-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .game-board-mobile-nav {
    display: flex;
    gap: 4px;
    padding: 3px 6px;
    height: 34px;
    max-height: 34px;
    background: var(--surface-bg, #c0c0c0);
    border-bottom: 2px solid var(--border-dark, #808080);
    flex-shrink: 0;
    box-sizing: border-box;
    z-index: 10;
  }

  .game-board-mobile-nav .win-btn {
    flex: 1;
    padding: 3px 4px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    height: 26px;
    min-height: 26px;
    max-height: 26px;
    line-height: 1.1;
    box-sizing: border-box;
  }

  .game-board-mobile-nav .win-btn.active {
    border-top: 2px solid var(--border-dark, #808080);
    border-left: 2px solid var(--border-dark, #808080);
    border-right: 2px solid var(--border-light, #ffffff);
    border-bottom: 2px solid var(--border-light, #ffffff);
    background: #d5d5d5;
    font-weight: 800;
  }

  .game-board-content-area {
    display: flex;
    flex-direction: row;
    flex: 1;
    width: 100%;
    height: calc(100% - 34px);
    min-height: 0;
    overflow: hidden;
  }

  /* Full Screen Map View */
  .game-board-container.show-board .board-view-wrapper {
    display: flex !important;
    flex: 1;
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
  }

  .game-board-container.show-board .map-tools-panel {
    display: none !important;
  }

  /* Full Screen Controls & Tools View */
  .game-board-container.show-tools .board-view-wrapper {
    display: none !important;
  }

  .game-board-container.show-tools .map-tools-panel {
    display: flex !important;
    flex: 1;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    border-left: none;
    height: 100% !important;
  }

  /* Split View (Horizontal Orientation: Map on left, Tools on right) */
  .game-board-container.show-split .board-view-wrapper {
    display: flex !important;
    flex: 1;
    min-width: 0;
    height: 100% !important;
  }

  .game-board-container.show-split .map-tools-panel {
    display: flex !important;
    width: 340px !important;
    min-width: 260px !important;
    max-width: 48% !important;
    height: 100% !important;
    border-left: 2px solid var(--border-dark, #808080);
  }

  /* Character sheet mobile adjustments */
  .character-sheet-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .character-sheet-util-group {
    margin-left: 0;
    justify-content: flex-start;
  }

  .character-sheet-toolbar-divider {
    display: none;
  }

  .character-sheet-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Mobile touch targets */
  .window-controls .control {
    min-width: 28px;
    height: 24px;
    font-size: 12px;
  }

  .start-btn {
    min-height: 28px;
    padding: 3px 8px;
  }

  .task-btn {
    min-height: 28px;
  }
}

  /* ── dfsIRC login modal ─────────────────────────────────────────────────── */

  .chat-login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
  }

  .chat-login-overlay.hidden {
    display: none;
  }

  .chat-login-dialog {
    position: absolute;
    background: var(--window-bg);
    border-top: 2px solid var(--border-light);
    border-left: 2px solid var(--border-light);
    border-right: 2px solid var(--border-dark);
    border-bottom: 2px solid var(--border-dark);
    width: 300px;
    box-shadow: 2px 2px 0 var(--border-black);
  }

  .chat-login-dialog .titlebar {
    cursor: move;
    -webkit-user-select: none;
    user-select: none;
  }

  .chat-login-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .chat-login-prompt {
    margin: 0;
    font-size: 11px;
    color: var(--text);
  }

  .chat-login-google {
    width: 100%;
    justify-content: center;
  }

  .chat-login-divider {
    margin: 0;
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
  }

  .chat-login-label {
    display: block;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--text);
  }

  .chat-login-input {
    width: 100%;
    box-sizing: border-box;
  }

  .chat-login-hint {
    margin: 0;
    font-size: 10px;
    color: var(--text-muted);
  }

  .chat-login-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
  }

  /* ── Buddy list empty state ─────────────────────────────────────────────── */

  .chat-buddy-empty {
    display: block;
    padding: 6px 8px;
    font-size: 10px;
    color: #666666;
    font-style: italic;
  }

  /* ── Hunt Tracker UI (Stitch Win95 Heritage Theme) ──────────────────────── */

  .hunt-item {
    padding: 4px 6px;
    margin-bottom: 2px;
    background: #ffffff;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 12px;
    -webkit-user-select: none;
    user-select: none;
  }

  .hunt-item:hover {
    background: #e0e0e0;
    border: 1px dotted #808080;
  }

  .hunt-item.active {
    background: #000080 !important;
    color: #ffffff !important;
    font-weight: 700;
  }

  .hunt-item.active .hunt-item-meta {
    color: #d0d0ff !important;
  }

  .hunt-item-title {
    font-weight: 700;
    font-size: 11px;
    line-height: 1.3;
  }

  .hunt-item-meta {
    font-size: 10px;
    color: #555555;
    margin-top: 2px;
  }

  .clue-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
    background: var(--window-bg, #c0c0c0);
    border-top: 1px solid #ffffff;
    border-left: 1px solid #ffffff;
    border-right: 1px solid #808080;
    border-bottom: 1px solid #808080;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    color: #000080;
  }

  .clue-pill:hover {
    background: #d4d4d4;
  }

  .clue-pill:active {
    border-top: 1px solid #808080;
    border-left: 1px solid #808080;
    border-right: 1px solid #ffffff;
    border-bottom: 1px solid #ffffff;
  }

  .hunt-rank-badge {
    display: inline-block;
    padding: 1px 4px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 0px;
    margin-left: 4px;
  }

  .hunt-rank-copper { background: #b87333; color: #ffffff; }
  .hunt-rank-silver { background: #808080; color: #ffffff; }
  .hunt-rank-gold { background: #d4af37; color: #000000; }
  .hunt-rank-platinum { background: #e5e4e2; color: #000000; border: 1px solid #808080; }

  /* ── User_Login.exe Uplink Terminal Authentication Window ───────────────── */

  .user-login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 10, 20, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
  }

  .user-login-overlay.hidden {
    display: none !important;
  }

  .user-login-dialog {
    position: absolute;
    width: 320px;
    max-width: calc(100vw - 28px);
    background: #222a3d;
    border-top: 2px solid #5f6b85;
    border-left: 2px solid #5f6b85;
    border-right: 2px solid #050910;
    border-bottom: 2px solid #050910;
    box-shadow: 2px 2px 0 #000000;
  }

  .user-login-dialog .titlebar {
    cursor: move;
    -webkit-user-select: none;
    user-select: none;
    background: #0e1524;
    color: #ffffff;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 6px;
    border-bottom: 1px solid #050910;
  }

  .user-login-dialog .titlebar-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
  }

  .user-login-dialog .control {
    width: 16px;
    height: 16px;
    min-height: 16px;
    font-size: 9px;
    line-height: 14px;
    padding: 0;
    background: #273041;
    color: #ffffff;
    border: 1px solid #5f6b85;
    border-right-color: #000000;
    border-bottom-color: #000000;
    cursor: pointer;
  }

  .user-login-dialog .control:active {
    border: 1px solid #000000;
    border-right-color: #5f6b85;
    border-bottom-color: #5f6b85;
  }

  .user-login-body {
    padding: 16px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
  }

  .user-login-title {
    margin: 0 0 2px 0;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
  }

  .user-login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin: 0;
  }

  .user-login-field {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .user-login-input {
    width: 100%;
    height: 38px;
    padding: 6px 12px;
    font-size: 13px;
    font-family: "MS Sans Serif", Tahoma, sans-serif;
    color: #1a1a24;
    background: #e3e1ed;
    border-top: 2px solid #555866;
    border-left: 2px solid #555866;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    border-radius: 0px;
    box-sizing: border-box;
    outline: none;
  }

  .user-login-input::placeholder {
    color: #5a596b;
    opacity: 0.9;
  }

  .user-login-input:focus {
    background: #ffffff;
    border-top-color: #000080;
    border-left-color: #000080;
  }

  .user-login-actions,
  .user-login-alt-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .user-login-actions {
    margin-top: 2px;
  }

  .user-login-btn {
    width: 100%;
    height: 34px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    font-family: "MS Sans Serif", Tahoma, sans-serif;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ffffff;
    background: #2e384e;
    border-top: 2px solid #5f6b85;
    border-left: 2px solid #5f6b85;
    border-right: 2px solid #050910;
    border-bottom: 2px solid #050910;
    box-shadow: 1px 1px 0 #000000;
    border-radius: 0px;
    -webkit-user-select: none;
    user-select: none;
    box-sizing: border-box;
  }

  .user-login-btn:hover {
    background: #394560;
  }

  .user-login-btn:active {
    border-top: 2px solid #050910;
    border-left: 2px solid #050910;
    border-right: 2px solid #5f6b85;
    border-bottom: 2px solid #5f6b85;
    box-shadow: none;
    transform: translate(1px, 1px);
  }

  .user-login-btn.primary {
    font-weight: 700;
  }

  .user-login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }

  .user-login-hr {
    width: 100%;
    border: none;
    border-top: 1px solid #3d475f;
    margin: 4px 0;
  }

  .user-login-status {
    margin-top: 2px;
    padding: 6px 8px;
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    line-height: 1.3;
    background: #111726;
    border: 1px inset #050910;
    color: #00f5ff;
    min-height: 18px;
    word-break: break-word;
    box-sizing: border-box;
  }

  .user-login-status.hidden {
    display: none !important;
  }

  .user-login-status-error {
    color: #ff6b6b;
  }

  .user-login-status-success {
    color: #51cf66;
  }

  .user-login-status-info {
    color: #7ef3ff;
  }

  /* ── Desktop Shortcut Dialog Modal (Win95 Heritage) ─────────────────────── */

  .desktop-shortcut-dialog {
    max-width: calc(100vw - 24px);
    background: var(--window-bg, #c0c0c0);
  }

  .desktop-shortcut-body {
    padding: 14px 16px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-sizing: border-box;
  }

  .shortcut-dialog-content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
  }

  .shortcut-dialog-icon-wrap {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-bg, #ffffff);
    border-top: 2px solid var(--border-dark, #808080);
    border-left: 2px solid var(--border-dark, #808080);
    border-right: 2px solid var(--border-light, #ffffff);
    border-bottom: 2px solid var(--border-light, #ffffff);
    padding: 4px;
    box-sizing: border-box;
  }

  .shortcut-dialog-icon {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
  }

  .shortcut-dialog-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .shortcut-dialog-heading {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-text, #000080);
    line-height: 1.2;
  }

  .shortcut-dialog-message {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    color: var(--text, #000000);
  }

  .shortcut-dialog-hint {
    margin: 2px 0 0 0;
    font-size: 11px;
    line-height: 1.3;
    color: var(--text-muted, #555555);
    font-style: italic;
  }

  .shortcut-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
  }

  .shortcut-dialog-actions .win-btn {
    min-width: 78px;
    padding: 4px 12px;
    font-size: 11px;
  }
