* {
  box-sizing: border-box;
}

/* Equipment enhancement */
.enhancement-heading {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 14px;
}
.enhancement-heading > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid rgba(93, 214, 255, .45);
  border-radius: 8px;
  background: rgba(7, 26, 38, .82);
}
.enhancement-heading strong { color: #8ee8ff; font-size: 1.7rem; }
.enhancement-heading small { opacity: .8; }
.enhancement-section-heading,
.enhancement-material-row,
.enhancement-recipe-card,
.enhancement-confirm-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.enhancement-section-heading h2 { margin-bottom: 4px; }
.enhancement-section-heading p { margin: 0; opacity: .8; }
.enhancement-material-list,
.enhancement-recipe-list { display: grid; gap: 12px; }
.enhancement-material-row > div { display: grid; gap: 4px; }
.enhancement-material-row > div span { opacity: .8; }
.enhancement-material-row form,
.storage-enhancement-form { display: flex; align-items: center; gap: 8px; }
.enhancement-material-row input[type="number"],
.storage-enhancement-form input[type="number"] { width: 5.5rem; }
.enhancement-recipe-card {
  align-items: stretch;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: rgba(0, 0, 0, .16);
}
.enhancement-recipe-card.is-destructive { border-color: rgba(255, 120, 70, .65); }
.enhancement-recipe-main { flex: 1; min-width: 0; }
.enhancement-item-comparison {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}
.enhancement-item-comparison > div { display: grid; gap: 4px; }
.enhancement-item-comparison span,
.enhancement-item-comparison small { opacity: .78; }
.enhancement-arrow { font-size: 1.45rem; }
.enhancement-recipe-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.enhancement-rate.is-safe { color: #65df91; }
.enhancement-rate.is-caution { color: #f1dc58; }
.enhancement-rate.is-danger { color: #ff9b45; }
.enhancement-risk-warning,
.enhancement-point-warning,
.enhancement-block-reason { margin-top: 10px; padding: 9px 11px; border-radius: 5px; }
.enhancement-risk-warning { color: #ffd1bd; background: rgba(155, 48, 16, .34); }
.enhancement-point-warning { color: #fff2ae; background: rgba(132, 105, 15, .28); }
.enhancement-block-reason { color: #ffd0d0; background: rgba(125, 25, 25, .3); }
.enhancement-action-form {
  width: 210px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
}
.enhancement-action-form label { font-size: .88rem; line-height: 1.45; }
.enhancement-confirm-panel ul { margin-bottom: 18px; }

@media (max-width: 760px) {
  .enhancement-section-heading,
  .enhancement-material-row,
  .enhancement-recipe-card,
  .enhancement-confirm-actions { align-items: stretch; flex-direction: column; }
  .enhancement-heading { justify-content: stretch; }
  .enhancement-heading > div { width: 100%; justify-content: center; }
  .enhancement-material-row form,
  .storage-enhancement-form { flex-wrap: wrap; }
  .enhancement-item-comparison { grid-template-columns: 1fr; }
  .enhancement-arrow { transform: rotate(90deg); justify-self: center; }
  .enhancement-action-form { width: 100%; }
}

:root {
  --bg: #080a0f;
  --surface: #121722;
  --surface-strong: #171f2d;
  --panel: #101620;
  --line: #263244;
  --line-hot: rgba(0, 229, 255, 0.48);
  --text: #e6f1ff;
  --muted: #8ea0b8;
  --cyan: #00e5ff;
  --magenta: #ff2a6d;
  --yellow: #fcee09;
  --green: #9bff4a;
  --red: #ff3b30;
  --shadow: rgba(0, 229, 255, 0.18);
  --table-grid: url("assets/ui/table-bg-grid.webp");
  --table-noise: url("assets/ui/table-bg-noise-light.webp");
  --scanline: url("assets/ui/panel-scanline.png");
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(0, 229, 255, 0.12), transparent 32%),
    radial-gradient(circle at 82% 0%, rgba(255, 42, 109, 0.12), transparent 28%),
    linear-gradient(180deg, #080a0f 0%, #0c1018 52%, #080a0f 100%);
  color: var(--text);
  font-family: Arial, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 100% 4px, 48px 48px;
  mix-blend-mode: screen;
  opacity: 0.35;
  z-index: 0;
}

body.theme-r18 {
  --line-hot: rgba(255, 42, 109, 0.56);
  --cyan: #ff5c8a;
  --shadow: rgba(255, 42, 109, 0.2);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 42, 109, 0.14), transparent 32%),
    radial-gradient(circle at 82% 0%, rgba(0, 229, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #09080f 0%, #120c16 52%, #080a0f 100%);
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.app-shell--no-sidebar {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(18, 23, 34, 0.98), rgba(8, 10, 15, 0.98)),
    var(--surface);
  border-right: 1px solid var(--line-hot);
  padding: 22px 16px;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.24);
}

.sidebar-mobile-controls,
.sidebar-toggle,
.sidebar-backdrop {
  display: none;
}

.brand {
  margin: 0 0 22px;
  padding: 14px 12px;
  border: 1px solid rgba(0, 229, 255, 0.42);
  border-radius: 8px;
  background: rgba(0, 229, 255, 0.06);
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
  box-shadow: inset 0 0 18px rgba(0, 229, 255, 0.08), 0 0 18px rgba(0, 229, 255, 0.08);
}

.brand-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
}

.brand-sub {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav-divider {
  display: block;
  height: 1px;
  margin: 8px 0;
  background: rgba(38, 50, 68, 0.92);
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-family: "Arial Narrow", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Meiryo UI", sans-serif;
  font-weight: 700;
  font-feature-settings: "palt" 1;
  letter-spacing: 0.06em;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.nav-label {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.08);
}

.nav-label::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--magenta), var(--cyan));
  box-shadow: 0 0 7px var(--cyan);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.24s ease-out;
}

.nav-link::after {
  content: ">";
  color: rgba(0, 229, 255, 0.42);
  font-size: 12px;
}

.nav-link:hover,
.nav-link.active {
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.16), rgba(255, 42, 109, 0.08));
  border-color: rgba(0, 229, 255, 0.48);
  color: var(--text);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.1);
}

.nav-link:hover .nav-label::after,
.nav-link:focus-visible .nav-label::after {
  transform: scaleX(1);
}

.nav-link.mode-switch {
  border-color: rgba(255, 42, 109, 0.42);
}

@media (prefers-reduced-motion: reduce) {
  .nav-label::after {
    transition-duration: 1ms;
  }
}

.main-column {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 14px 32px;
  border-bottom: 1px solid rgba(38, 50, 68, 0.9);
  background: rgba(8, 10, 15, 0.88);
  backdrop-filter: blur(14px);
}

.topbar-title {
  min-width: 0;
}

.topbar-kicker {
  display: block;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
}

.topbar-page {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.terminal-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.terminal-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(38, 50, 68, 0.92);
  border-radius: 6px;
  background: rgba(18, 23, 34, 0.74);
  white-space: nowrap;
}

.terminal-chip strong {
  margin-left: 5px;
  color: var(--text);
}

.terminal-chip.alert strong {
  color: var(--yellow);
}

.terminal-chip.online {
  border-color: rgba(155, 255, 74, 0.38);
}

.terminal-chip.online strong {
  color: var(--green);
}

.terminal-chip-information {
  color: var(--muted);
  text-decoration: none;
}

.terminal-chip-information:hover,
.terminal-chip-information:focus-visible {
  border-color: var(--green);
  color: var(--green);
}

.terminal-chip-information.has-unread {
  border-color: rgba(92, 255, 157, 0.78);
  color: var(--green);
  box-shadow: 0 0 14px rgba(92, 255, 157, 0.22);
  animation: information-pulse 1.35s ease-in-out infinite;
}

.terminal-chip-information.has-unread strong {
  color: var(--green);
}

@keyframes information-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(92, 255, 157, 0.18); }
  50% { box-shadow: 0 0 20px rgba(92, 255, 157, 0.5); }
}

@media (prefers-reduced-motion: reduce) {
  .terminal-chip-information.has-unread {
    animation: none;
  }
}

.content-wrap {
  padding: 32px;
}

.page {
  width: min(980px, 100%);
  margin: 0 auto;
}

h1 {
  margin: 0 0 16px;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin: 28px 0 12px;
  font-size: 20px;
  line-height: 1.3;
}

.message,
.panel,
.card {
  background: rgba(18, 23, 34, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
}

.message {
  border-left: 6px solid var(--cyan);
  margin-bottom: 20px;
}

.error {
  border-left-color: var(--red);
  color: #ffb4ae;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.item {
  background: rgba(8, 10, 15, 0.52);
  border: 1px solid rgba(38, 50, 68, 0.9);
  border-radius: 6px;
  padding: 12px;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.value {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.summary {
  white-space: pre-wrap;
}

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

.admin-menu-groups {
  display: grid;
  gap: 18px;
}

.admin-menu-group {
  padding: 16px 18px 4px;
  border: 1px solid var(--line-hot);
  border-radius: 8px;
  background: rgba(8, 12, 19, 0.42);
}

.admin-menu-group-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.28);
}

.admin-menu-group-heading > span {
  color: var(--cyan);
  font: 800 11px/1.2 Consolas, "Courier New", monospace;
  letter-spacing: 0.08em;
}

.admin-menu-group-heading h3 {
  margin: 0;
  font-size: 18px;
}

.admin-menu-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 28px;
}

.admin-menu-entry {
  min-width: 0;
  padding: 16px 0 18px;
  border-top: 1px solid rgba(38, 50, 68, 0.72);
}

.admin-menu-entry:nth-child(-n + 2) {
  border-top: 0;
}

.admin-menu-entry h4 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 16px;
}

.admin-menu-entry p {
  min-height: 2.8em;
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.admin-menu-entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-menu-entry-actions .button {
  width: auto;
  flex: 1 1 170px;
  padding: 9px 11px;
  font-size: 13px;
}

@media (max-width: 720px) {
  .admin-menu-group-heading {
    display: grid;
    gap: 5px;
  }

  .admin-menu-entry-grid {
    grid-template-columns: 1fr;
  }

  .admin-menu-entry:nth-child(-n + 2) {
    border-top: 1px solid rgba(38, 50, 68, 0.72);
  }

  .admin-menu-entry:first-child {
    border-top: 0;
  }
}

.table-surface,
[class$="-table-wrap"] {
  position: relative;
  overflow-x: auto;
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(rgba(8, 10, 15, 0.82), rgba(8, 10, 15, 0.9)),
    var(--table-grid) center / cover,
    var(--table-noise) center / cover;
  box-shadow: inset 0 0 26px rgba(0, 229, 255, 0.06), 0 14px 34px rgba(0, 0, 0, 0.22);
}

.table-surface::after,
[class$="-table-wrap"]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--scanline) center / 360px auto repeat;
  opacity: 0.07;
  mix-blend-mode: screen;
}

table {
  color: var(--text);
}

table th,
table td {
  border-color: rgba(38, 50, 68, 0.92);
}

table th {
  background: rgba(0, 229, 255, 0.11);
  color: var(--muted);
}

table td {
  background: rgba(8, 10, 15, 0.56);
}

table tbody tr:hover td {
  background: rgba(0, 229, 255, 0.08);
}

.room-warning {
  border-color: rgba(252, 238, 9, 0.62);
  background: rgba(252, 238, 9, 0.08);
}

.room-danger {
  border-color: rgba(255, 59, 48, 0.62);
  background: rgba(255, 59, 48, 0.08);
}

.button {
  display: inline-block;
  width: 100%;
  border: 1px solid rgba(0, 229, 255, 0.45);
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.2), rgba(255, 42, 109, 0.22));
  color: var(--text);
  border-radius: 6px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.08);
}

.button:hover {
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.32), rgba(255, 42, 109, 0.3));
}

.register-page {
  min-height: 100vh;
}

.public-auth-page .page {
  width: min(820px, 100%);
}

.login-page {
  background:
    radial-gradient(circle at 12% 24%, rgba(0, 229, 255, 0.17), transparent 34%),
    radial-gradient(circle at 88% 18%, rgba(255, 42, 109, 0.14), transparent 32%),
    linear-gradient(145deg, #06090e 0%, #0c111b 54%, #09070d 100%);
}

.login-page::after {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(0, 229, 255, 0.035) 0,
      rgba(0, 229, 255, 0.035) 1px,
      transparent 1px,
      transparent 5px
    ),
    linear-gradient(90deg, transparent 49.9%, rgba(255, 255, 255, 0.025) 50%, transparent 50.1%);
  opacity: 0.8;
}

.login-page .page {
  width: min(1120px, 100%);
}

.login-page .content-wrap {
  padding-top: clamp(28px, 5vw, 64px);
}

.login-entry-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: clamp(22px, 4vw, 52px);
  align-items: center;
}

.login-game-intro {
  position: relative;
  overflow: hidden;
  min-height: 510px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 5vw, 58px);
  border: 1px solid rgba(0, 229, 255, 0.34);
  background:
    linear-gradient(135deg, rgba(0, 229, 255, 0.1), transparent 44%),
    linear-gradient(315deg, rgba(255, 42, 109, 0.12), transparent 42%),
    rgba(8, 12, 19, 0.82);
  box-shadow:
    inset 0 0 42px rgba(0, 229, 255, 0.035),
    0 22px 58px rgba(0, 0, 0, 0.3),
    0 0 34px rgba(0, 229, 255, 0.08);
}

.login-game-intro::before,
.login-game-intro::after {
  content: "";
  position: absolute;
  width: 72px;
  height: 72px;
  pointer-events: none;
}

.login-game-intro::before {
  top: 14px;
  left: 14px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
}

.login-game-intro::after {
  right: 14px;
  bottom: 14px;
  border-right: 2px solid var(--magenta);
  border-bottom: 2px solid var(--magenta);
}

.login-build-label,
.login-terminal-code {
  display: block;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.login-build-label {
  margin-bottom: 22px;
}

.login-game-title {
  margin: 0;
  font-size: clamp(46px, 6.4vw, 82px);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 0.88;
  text-shadow: 0 0 24px rgba(0, 229, 255, 0.16);
}

.login-game-title span {
  display: block;
}

.login-game-title span:last-child {
  color: var(--cyan);
}

.login-game-category {
  width: fit-content;
  margin: 30px 0 0;
  border-left: 5px solid var(--yellow);
  padding: 7px 12px;
  background: rgba(252, 238, 9, 0.08);
  color: var(--text);
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 900;
  letter-spacing: 0.04em;
}

.login-game-description {
  max-width: 570px;
  margin: 20px 0 0;
  color: #b7c7da;
  font-weight: 700;
}

.login-signal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 30px;
}

.login-signal-strip span {
  border: 1px solid rgba(0, 229, 255, 0.24);
  padding: 4px 8px;
  background: rgba(0, 229, 255, 0.055);
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.login-terminal-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 3.2vw, 36px);
  border-color: rgba(255, 42, 109, 0.34);
  background:
    linear-gradient(145deg, rgba(0, 229, 255, 0.055), transparent 46%),
    rgba(15, 21, 32, 0.95);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

.login-terminal-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent 55%, var(--magenta));
}

.login-terminal-panel h2,
.login-public-panel h2 {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 25px;
}

.login-terminal-description,
.login-public-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-terminal-panel .message {
  margin: 20px 0 0;
}

.login-terminal-panel .login-form {
  margin-top: 24px;
}

.login-form label > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.login-form label small {
  color: rgba(0, 229, 255, 0.66);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.login-page .login-form input {
  min-height: 48px;
  border-color: rgba(74, 96, 126, 0.82);
  background: rgba(5, 8, 13, 0.82);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.login-page .login-form input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}

.login-page .auth-submit {
  min-height: 48px;
  margin-top: 4px;
  border-color: rgba(0, 229, 255, 0.68);
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.28), rgba(0, 229, 255, 0.11));
}

.login-register-callout {
  display: grid;
  gap: 14px;
  margin-top: 26px;
  border-top: 1px solid rgba(38, 50, 68, 0.92);
  padding-top: 22px;
}

.login-register-callout strong,
.login-register-callout span {
  display: block;
}

.login-register-callout strong {
  color: var(--text);
}

.login-register-callout span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.login-register-button {
  border-color: rgba(255, 42, 109, 0.5);
}

.login-public-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  margin-top: 24px;
  background:
    linear-gradient(100deg, rgba(0, 229, 255, 0.07), transparent 58%),
    rgba(13, 18, 27, 0.92);
}

.login-public-button {
  width: auto;
  min-width: 290px;
}

.login-public-actions {
  display: grid;
  gap: 10px;
}

@media (max-width: 880px) {
  .login-entry-shell {
    grid-template-columns: 1fr;
  }

  .login-game-intro {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .login-page .content-wrap {
    padding-top: 20px;
  }

  .login-game-intro {
    padding: 34px 22px;
  }

  .login-game-intro::before,
  .login-game-intro::after {
    width: 44px;
    height: 44px;
  }

  .login-game-title {
    font-size: clamp(36px, 11.5vw, 48px);
  }

  .login-game-category {
    margin-top: 24px;
    font-size: 16px;
  }

  .login-game-description {
    font-size: 14px;
  }

  .login-signal-strip {
    margin-top: 24px;
  }

  .login-terminal-panel {
    padding: 24px 20px;
  }

  .login-public-panel {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .login-public-button {
    width: 100%;
    min-width: 0;
  }
}

.public-auth-hero {
  margin-bottom: 20px;
}

.public-auth-hero p {
  max-width: 62ch;
  margin: 8px 0 0;
  color: var(--muted);
}

.public-link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.public-link-grid .button,
.auth-submit {
  width: 100%;
}

/* public_access.php */
.page-public-access {
  scroll-behavior: smooth;
}

.public-access-hero {
  padding: clamp(28px, 5vw, 52px);
}

.public-access-hero::after {
  content: "PUBLIC ACCESS // READ ONLY";
  color: rgba(252, 238, 9, 0.16);
  font-size: clamp(24px, 5vw, 58px);
  letter-spacing: 0.08em;
}

.public-access-hero > * {
  position: relative;
  z-index: 1;
}

.public-access-hero h1 {
  max-width: 860px;
  margin: 10px 0 16px;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.08;
}

.public-access-hero p {
  max-width: 780px;
}

.public-access-system-message {
  max-width: 780px;
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid rgba(252, 238, 9, 0.35);
  border-left: 4px solid var(--yellow);
  background: rgba(252, 238, 9, 0.06);
}

.public-access-system-message span,
.public-access-section-no,
.public-access-readout,
.public-access-link-no,
.public-access-link b {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.public-access-system-message p {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.public-access-overview,
.public-access-guides,
.public-access-social {
  margin-top: 20px;
}

.public-access-overview h2,
.public-access-guides h2,
.public-access-social h2 {
  margin: 6px 0 12px;
}

.public-access-overview p {
  max-width: 800px;
}

.public-access-overview p:last-child {
  margin-bottom: 0;
}

.public-access-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.public-access-readout {
  color: var(--muted);
  white-space: nowrap;
}

.public-access-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.public-access-link {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 172px;
  padding: 18px;
  border: 1px solid rgba(0, 229, 255, 0.28);
  background:
    linear-gradient(145deg, rgba(0, 229, 255, 0.08), transparent 58%),
    rgba(8, 10, 15, 0.56);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.public-access-link:hover,
.public-access-link:focus-visible {
  border-color: var(--cyan);
  background:
    linear-gradient(145deg, rgba(0, 229, 255, 0.16), rgba(255, 42, 109, 0.08)),
    rgba(8, 10, 15, 0.72);
  color: var(--text);
  transform: translateY(-2px);
}

.public-access-link strong {
  font-size: 19px;
}

.public-access-link small {
  min-height: 48px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.public-access-link b {
  margin-top: auto;
}

.public-access-link--r18 {
  border-color: rgba(255, 91, 163, 0.38);
  background:
    linear-gradient(145deg, rgba(255, 42, 109, 0.14), transparent 58%),
    rgba(18, 12, 27, 0.7);
}

.public-access-link--r18 .public-access-link-no,
.public-access-link--r18 b {
  color: #ff78ba;
}

.public-access-link--r18:hover,
.public-access-link--r18:focus-visible {
  border-color: #ff78ba;
}

.public-access-link--yellow {
  border-color: rgba(252, 238, 9, 0.35);
  background:
    linear-gradient(145deg, rgba(252, 238, 9, 0.08), transparent 58%),
    rgba(18, 17, 12, 0.62);
}

.public-access-link--yellow .public-access-link-no,
.public-access-link--yellow b {
  color: var(--yellow);
}

.public-access-link--yellow:hover,
.public-access-link--yellow:focus-visible {
  border-color: var(--yellow);
}

.public-access-social {
  text-align: center;
}

.public-access-social p {
  color: var(--muted);
}

.public-access-social .button {
  width: auto;
  min-width: 240px;
  margin-top: 6px;
}

.public-access-materials p {
  max-width: 860px;
}

.public-access-material-terms {
  display: grid;
  gap: 7px;
  max-width: 920px;
  margin: 16px 0 0;
  padding-left: 22px;
  color: var(--muted);
}

.public-access-material-terms li::marker {
  color: var(--yellow);
}

.public-access-material-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.public-access-material {
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(0, 229, 255, 0.28);
  background: rgba(8, 10, 15, 0.56);
}

.public-access-material a {
  display: block;
  border: 1px solid rgba(38, 50, 68, 0.92);
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    rgba(8, 10, 15, 0.72);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
}

.public-access-material a:hover,
.public-access-material a:focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.14);
}

.public-access-material img {
  display: block;
  width: 100%;
  height: auto;
}

.public-access-material figcaption {
  display: grid;
  gap: 2px;
  padding: 10px 2px 2px;
}

.public-access-material figcaption strong {
  color: var(--text);
}

.public-access-material figcaption span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 760px) {
  .public-access-section-heading {
    display: block;
  }

  .public-access-readout {
    display: block;
    margin-top: 8px;
  }

  .public-access-link-grid {
    grid-template-columns: 1fr;
  }

  .public-access-material-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .public-access-hero {
    padding: 24px 18px;
  }

  .public-access-social .button {
    width: 100%;
    min-width: 0;
  }
}


/* character_guidelines.php */
.page-character-guidelines {
  scroll-behavior: smooth;
}

.character-guidelines-hero {
  background:
    linear-gradient(125deg, rgba(0, 229, 255, 0.15), transparent 46%),
    linear-gradient(315deg, rgba(252, 238, 9, 0.1), transparent 44%),
    rgba(10, 15, 24, 0.96);
}

.page-character-guidelines .character-guidelines-hero::after {
  content: "LDC // CHARACTER REGULATIONS";
  color: rgba(252, 238, 9, 0.08);
  font-size: clamp(26px, 5vw, 66px);
}

.character-guidelines-lead {
  display: grid;
  gap: 2px;
}

.character-guidelines-lead span {
  color: var(--muted);
}

.character-guidelines-section h2 {
  max-width: 850px;
}

.character-guidelines-section h3 {
  margin-top: 26px;
}

.character-guidelines-section p,
.character-guidelines-section li {
  max-width: 980px;
}

.character-guidelines-definition-grid {
  margin-top: 20px;
}

.character-guidelines-definition-grid .item,
.character-guidelines-boundary-grid .item {
  min-height: 100%;
  padding: 14px;
  border: 1px solid rgba(38, 50, 68, 0.92);
  background: rgba(8, 10, 15, 0.4);
}

.character-guidelines-note {
  margin-top: 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--cyan);
  background: rgba(0, 229, 255, 0.06);
  color: var(--muted);
}

.character-guidelines-note a {
  color: var(--text);
  text-decoration-color: rgba(0, 229, 255, 0.6);
  text-underline-offset: 3px;
}

.character-guidelines-boundary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.character-guidelines-boundary-grid strong {
  display: block;
  margin-bottom: 6px;
  color: var(--cyan);
}

.character-guidelines-boundary-grid .character-guidelines-not-allowed {
  border-color: rgba(255, 59, 48, 0.52);
  background: rgba(255, 59, 48, 0.07);
}

.character-guidelines-boundary-grid .character-guidelines-not-allowed strong {
  color: #ff8c86;
}

.character-guidelines-boundary-grid .character-guidelines-allowed {
  border-color: rgba(155, 255, 74, 0.42);
  background: rgba(155, 255, 74, 0.06);
}

.character-guidelines-boundary-grid .character-guidelines-allowed strong {
  color: var(--green);
}

.character-guidelines-choice-grid {
  margin-top: 20px;
}

.character-guidelines-choice {
  padding: 14px;
  border: 1px solid rgba(38, 50, 68, 0.92);
  background: rgba(8, 10, 15, 0.4);
}

.character-guidelines-choice strong {
  display: block;
  margin-bottom: 6px;
  color: var(--cyan);
}

.character-guidelines-choice--clone {
  border-color: rgba(255, 59, 48, 0.52);
  background: rgba(255, 59, 48, 0.07);
}

.character-guidelines-choice--clone strong {
  color: #ff8c86;
}

.character-guidelines-choice--rescue {
  border-color: rgba(155, 255, 74, 0.42);
  background: rgba(155, 255, 74, 0.06);
}

.character-guidelines-choice--rescue strong {
  color: var(--green);
}

.character-guidelines-boundary-grid--r18 ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.character-guidelines-boundary-grid--r18 li + li {
  margin-top: 7px;
}

.character-guidelines-checklist {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.character-guidelines-checklist li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-left: 2px solid var(--cyan);
  background: rgba(0, 229, 255, 0.06);
}

.character-guidelines-checklist li > span {
  color: var(--cyan);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.character-guidelines-checklist strong,
.character-guidelines-checklist small {
  display: block;
}

.character-guidelines-checklist small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.character-guidelines-closing {
  margin-top: 20px;
  padding: 28px 24px;
  border: 1px solid var(--line-hot);
  background:
    linear-gradient(120deg, rgba(0, 229, 255, 0.11), transparent 54%),
    rgba(10, 15, 24, 0.9);
  text-align: center;
}

.character-guidelines-closing p {
  margin: 8px auto 18px;
  color: var(--muted);
}

.character-guidelines-closing .button {
  width: auto;
  min-width: 170px;
  margin: 4px;
}

@media (max-width: 760px) {
  .character-guidelines-boundary-grid {
    grid-template-columns: 1fr;
  }

  .character-guidelines-closing .button {
    display: block;
    width: 100%;
    margin: 8px 0 0;
  }
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  border: 1px solid rgba(38, 50, 68, 0.92);
  border-radius: 6px;
  padding: 11px 12px;
  background: rgba(8, 10, 15, 0.72);
  color: var(--text);
  font: inherit;
}

.auth-switch {
  margin: 18px 0 0;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.register-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 16px;
  position: relative;
  z-index: 1;
}

.register-panel {
  width: min(760px, 100%);
}

.registration-terms {
  margin-bottom: 24px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.8;
}

.registration-terms-title {
  margin: 0 0 18px;
  padding: 6px 12px;
  border-left: 6px solid var(--yellow);
  background: rgba(252, 238, 9, 0.16);
  color: var(--text);
  font-size: 21px;
}

.registration-terms p {
  margin: 0 0 16px;
}

.registration-terms h3 {
  margin: 18px 0 8px 4px;
  padding: 3px 8px;
  color: #aaffff;
  font-size: 16px;
  text-decoration: underline;
}

.terms-important {
  color: #f09999;
  font-weight: 700;
}

.registration-terms-list {
  display: grid;
  gap: 7px;
  margin: 0 0 16px;
  padding-left: 24px;
}

.registration-terms-list li::marker {
  color: var(--muted);
}

.registration-terms-list--prohibited {
  gap: 5px;
}

.registration-terms-details {
  margin: 12px 0 18px 24px;
  border: 1px solid rgba(142, 160, 184, 0.55);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--muted);
}

.registration-terms-details summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.registration-terms-details p:last-child {
  margin-bottom: 0;
}

.register-form {
  display: grid;
  gap: 18px;
}

.register-agreement {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(240, 153, 153, 0.48);
  border-radius: 6px;
  background: rgba(240, 153, 153, 0.08);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.register-agreement input {
  width: auto;
  margin-top: 4px;
}

.register-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.register-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid rgba(38, 50, 68, 0.92);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.register-tab.active,
.register-tab-panel {
  border-color: rgba(0, 229, 255, 0.42);
}

.register-tab.active {
  color: var(--text);
  background: rgba(0, 229, 255, 0.1);
}

.register-tab-panel {
  border: 1px solid rgba(0, 229, 255, 0.22);
  border-radius: 8px;
  padding: 18px;
  background: rgba(8, 10, 15, 0.38);
}

.register-grid {
  display: grid;
  gap: 14px;
}

.register-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.register-form input,
.register-form select {
  width: 100%;
  border: 1px solid rgba(38, 50, 68, 0.92);
  border-radius: 6px;
  padding: 11px 12px;
  background: rgba(8, 10, 15, 0.72);
  color: var(--text);
  font: inherit;
}

.register-errors {
  margin: 0;
  padding-left: 20px;
}

.register-login {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 560px) {
  .register-tabs {
    grid-template-columns: 1fr;
  }

  .public-link-grid {
    grid-template-columns: 1fr;
  }
}

.footer {
  margin-top: 28px;
  padding: 16px 0 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

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

  .sidebar {
    position: fixed;
    z-index: 50;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 320px);
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 0;
    border-left: 1px solid var(--line-hot);
    padding: 14px 16px 24px;
    box-shadow: -16px 0 42px rgba(0, 0, 0, 0.56);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform 0.24s ease, visibility 0s linear 0.24s;
  }

  .sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
    transition-delay: 0s;
  }

  .sidebar-mobile-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    margin-bottom: 10px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.12em;
  }

  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(0, 229, 255, 0.48);
    border-radius: 7px;
    background: rgba(18, 23, 34, 0.92);
    color: var(--text);
    font: inherit;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 40;
    inset: 0;
    display: block;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.64);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.24s ease, visibility 0s linear 0.24s;
  }

  .sidebar-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  body.sidebar-drawer-open {
    overflow: hidden;
  }

  .topbar {
    position: sticky;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 72px 16px 16px;
  }

  .sidebar-toggle {
    position: absolute;
    top: 14px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    width: 48px;
    min-height: 48px;
    border: 1px solid rgba(0, 229, 255, 0.54);
    border-radius: 7px;
    padding: 6px;
    background: rgba(18, 23, 34, 0.94);
    color: var(--cyan);
    font: inherit;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.12);
  }

  .sidebar-toggle-icon {
    display: grid;
    gap: 3px;
    width: 22px;
  }

  .sidebar-toggle-icon i {
    display: block;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .terminal-status {
    justify-content: flex-start;
  }

  .content-wrap {
    padding: 20px 16px;
  }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-backdrop {
    transition-duration: 1ms;
  }
}

/* home.php */
.home-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid rgba(0, 229, 255, 0.42);
    border-radius: 8px;
    padding: 22px;
    background:
      linear-gradient(115deg, rgba(0, 229, 255, 0.14), transparent 42%),
      linear-gradient(290deg, rgba(255, 42, 109, 0.18), transparent 46%),
      rgba(18, 23, 34, 0.9);
    box-shadow: 0 0 34px rgba(0, 229, 255, 0.1);
  }

  .home-hero::after {
    content: "WORK ORDER // LIVE DEATH CHALLENGE";
    position: absolute;
    right: 16px;
    bottom: 12px;
    color: rgba(252, 238, 9, 0.18);
    font-size: 18px;
    font-weight: 800;
    pointer-events: none;
  }

  .home-hero h1 {
    margin-bottom: 8px;
  }

  .home-hero p {
    max-width: 680px;
    margin: 0;
    color: var(--muted);
    font-weight: 700;
  }

  .r18-history-panel {
    position: relative;
    overflow: hidden;
    border-color: rgba(255, 91, 163, 0.42);
    background:
      radial-gradient(circle at 92% 0%, rgba(255, 112, 190, 0.17), transparent 35%),
      linear-gradient(135deg, rgba(77, 15, 48, 0.42), rgba(18, 12, 27, 0.94));
    box-shadow: inset 0 0 28px rgba(255, 70, 150, 0.06), 0 0 24px rgba(255, 42, 109, 0.1);
  }

  .r18-history-panel::after {
    content: "✦  ·  ✧  ·  ✦";
    position: absolute;
    top: 10px;
    right: 18px;
    color: rgba(255, 192, 230, 0.2);
    font-size: 22px;
    letter-spacing: 8px;
    pointer-events: none;
  }

  .r18-history-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
  }

  .r18-history-heading h2,
  .r18-history-heading p {
    margin: 0;
  }

  .r18-history-heading h2 {
    color: #ffd6ed;
    font-size: 17px;
    letter-spacing: 0.12em;
    text-shadow: 0 0 12px rgba(255, 95, 180, 0.6);
  }

  .r18-history-heading p {
    color: #bd91ab;
    font-size: 12px;
  }

  .r18-history-heading > span {
    color: #ff78ba;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.16em;
  }

  .r18-history-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
  }

  .r18-history-card {
    --history-accent: #ff69b4;
    position: relative;
    overflow: hidden;
    min-width: 0;
    border: 1px solid color-mix(in srgb, var(--history-accent) 58%, transparent);
    border-radius: 9px;
    padding: 10px;
    background:
      linear-gradient(145deg, color-mix(in srgb, var(--history-accent) 13%, transparent), rgba(23, 11, 26, 0.82));
    box-shadow: inset 0 0 14px color-mix(in srgb, var(--history-accent) 8%, transparent), 0 0 12px color-mix(in srgb, var(--history-accent) 10%, transparent);
  }

  .r18-history-card::before {
    content: "✦";
    position: absolute;
    top: -3px;
    right: 5px;
    color: color-mix(in srgb, var(--history-accent) 45%, transparent);
    font-size: 18px;
  }

  .r18-history-card--compliance { --history-accent: #ff7fc4; }
  .r18-history-card--operator-submission { --history-accent: #ff4f91; }
  .r18-history-card--refusal { --history-accent: #d28cff; }
  .r18-history-card--identity-exposure { --history-accent: #ff6675; }
  .r18-history-card--salesmanship { --history-accent: #ff9bdc; }

  .r18-history-card__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
  }

  .r18-history-card__label {
    overflow: hidden;
    color: color-mix(in srgb, var(--history-accent) 80%, white);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-shadow: 0 0 9px color-mix(in srgb, var(--history-accent) 60%, transparent);
  }

  .r18-history-card__top strong {
    color: #fff2fa;
    font-size: 18px;
    line-height: 1;
  }

  .r18-history-gauge {
    overflow: hidden;
    height: 7px;
    margin-top: 8px;
    border: 1px solid color-mix(in srgb, var(--history-accent) 32%, transparent);
    border-radius: 999px;
    background: rgba(8, 4, 12, 0.78);
  }

  .r18-history-gauge span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, color-mix(in srgb, var(--history-accent) 75%, #9a1f65), #ffd1ec 82%, white);
    box-shadow: 0 0 10px var(--history-accent);
    transition: width 300ms ease;
  }

  .r18-history-card small {
    display: block;
    margin-top: 4px;
    color: color-mix(in srgb, var(--history-accent) 62%, #8b7484);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-align: right;
  }

  @media (max-width: 900px) {
    .r18-history-grid {
      grid-template-columns: repeat(5, minmax(132px, 1fr));
      overflow-x: auto;
      padding-bottom: 5px;
    }
  }

  @media (max-width: 560px) {
    .r18-history-heading > span { display: none; }
    .r18-history-panel { padding: 14px; }
  }

  .active-run-message,
  .pending-result-message {
    display: block;
    border-left-color: var(--green);
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
    background: linear-gradient(90deg, rgba(155, 255, 74, 0.12), rgba(0, 229, 255, 0.06));
  }

  .active-run-message:hover,
  .pending-result-message:hover {
    background: linear-gradient(90deg, rgba(155, 255, 74, 0.18), rgba(0, 229, 255, 0.1));
  }

  .contractor-panel {
    border-color: rgba(0, 229, 255, 0.26);
  }

  .home-layout {
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
  }

  .fullbody-frame {
    position: sticky;
    top: 96px;
    overflow: hidden;
    border: 1px solid rgba(0, 229, 255, 0.42);
    border-radius: 8px;
    background:
      linear-gradient(rgba(8, 10, 15, 0.28), rgba(8, 10, 15, 0.74)),
      var(--table-grid) center / cover,
      rgba(8, 10, 15, 0.9);
    box-shadow: inset 0 0 28px rgba(0, 229, 255, 0.08), 0 18px 36px rgba(0, 0, 0, 0.28);
  }

  .fullbody-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: var(--scanline) center / 360px auto repeat;
    opacity: 0.08;
    mix-blend-mode: screen;
  }

  .fullbody-label {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.24);
    color: var(--cyan);
    font-size: 11px;
    font-weight: 800;
  }

  .fullbody-image-wrap {
    display: grid;
    place-items: end center;
    min-height: 520px;
    padding: 16px 14px 0;
  }

  .fullbody-image {
    width: min(100%, 280px);
    max-height: 560px;
    object-fit: contain;
    object-position: bottom center;
    filter: drop-shadow(0 0 16px rgba(0, 229, 255, 0.18));
  }

  .fullbody-image.character-image-frozen {
    height: auto;
  }

  .fullbody-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
    align-items: center;
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(0, 229, 255, 0.24);
    background: rgba(8, 10, 15, 0.66);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .fullbody-identity {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .achievement-title {
    color: #9beeff;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
  }

  .fullbody-meta > .achievement-title {
    max-width: 180px;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .contractor-panel h2 {
    color: var(--cyan);
  }

  .notification-list {
    display: grid;
    gap: 10px;
  }

  .notification-item {
    display: grid;
    gap: 8px;
    border-left: 4px solid var(--yellow);
  }

  .notification-item--announcement {
    border-left-color: var(--green);
    background: rgba(23, 58, 42, 0.22);
  }

  .notification-item.has-event-icon {
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
  }

  .notification-item.has-event-icon > :not(.notification-event-icon) {
    grid-column: 2;
  }

  .notification-event-icon {
    grid-column: 1;
    grid-row: 1 / span 3;
    width: 64px;
    height: 64px;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.3);
  }

  .notification-meta {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

.notification-actions {
    display: flex;
    justify-content: flex-end;
  }

  .notification-actions .button {
    width: auto;
    padding: 8px 12px;
  }

  .home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 8px 0 16px;
  }

  .home-actions .button {
    width: auto;
    flex: 1 1 160px;
    margin: 0;
  }

  .character-detail-actions form {
    display: flex;
    flex: 1 1 160px;
    margin: 0;
  }

  .character-detail-actions form .button {
    width: 100%;
  }

  .report-link {
    margin: 10px 0 0;
    text-align: right;
    font-size: 12px;
    color: var(--muted);
  }

  .report-link a {
    text-decoration: underline;
  }

  .profile-box {
    min-height: 84px;
  }

  .profile-equipment-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .profile-equipment-item {
    position: relative;
    overflow: hidden;
    border-color: rgba(0, 229, 255, 0.34);
    background:
      linear-gradient(135deg, rgba(0, 229, 255, 0.09), rgba(255, 42, 109, 0.04)),
      rgba(8, 10, 15, 0.72);
  }

  .profile-equipment-item::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 26px;
    height: 2px;
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan);
  }

  .profile-equipment-item .value {
    overflow-wrap: anywhere;
  }

  .profile-equipment-item.is-empty {
    border-color: rgba(142, 160, 184, 0.24);
    background: rgba(8, 10, 15, 0.52);
  }

  .profile-equipment-item.is-empty .value {
    color: var(--muted);
  }

  .profile-equipment-item.is-empty::after {
    background: var(--muted);
    box-shadow: none;
    opacity: 0.4;
  }

  .value.money {
    color: var(--yellow);
  }

.value.clone {
    color: var(--magenta);
  }

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

  .status-base {
    color: var(--text);
  }

  .status-modifier {
    margin-left: 4px;
    font-weight: 900;
  }

  .status-modifier--positive {
    color: var(--cyan);
  }

  .status-modifier--negative {
    color: var(--magenta);
  }

  .status-modifier--zero {
    color: var(--muted);
  }

  @media (max-width: 760px) {
    .home-hero::after {
      display: none;
    }

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

    .fullbody-frame {
      position: relative;
      top: auto;
    }

    .fullbody-image-wrap {
      min-height: 420px;
    }

    .fullbody-image {
      max-height: 460px;
    }
  }


/* chat.php */
@media (min-width: 761px) {
  .page-communication-log .page {
    width: min(1470px, 100%);
  }
}

.announcement-list-heading,
.admin-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.announcement-list-heading h2,
.admin-list-heading h2 {
  margin: 0;
}

.announcement-list {
  display: grid;
  gap: 10px;
}

.announcement-list-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  padding: 12px 14px;
  background: rgba(8, 12, 19, 0.66);
  color: var(--text);
  text-decoration: none;
}

.announcement-list-item:hover,
.announcement-list-item:focus-visible {
  border-color: var(--cyan);
  outline: 0;
}

.announcement-list-item.is-unread {
  border-left-color: var(--green);
}

.announcement-list-item.is-pinned {
  border-top-color: rgba(255, 223, 94, 0.48);
}

.announcement-list-item__meta,
.announcement-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.announcement-list-item__summary,
.announcement-detail-summary {
  color: var(--muted);
}

.announcement-category {
  color: var(--cyan);
}

.announcement-unread-label {
  color: var(--green);
  font-size: 11px;
}

.information-hero {
  margin-bottom: 20px;
}

.information-tools {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.information-tool-link {
  display: grid;
  gap: 5px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.information-tool-link:hover,
.information-tool-link:focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.12);
  outline: 0;
  transform: translateY(-1px);
}

.information-tool-link__eyebrow {
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.information-tool-link strong {
  color: var(--cyan);
  font-size: 18px;
}

.information-tool-link > span:last-child {
  color: var(--muted);
}

.information-eyebrow {
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.information-hero h1 {
  margin-bottom: 8px;
}

.announcement-unread-summary {
  border-left-color: var(--green);
}

.announcement-list-panel,
.announcement-detail {
  display: grid;
  gap: 16px;
}

.announcement-list-heading {
  color: var(--muted);
}

.announcement-list-item__title {
  font-size: 17px;
}

.announcement-detail h2 {
  margin: 0;
  color: var(--cyan);
}

.announcement-content {
  line-height: 1.8;
}

.announcement-content h3,
.announcement-content h4 {
  color: var(--cyan);
}

.announcement-content a {
  color: var(--cyan);
}

.announcement-read-form,
.announcement-detail-back {
  margin: 0;
  text-align: right;
}

.announcement-editor-panel {
  display: grid;
  gap: 14px;
}

.conversation-history-panel {
  display: grid;
  gap: 16px;
}

.conversation-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.conversation-history-heading h2 {
  margin: 0;
}

.conversation-history-list {
  display: grid;
  gap: 10px;
}

.conversation-history-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cyan);
  padding: 13px 14px;
  background: rgba(8, 12, 19, 0.66);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.conversation-history-item:hover,
.conversation-history-item:focus-visible {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
  outline: 0;
}

.conversation-history-item.is-archived {
  border-left-color: var(--muted);
}

.conversation-history-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.conversation-history-item__mode {
  color: var(--green);
  letter-spacing: 0.08em;
}

.conversation-history-item__title {
  color: var(--cyan);
  font-size: 17px;
}

.conversation-history-item__summary {
  color: var(--muted);
}

.conversation-history-item__action {
  justify-self: end;
  color: var(--text);
  font-weight: 800;
}

.announcement-editor-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.announcement-editor-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.announcement-editor-fields label:first-child,
.announcement-editor-fields label:nth-child(2) {
  grid-column: 1 / -1;
}

.announcement-editor-fields input,
.announcement-editor-fields select,
.announcement-editor-fields textarea {
  width: 100%;
}

.announcement-editor-check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-weight: 800;
}

.chat-room-select-form {
    display: grid;
    gap: 8px;
    width: min(520px, 100%);
    margin: 0 0 18px;
  }

  .chat-room-select-form label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .chat-room-select-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 8px;
  }

  .chat-room-select-row select {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(0, 229, 255, 0.38);
    border-radius: 6px;
    padding: 10px 12px;
    background: rgba(8, 10, 15, 0.68);
    color: var(--text);
    font: inherit;
    font-weight: 800;
  }

  .chat-room-select-row select option {
    background: #ffffff;
    color: #172033;
  }

  .chat-room-select-button {
    width: 100%;
    padding: 10px 12px;
    white-space: nowrap;
  }

  .chat-room-head {
    margin-bottom: 16px;
  }

  .chat-room-head p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
  }

  .chat-feed-nav {
    margin-bottom: 16px;
  }

  .chat-feed-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .chat-feed-buttons .button {
    width: auto;
  }

  .chat-feed-current,
  .chat-feed-help,
  .chat-search-help {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .chat-feed-help {
    margin: 10px 0 0;
  }

  .chat-search-panel {
    margin-top: 16px;
  }

  .chat-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: end;
  }

  .chat-search-form label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .chat-search-field {
    display: grid;
    gap: 6px;
  }

  .chat-search-form input[type="search"] {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(0, 229, 255, 0.32);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.74);
    color: var(--text);
    font: inherit;
  }

  .chat-search-name-option {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    white-space: nowrap;
  }

  .chat-search-name-option input {
    width: auto;
  }

  .chat-search-form .button {
    width: auto;
    white-space: nowrap;
  }

  .chat-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(10, auto);
    grid-auto-flow: column;
    gap: 12px;
    margin-bottom: 20px;
  }

  .chat-column {
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
  }

  .chat-message {
    min-width: 0;
    border: 1px solid rgba(38, 50, 68, 0.92);
    border-radius: 8px;
    padding: 12px;
    background: rgba(8, 10, 15, 0.48);
  }

  .chat-message.admin-notice {
    border-color: rgba(255, 59, 48, 0.78);
    background: rgba(255, 59, 48, 0.08);
    color: #ffb4ae;
    font-weight: 800;
  }

  .chat-message.system-log {
    border-color: rgba(252, 238, 9, 0.62);
    background: rgba(252, 238, 9, 0.08);
  }

  .chat-message.dungeon-info .chat-message-head strong {
    color: var(--cyan);
    letter-spacing: 0.08em;
  }

  .chat-meta,
  .chat-actions,
  .chat-parent {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .chat-message-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .chat-message-head strong {
    color: var(--text);
    font-size: 14px;
  }

  .chat-author-link,
  .shop-item-character-link {
    color: var(--cyan);
    text-decoration: underline dotted;
    text-underline-offset: 3px;
  }

  .chat-author-link:hover,
  .chat-author-link:focus-visible,
  .shop-item-character-link:hover,
  .shop-item-character-link:focus-visible {
    color: var(--text);
  }

  .chat-achievement-title {
    font-size: 12px;
  }

  .chat-message-mention {
    color: var(--cyan);
  }

  .chat-body {
    margin: 8px 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .chat-parent {
    margin-top: 8px;
    padding: 8px;
    border-left: 4px solid rgba(0, 229, 255, 0.42);
    background: rgba(0, 229, 255, 0.06);
  }

  .chat-post-panel {
    width: min(520px, 100%);
    margin-bottom: 16px;
  }

  .chat-post-panel-bottom {
    display: none;
  }

  .chat-form {
    display: grid;
    gap: 12px;
  }

  .chat-identity-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
  }

  .chat-form label {
    display: grid;
    gap: 6px;
    font-weight: 800;
  }

  .chat-body-field {
    display: grid;
    gap: 6px;
  }

  .chat-compose-row {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  .chat-compose-icon-frame {
    width: 60px;
    aspect-ratio: 1;
    border: 1px solid rgba(0, 229, 255, 0.32);
    border-radius: 6px;
  }

  .chat-compose-icon-frame .character-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .chat-form input,
  .chat-form select,
  .chat-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0, 229, 255, 0.32);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.74);
    color: var(--text);
    font: inherit;
  }

  .chat-form textarea {
    min-height: 120px;
    resize: vertical;
  }

  .chat-message-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px 12px;
    margin-top: 8px;
  }

  .chat-message-stamp {
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
  }

  .message-delete-control {
    position: relative;
    display: inline-block;
    margin-left: 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    vertical-align: middle;
  }

  .message-delete-control summary {
    cursor: pointer;
    color: var(--muted);
    list-style: none;
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  .message-delete-control summary::-webkit-details-marker {
    display: none;
  }

  .message-delete-confirm {
    position: absolute;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 6px;
    width: max-content;
    max-width: min(92vw, 360px);
    padding: 8px;
    border: 1px solid rgba(255, 59, 48, 0.5);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.97);
    color: var(--text);
    font-size: 11px;
    white-space: normal;
  }

  .message-delete-confirm form {
    display: inline-flex;
    margin: 0;
  }

  .message-delete-confirm .button {
    padding: 4px 8px;
    font-size: 10px;
    white-space: nowrap;
  }

  .chat-markup-buttons {
    margin: 0;
  }

  .chat-markup-preview {
    padding: 12px;
    border: 1px solid rgba(0, 229, 255, 0.28);
    border-radius: 7px;
    background: rgba(8, 10, 15, 0.5);
  }

  .chat-markup-preview-body {
    margin-top: 6px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .chat-submit-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  .markup-large {
    font-size: 1.35em;
    font-weight: 800;
    line-height: 1.35;
  }

  .markup-small {
    font-size: 0.78em;
  }

  .markup-rainbow {
    color: transparent;
    background: linear-gradient(90deg, #ff4d6d, #ff9f1c, #ffe66d, #2ec4b6, #3a86ff, #8338ec, #ff4d6d);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    font-weight: 800;
  }

  ruby rt {
    font-size: 0.55em;
  }

  .chat-pager {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
  }

  .chat-pager .button {
    width: auto;
    padding: 8px 12px;
  }

  .chat-pager-status {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  @media (max-width: 760px) {
    .chat-room-select-row {
      grid-template-columns: 1fr;
    }

    .chat-list {
      grid-template-columns: 1fr;
      grid-template-rows: none;
      grid-auto-flow: row;
    }

    .chat-identity-row {
      grid-template-columns: 1fr;
    }

    .chat-search-form {
      grid-template-columns: 1fr;
    }

    .chat-search-form .button {
      width: 100%;
    }
  }

/* direct messages */
.direct-message-contacts { margin-bottom: 16px; }
.direct-message-contact-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
}
.direct-message-contact {
  position: relative;
  display: grid;
  flex: 0 0 118px;
  justify-items: center;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(38, 50, 68, 0.92);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: rgba(8, 10, 15, 0.48);
}
.direct-message-contact:hover,
.direct-message-contact.active {
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.14);
}
.direct-message-contact-icon {
  width: 58px;
  aspect-ratio: 1;
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: 50%;
}
.direct-message-contact-icon .character-image,
.direct-message-icon .character-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.direct-message-contact-name {
  display: grid;
  min-width: 0;
  max-width: 100%;
  text-align: center;
}
.direct-message-contact-name strong,
.direct-message-contact-name small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.direct-message-contact-name small,
.direct-message-thread h2 small { color: var(--muted); }
.direct-message-unread {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  color: #080a0f;
  background: var(--magenta);
  font-size: 11px;
  font-weight: 900;
}
.direct-message-list { display: grid; gap: 12px; }
.direct-message-bubble {
  display: flex;
  width: min(76%, 720px);
  gap: 10px;
  align-items: flex-start;
}
.direct-message-bubble.is-mine {
  justify-self: end;
  flex-direction: row-reverse;
}
.direct-message-icon {
  flex: 0 0 48px;
  width: 48px;
  aspect-ratio: 1;
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: 6px;
}
.direct-message-content {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(38, 50, 68, 0.92);
  border-radius: 8px;
  background: rgba(8, 10, 15, 0.58);
}
.is-mine .direct-message-content {
  border-color: rgba(0, 229, 255, 0.46);
  background: rgba(0, 229, 255, 0.07);
}
.direct-message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
}
.direct-message-body { overflow-wrap: anywhere; }
.direct-message-delete-control {
  display: block;
  width: max-content;
  margin: 8px 0 0 auto;
  text-align: right;
}
.direct-message-compose { margin-bottom: 16px; }
.direct-message-compose .chat-compose-row > label { min-width: 0; }
@media (min-width: 761px) {
  .page-communication-log .direct-message-bubble {
    width: min(76%, 1080px);
  }
}
@media (max-width: 680px) {
  .direct-message-bubble { width: 94%; }
  .direct-message-contact { flex-basis: 104px; }
}

/* profile_edit.php */
.profile-form {
  display: grid;
  gap: 18px;
}

.character-image-settings-panel {
  display: grid;
  gap: 16px;
}

.character-image-notice ul {
  margin: 10px 0 0;
  padding-left: 22px;
}

.character-image-notice li + li {
  margin-top: 6px;
}

.character-image-motion-setting {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.achievement-title-selector form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.achievement-title-selector label {
  display: grid;
  flex: 1 1 280px;
  gap: 6px;
  font-weight: 800;
}

.achievement-title-selector select {
  width: 100%;
}

.character-image-motion-setting input {
  width: auto;
}

.field-help {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.character-icon-editor {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(38, 50, 68, 0.92);
  border-radius: 8px;
}

.character-icon-editor legend {
  padding: 0 6px;
  color: var(--cyan);
  font-weight: 800;
}

.character-icon-editor label {
  display: grid;
  gap: 5px;
}

.character-icon-editor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.character-image-frame {
  position: relative;
  overflow: hidden;
  background: rgba(8, 10, 15, 0.72);
}

.character-image-placeholder {
  display: none;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.character-image-frame.no-character-image .character-image-placeholder,
.character-image-frame.image-load-failed .character-image-placeholder {
  display: grid;
}

.character-image-frame.image-load-failed .character-image {
  display: none;
}

.character-card-photo {
  width: 112px;
  aspect-ratio: 3 / 4;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 6px;
}

.character-card-photo .character-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-profile-visual {
  width: min(100%, 400px);
  aspect-ratio: 1 / 2;
  margin: 0 auto;
  border: 1px solid rgba(0, 229, 255, 0.32);
  border-radius: 8px;
}

.character-profile-visual .character-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chat-message-layout {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.chat-message-layout.no-chat-icon {
  grid-template-columns: 1fr;
}

.chat-icon-frame {
  width: 60px;
  aspect-ratio: 1;
  border: 1px solid rgba(0, 229, 255, 0.26);
  border-radius: 6px;
}

.chat-icon-frame .character-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

  .chat-message-content {
    min-width: 0;
  }

.character-public-icons {
  margin-top: 20px;
}

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

.character-public-icon {
  min-width: 0;
  margin: 0;
}

.character-public-icon-frame {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 6px;
}

.character-public-icon-frame .character-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 680px) {
  .character-icon-editor-grid {
    grid-template-columns: 1fr;
  }

  .character-icon-editor-fields {
    grid-template-columns: 1fr;
  }

  .chat-message-layout {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .chat-icon-frame {
    width: 48px;
  }

  .chat-compose-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .chat-compose-icon-frame {
    width: 48px;
  }
}

.profile-field {
  display: grid;
  gap: 6px;
}

.profile-field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.profile-field input,
.profile-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(0, 229, 255, 0.32);
  border-radius: 6px;
  background: rgba(8, 10, 15, 0.74);
  color: var(--text);
  font: inherit;
}

.profile-field textarea {
  min-height: 260px;
  resize: vertical;
}

.markup-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.markup-buttons button {
  width: auto;
  padding: 8px 12px;
}

.character-counter {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.markup-embedded-image,
.battle-cutin-image,
.chat-presentation-cutin {
  display: block;
  width: auto;
  height: auto;
  max-width: 600px;
  max-height: 300px;
  margin: 0.65rem 0;
  object-fit: contain;
  object-position: left center;
  border-radius: 6px;
}

@media (max-width: 680px) {
  .markup-embedded-image,
  .battle-cutin-image,
  .chat-presentation-cutin {
    max-width: 100%;
  }
}

.chat-presentation-speech {
  margin-top: 0.65rem;
  padding: 0.65rem 0.8rem;
  border-left: 3px solid var(--accent, #8aa4ff);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.chat-hashtag {
  color: var(--cyan);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.profile-mute-panel {
  margin-top: 16px;
}

.profile-preview {
  white-space: normal;
  overflow-wrap: anywhere;
}

.profile-inline-preview {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.profile-inline-preview h3,
.character-icon-settings-preview h3 {
  margin-bottom: 0;
}

.character-icon-settings-preview {
  margin-top: 0;
}

.loadout-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.loadout-tab {
  width: auto;
  padding: 9px 12px;
}

.loadout-tab.active {
  border-color: var(--yellow);
  color: var(--yellow);
}

.r18-profile-fields {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 42, 109, 0.38);
  border-radius: 8px;
  background: rgba(255, 42, 109, 0.06);
}

.r18-profile-fields h2 {
  margin-top: 0;
}

.profile-details {
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid rgba(0, 229, 255, 0.24);
  border-radius: 6px;
  background: rgba(8, 10, 15, 0.42);
}

.profile-details summary {
  cursor: pointer;
  color: var(--cyan);
  font-weight: 800;
}

.account-username-panel {
  margin-top: 20px;
}

.account-username-current {
  margin-bottom: 18px;
  border-color: rgba(0, 229, 255, 0.28);
}


/* tactics.php */
.page-tactics--enemy-intel .page {
  width: min(1280px, 100%);
}

.tactics-page-layout.has-enemy-intel {
  display: grid;
  grid-template-columns: minmax(680px, 1fr) minmax(320px, 360px);
  gap: 20px;
  align-items: start;
}

.tactics-settings-panel {
  min-width: 0;
}

.tactics-enemy-intel {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  padding-right: 6px;
  overflow-y: auto;
  scrollbar-color: rgba(0, 229, 255, 0.42) rgba(8, 10, 15, 0.72);
  scrollbar-width: thin;
}

.tactics-enemy-context {
  display: grid;
  gap: 4px;
  margin-bottom: 0;
}

.tactics-enemy-context strong {
  color: var(--yellow);
}

.tactics-enemy-context span {
  color: var(--muted);
  font-size: 13px;
}

.tactics-enemy-context a {
  color: var(--cyan);
  font-weight: 800;
}

.tactics-forecast-panel {
  overflow: hidden;
  border-color: rgba(255, 79, 130, 0.5);
  background:
    linear-gradient(90deg, rgba(255, 79, 130, 0.035) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(rgba(255, 79, 130, 0.03) 1px, transparent 1px) 0 0 / 24px 24px,
    rgba(8, 15, 24, 0.9);
}

.tactics-forecast-panel > h2 {
  margin: -18px -18px 12px;
  border-bottom: 1px solid rgba(255, 79, 130, 0.42);
  padding: 12px 16px;
  color: #ff91b0;
  font-size: 17px;
}

.tactics-forecast-phase {
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid rgba(107, 143, 170, 0.5);
  background: rgba(7, 16, 25, 0.78);
}

.tactics-forecast-phase-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid rgba(107, 143, 170, 0.5);
  padding: 8px 10px;
  background: rgba(10, 22, 32, 0.96);
  font-size: 12px;
}

.tactics-forecast-phase-header strong {
  color: #ff91b0;
  letter-spacing: 0.08em;
}

.tactics-forecast-phase-header span {
  color: var(--muted);
}

.tactics-forecast-phase-header b {
  color: var(--text);
}

.tactics-forecast-actions {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 6px;
  list-style: none;
}

.tactics-forecast-actions li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 5px;
  min-width: 0;
}

.tactics-forecast-index {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 79, 130, 0.62);
  background: rgba(7, 16, 25, 0.96);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.tactics-forecast-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(100px, 0.8fr);
  gap: 4px 8px;
  align-items: center;
  min-width: 0;
  border-right: 3px solid #ff4f82;
  padding: 8px 9px;
  background: rgba(17, 31, 44, 0.94);
}

.tactics-forecast-action--warning {
  border-right-color: #ffbd3e;
  background: linear-gradient(90deg, rgba(17, 31, 44, 0.94), rgba(83, 55, 18, 0.36));
}

.tactics-forecast-action > strong {
  font-size: 14px;
}

.tactics-forecast-output {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #ff91b0;
  font-size: 14px;
  text-align: center;
}

.tactics-forecast-action--warning .tactics-forecast-output {
  color: #ffbd3e;
}

.tactics-forecast-action > span {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tactics-forecast-empty {
  margin: 0;
  border-top: 1px dashed rgba(255, 79, 130, 0.38);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.tactics-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.tactics-tab {
  width: auto;
  border: 1px solid rgba(0, 229, 255, 0.34);
  border-radius: 6px;
  padding: 9px 13px;
  background: rgba(8, 10, 15, 0.64);
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tactics-tab.active {
  border-color: var(--yellow);
  color: var(--yellow);
  background: rgba(252, 238, 9, 0.08);
}

.tactics-form {
  display: grid;
  gap: 16px;
}

.tactics-tab-panel {
  display: grid;
  gap: 16px;
  scroll-margin-top: 16px;
}

.tactics-slot {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.tactics-form .form-control {
  display: grid;
  gap: 6px;
}

.tactics-form .form-control label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tactics-form .form-control select,
.status-add input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(0, 229, 255, 0.32);
  border-radius: 6px;
  background: rgba(8, 10, 15, 0.74);
  color: var(--text);
  font: inherit;
}

.slot-title {
  font-weight: 800;
}

.item-select-wrap.is-hidden {
  display: none;
}

.action-description {
  min-height: 44px;
  margin-top: 8px;
  border-left: 4px solid rgba(0, 229, 255, 0.42);
  border-radius: 6px;
  padding: 8px 10px;
  background: rgba(0, 229, 255, 0.06);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.learned-skills {
  display: block;
  margin-bottom: 16px;
}

.learned-skills summary {
  cursor: pointer;
  color: var(--cyan);
  font-weight: 900;
}

.learned-skills-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.learned-skills-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.learned-skills-table th,
.learned-skills-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(38, 50, 68, 0.92);
  text-align: left;
  vertical-align: top;
}

.learned-skills-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.learned-skills-table .skill-name {
  color: var(--text);
  font-weight: 900;
  white-space: nowrap;
}

.skill-requirement {
  display: inline-flex;
  margin-left: 6px;
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
}

.learned-skills-table .skill-description {
  min-width: 260px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.tactics-success {
  border-left-color: var(--green);
  color: var(--text);
  font-weight: 800;
  background: linear-gradient(90deg, rgba(155, 255, 74, 0.12), rgba(0, 229, 255, 0.06));
}

.tactics-submit-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.status-point-summary {
  border-color: rgba(252, 238, 9, 0.42);
}

.status-point-summary .value {
  color: var(--yellow);
}

.status-allocation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.status-allocation-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: center;
}

.status-name {
  color: var(--cyan);
  font-size: 18px;
  font-weight: 900;
}

.status-current,
.status-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.status-add {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--yellow);
  font-weight: 900;
}

.status-allocation-row--readonly {
  border-color: rgba(142, 160, 184, 0.54);
}

.status-description {
  display: block;
}

.status-description summary {
  cursor: pointer;
  color: var(--cyan);
  font-weight: 900;
}

.status-description p {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 760px) {
  .tactics-slot {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

@media (max-width: 1400px) {
  .tactics-page-layout.has-enemy-intel {
    grid-template-columns: 1fr;
  }

  .tactics-enemy-intel {
    position: static;
    order: -1;
    max-height: none;
    padding-right: 0;
    overflow-y: visible;
  }
}

/* storage.php */
.storage-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
  }

  .storage-toolbar .button {
    width: auto;
    min-width: 150px;
  }

  .storage-success {
    border-left-color: var(--green);
    color: var(--text);
    font-weight: 800;
  }

  .storage-table-wrap {
    width: 100%;
    overflow-x: auto;
  }

  .storage-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    background: transparent;
  }

  .storage-table th,
  .storage-table td {
    padding: 11px 12px;
    border-bottom: 1px solid rgba(38, 50, 68, 0.92);
    text-align: left;
    vertical-align: middle;
  }

  .storage-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(0, 229, 255, 0.12);
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
  }

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

  .storage-table tbody tr:hover td {
    background: rgba(0, 229, 255, 0.08);
  }

  .storage-name {
    min-width: 150px;
    font-weight: 800;
  }

  .storage-type {
    min-width: 72px;
    white-space: nowrap;
  }

  .storage-description {
    min-width: 180px;
    max-width: 320px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .storage-number {
    text-align: right;
    white-space: nowrap;
  }

  .storage-action {
    position: sticky;
    right: 0;
    z-index: 2;
    width: 164px;
    min-width: 164px;
    background: rgba(11, 15, 23, 0.96);
    box-shadow: -8px 0 14px -12px rgba(0, 229, 255, 0.75);
  }

  .storage-table th.storage-action {
    z-index: 3;
    background: rgba(0, 229, 255, 0.16);
  }

  .storage-table tbody tr:hover .storage-action {
    background: rgba(0, 229, 255, 0.12);
  }

  .storage-action .button {
    padding: 8px 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .storage-carry-form {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 6px;
  }

  .storage-carry-form input {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(0, 229, 255, 0.34);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.72);
    color: var(--text);
  }

  .storage-note {
    color: var(--muted);
    font-size: 13px;
  }

  .storage-disabled {
    color: #ffb4ae;
    font-size: 13px;
    font-weight: 700;
  }

  @media (max-width: 760px) {
    .storage-toolbar {
      align-items: stretch;
      flex-direction: column;
    }

    .storage-toolbar .button {
      width: 100%;
    }

    .storage-table {
      min-width: 760px;
    }

    .storage-name {
      min-width: 125px;
    }

    .storage-description {
      min-width: 150px;
    }

    .storage-action {
      width: 146px;
      min-width: 146px;
    }

    .storage-carry-form {
      grid-template-columns: 52px 1fr;
    }
  }


/* equipment.php */
.equipment-message-success {
    border-left-color: var(--green);
    color: var(--text);
    font-weight: 800;
  }

  .equipment-slots,
  .equipment-list {
    display: grid;
    gap: 14px;
  }

  .equipment-slot,
  .equipment-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 16px;
    align-items: center;
  }

  .equipment-effects {
    margin-top: 6px;
    font-weight: 800;
    color: var(--cyan);
  }

  .status-total {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
  }

  .status-formula {
    font-size: 16px;
    font-weight: 800;
  }

  .button-secondary {
    background: rgba(38, 50, 68, 0.92);
  }

  .inventory-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  .inventory-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
  }

  .inventory-actions input[type="number"] {
    width: 78px;
  }

  .equipment-details {
    margin-bottom: 20px;
    border: 1px solid rgba(0, 229, 255, 0.28);
    border-radius: 8px;
    background:
      linear-gradient(rgba(8, 10, 15, 0.78), rgba(8, 10, 15, 0.9)),
      var(--table-grid) center / cover;
  }

  .equipment-details > summary {
    padding: 16px 18px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 800;
    list-style-position: inside;
  }

  .equipment-details > summary:hover {
    background: rgba(0, 229, 255, 0.08);
  }

  .equipment-details[open] > summary {
    border-bottom: 1px solid rgba(0, 229, 255, 0.24);
  }

  .equipment-details-content {
    padding: 18px;
  }

  @media (max-width: 760px) {
    .equipment-slot,
    .equipment-entry {
      grid-template-columns: 1fr;
    }
  }


/* shop.php */
.shop-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 160px));
    gap: 8px;
    margin-bottom: 20px;
  }

  .shop-tab {
    display: block;
    padding: 10px 14px;
    border: 1px solid rgba(38, 50, 68, 0.95);
    border-radius: 6px;
    background: rgba(18, 23, 34, 0.88);
    color: var(--muted);
    text-align: center;
    text-decoration: none;
    font-weight: 800;
  }

  .shop-tab.active {
    border-color: rgba(230, 241, 255, 0.78);
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.22), rgba(255, 42, 109, 0.14));
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.22), 0 0 18px rgba(0, 229, 255, 0.12);
  }

  .shop-category-tabs {
    display: flex;
    gap: 8px;
    margin: -8px 0 20px;
    flex-wrap: wrap;
  }

  .shop-category-tab {
    padding: 7px 14px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    text-decoration: none;
    font-weight: 800;
  }

  .shop-category-tab.active {
    border-bottom-color: var(--cyan);
    color: var(--text);
  }

.shop-success {
    border-left-color: var(--green);
    color: var(--text);
    font-weight: 800;
  }

  .shop-unlock-note {
    margin-bottom: 16px;
  }

  .shop-table-wrap {
    width: 100%;
    overflow-x: auto;
  }

  .shop-table {
    width: 100%;
    min-width: 760px;
    table-layout: fixed;
    border-collapse: collapse;
    background: transparent;
  }

  .shop-table th,
  .shop-table td {
    padding: 11px 12px;
    border-bottom: 1px solid rgba(38, 50, 68, 0.92);
    text-align: left;
    vertical-align: middle;
  }

  .shop-table th {
    background: rgba(0, 229, 255, 0.12);
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
  }

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

  .shop-name {
    width: 30%;
    font-weight: 800;
  }

  .shop-type,
  .shop-slot {
    text-align: center;
  }

  .shop-type {
    width: 62px;
    white-space: nowrap;
  }

  .shop-slot {
    width: 72px;
    white-space: normal;
    line-height: 1.35;
  }

  .shop-price,
  .shop-quantity {
    width: 78px;
    white-space: nowrap;
  }

  .shop-effect {
    width: 22%;
    font-weight: 800;
    overflow-wrap: anywhere;
  }

  .shop-description {
    overflow-wrap: anywhere;
  }

  .shop-description-row td {
    padding-top: 8px;
    padding-bottom: 14px;
    background: rgba(18, 23, 34, 0.82);
    color: var(--muted);
  }

  .shop-description-label {
    margin-right: 8px;
    color: var(--cyan);
    font-weight: 800;
  }

  .shop-operation {
    width: 160px;
  }

  .shop-operation form {
    display: grid;
    grid-template-columns: minmax(52px, 68px) minmax(66px, 1fr);
    gap: 8px;
    align-items: center;
    max-width: 100%;
  }

  .shop-operation input {
    width: 100%;
    min-width: 0;
    padding: 8px;
    border: 1px solid rgba(0, 229, 255, 0.34);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.72);
    color: var(--text);
  }

  .shop-operation .button {
    padding: 8px 10px;
    min-width: 0;
    width: 100%;
    white-space: nowrap;
  }

  .shop-disabled {
    color: #ffb4ae;
    font-size: 13px;
    font-weight: 800;
  }

  .sponsor-legend {
    margin-top: 16px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }

  @media (max-width: 840px) {
    .shop-table {
      min-width: 700px;
    }

    .shop-operation {
      width: 118px;
    }

    .shop-operation form {
      grid-template-columns: 1fr;
    }
  }

/* casino.php */
.casino-status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
  }

  .casino-status-grid .item {
    min-height: 104px;
  }

  .casino-exchange-panel {
    margin-bottom: 20px;
  }

  .casino-note {
    margin-top: 0;
    color: var(--muted);
    font-weight: 700;
  }

  .casino-exchange-form {
    display: grid;
    grid-template-columns: minmax(180px, 320px) minmax(120px, 160px);
    gap: 12px;
    align-items: end;
    max-width: 520px;
  }

  .casino-exchange-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
  }

  .casino-exchange-form input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid rgba(0, 229, 255, 0.34);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.72);
    color: var(--text);
    font-size: 16px;
  }

  .casino-debt-exchange-panel {
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    border-color: rgba(255, 42, 109, 0.72);
    background:
      linear-gradient(135deg, rgba(255, 42, 109, 0.15), transparent 48%),
      repeating-linear-gradient(-45deg, rgba(255, 180, 174, 0.025) 0 8px, transparent 8px 16px),
      rgba(17, 7, 12, 0.96);
    box-shadow: inset 0 0 0 1px rgba(255, 59, 48, 0.2), 0 0 26px rgba(255, 42, 109, 0.12);
  }

  .casino-debt-exchange-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
  }

  .casino-debt-exchange-heading h2 {
    margin: 3px 0 10px;
    color: #ffb4ae;
    text-shadow: 0 0 14px rgba(255, 42, 109, 0.34);
  }

  .casino-debt-kicker {
    color: rgba(255, 180, 174, 0.76);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.14em;
  }

  .casino-debt-stamp {
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 2px solid rgba(255, 59, 48, 0.82);
    color: #ffb4ae;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.12em;
    transform: rotate(4deg);
  }

  .casino-debt-warning {
    margin: 0 0 8px;
    color: #ffb4ae;
    font-weight: 900;
  }

  .casino-debt-note {
    margin: 0 0 18px;
    color: rgba(230, 241, 255, 0.68);
    font-size: 13px;
    font-weight: 700;
  }

  .casino-debt-exchange-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .casino-debt-exchange-form {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(255, 59, 48, 0.38);
    border-radius: 6px;
    background: rgba(8, 4, 7, 0.72);
  }

  .casino-debt-exchange-form strong {
    color: #fff0ee;
    font-size: 20px;
  }

  .casino-debt-exchange-form span {
    color: rgba(255, 180, 174, 0.78);
    font-size: 12px;
    font-weight: 800;
  }

  .casino-debt-exchange-button {
    border-color: rgba(255, 59, 48, 0.74);
    background: linear-gradient(135deg, rgba(119, 12, 35, 0.96), rgba(51, 6, 17, 0.98));
    color: #fff0ee;
    box-shadow: 0 0 16px rgba(255, 42, 109, 0.16);
  }

  .casino-debt-exchange-button:hover:not(:disabled) {
    border-color: #ffb4ae;
    background: linear-gradient(135deg, rgba(158, 16, 48, 0.98), rgba(72, 7, 23, 0.98));
  }

  .casino-debt-closed {
    margin-top: 14px;
    padding: 10px 12px;
    border-left: 3px solid rgba(255, 59, 48, 0.72);
    background: rgba(255, 59, 48, 0.08);
    color: #ffb4ae;
    font-size: 13px;
    font-weight: 800;
  }

  .casino-trade-table {
    min-width: 720px;
  }

  .casino-gift-panel {
    display: grid;
    gap: 10px;
    margin: 14px 0 18px;
    padding: 14px;
    border: 1px solid rgba(0, 229, 255, 0.28);
    border-radius: 6px;
    background: rgba(0, 229, 255, 0.05);
  }

  .casino-gift-toggle {
    display: flex;
    gap: 9px;
    align-items: center;
    color: var(--text);
    font-weight: 900;
    cursor: pointer;
  }

  .casino-gift-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--cyan);
  }

  .casino-gift-recipient {
    display: grid;
    grid-template-columns: minmax(130px, 190px) minmax(220px, 1fr);
    gap: 8px 12px;
    align-items: center;
  }

  .casino-gift-recipient[hidden] {
    display: none;
  }

  .casino-gift-recipient label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
  }

  .casino-gift-recipient input {
    width: 100%;
    max-width: 220px;
    padding: 9px 10px;
    border: 1px solid rgba(0, 229, 255, 0.34);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.82);
    color: var(--text);
  }

  .casino-gift-recipient-status,
  .casino-gift-recipient .casino-note {
    grid-column: 1 / -1;
  }

  .casino-gift-recipient-status {
    min-height: 1.5em;
    color: var(--muted);
    font-weight: 800;
  }

  .casino-gift-recipient-status.is-success {
    color: #a7ffca;
  }

  .casino-gift-recipient-status.is-error {
    color: #ffb4ae;
  }

  .casino-games-panel {
    margin-bottom: 20px;
  }

  .casino-game-list {
    display: grid;
    grid-template-columns: minmax(160px, 240px);
    gap: 12px;
  }

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

  .highlow-board {
    --highlow-card-width: clamp(150px, 18vw, 180px);
    display: grid;
    grid-template-columns: minmax(calc(var(--highlow-card-width) * 2 + 14px), max-content) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    margin-bottom: 18px;
  }

  .highlow-card {
    display: grid;
    align-content: center;
    justify-items: center;
    min-height: 100%;
    border: 1px solid rgba(230, 241, 255, 0.72);
    border-radius: 8px;
    background:
      linear-gradient(145deg, rgba(230, 241, 255, 0.92), rgba(142, 160, 184, 0.88)),
      var(--table-noise) center / cover;
    color: #080a0f;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28), inset 0 0 0 5px rgba(8, 10, 15, 0.08);
  }

  .highlow-card-stage {
    display: grid;
    grid-template-columns: var(--highlow-card-width);
    gap: 14px;
    align-items: stretch;
    justify-content: start;
  }

  .highlow-card-stage.has-next-card {
    grid-template-columns: repeat(2, var(--highlow-card-width));
  }

  .highlow-card-flip {
    position: relative;
    width: var(--highlow-card-width);
    aspect-ratio: 5 / 7;
    opacity: 0;
    perspective: 900px;
    transform: translate(-86px, -28px) rotate(-8deg) scale(0.94);
    transform-origin: 50% 50%;
    transition: opacity 260ms ease, transform 560ms cubic-bezier(0.18, 0.82, 0.24, 1);
  }

  .highlow-card-flip.is-dealt {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }

  .highlow-card-flip.is-static-card {
    transition: none;
  }

  .highlow-card-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 720ms cubic-bezier(0.22, 0.74, 0.25, 1);
  }

  .highlow-card-flip.is-flipped .highlow-card-inner {
    transform: rotateY(180deg);
  }

  .highlow-card-face {
    position: absolute;
    inset: 0;
    min-height: 100%;
    backface-visibility: hidden;
  }

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

  .highlow-card-back {
    background:
      linear-gradient(145deg, rgba(8, 10, 15, 0.96), rgba(18, 23, 34, 0.92)),
      repeating-linear-gradient(45deg, rgba(0, 229, 255, 0.16) 0 8px, rgba(255, 42, 109, 0.12) 8px 16px);
    color: var(--text);
    border-color: rgba(0, 229, 255, 0.56);
  }

  .highlow-card-back .highlow-card-label,
  .highlow-card-back span:last-child {
    color: rgba(230, 241, 255, 0.78);
  }

  .highlow-card-flip.is-result-win .highlow-card-front {
    animation: highlow-win-glow 900ms ease-out 1;
  }

  .highlow-card-flip.is-result-lose .highlow-card-front {
    animation: highlow-lose-flash 760ms ease-out 1;
  }

  @keyframes highlow-win-glow {
    0% {
      box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28), inset 0 0 0 5px rgba(8, 10, 15, 0.08);
    }
    36% {
      border-color: rgba(155, 255, 74, 0.95);
      box-shadow: 0 0 0 4px rgba(155, 255, 74, 0.22), 0 0 34px rgba(155, 255, 74, 0.58), inset 0 0 0 5px rgba(155, 255, 74, 0.12);
    }
    100% {
      box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28), inset 0 0 0 5px rgba(8, 10, 15, 0.08);
    }
  }

  @keyframes highlow-lose-flash {
    0%, 100% {
      border-color: rgba(230, 241, 255, 0.72);
      box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28), inset 0 0 0 5px rgba(8, 10, 15, 0.08);
    }
    20%, 58% {
      border-color: rgba(255, 59, 48, 0.98);
      box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.22), 0 0 30px rgba(255, 59, 48, 0.62), inset 0 0 0 5px rgba(255, 59, 48, 0.16);
    }
    38%, 76% {
      border-color: rgba(255, 180, 174, 0.95);
      box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.14), 0 0 18px rgba(255, 59, 48, 0.34), inset 0 0 0 5px rgba(8, 10, 15, 0.08);
    }
  }

  .highlow-result-card {
    --highlow-card-width: clamp(150px, 18vw, 180px);
    width: var(--highlow-card-width);
    margin-top: 16px;
  }

  .highlow-last-result-log {
    margin-bottom: 12px;
    font-weight: 800;
  }

  .highlow-last-result-log + h2 + .item {
    display: none;
  }

  .highlow-card-label {
    color: rgba(8, 10, 15, 0.64);
    font-size: 12px;
    font-weight: 900;
  }

  .highlow-card strong {
    margin: 10px 0;
    font-size: clamp(44px, 7vw, 64px);
    line-height: 1;
  }

  .highlow-card span:last-child {
    font-size: 13px;
    font-weight: 900;
  }

  .highlow-round-info {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .highlow-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 220px));
    gap: 12px;
  }

  .highlow-actions .button {
    min-height: 72px;
  }

  .highlow-actions .button span,
  .highlow-actions .button small {
    display: block;
    margin-top: 3px;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
  }

  @media (max-width: 900px) {
    .casino-status-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .highlow-board,
    .highlow-round-info,
    .highlow-card-stage.has-next-card {
      grid-template-columns: 1fr;
    }

    .highlow-card-stage {
      grid-template-columns: var(--highlow-card-width);
    }
  }

  @media (max-width: 620px) {
    .casino-status-grid,
    .casino-exchange-form,
    .casino-debt-exchange-grid,
    .casino-game-list,
    .highlow-actions {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 620px) {
    .casino-gift-recipient {
      grid-template-columns: 1fr;
    }

    .casino-gift-recipient input {
      max-width: none;
    }
  }

/* dungeon_select.php */
.dungeon-loadout-panel {
    margin-bottom: 20px;
    border-color: rgba(0, 229, 255, 0.42);
    background:
      linear-gradient(135deg, rgba(0, 229, 255, 0.08), transparent 48%),
      rgba(18, 23, 34, 0.92);
  }

  .dungeon-loadout-panel--empty {
    border-color: rgba(255, 180, 65, 0.62);
  }

  .dungeon-loadout-heading,
  .dungeon-loadout-subheading,
  .dungeon-loadout-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }

  .dungeon-loadout-heading h2,
  .dungeon-loadout-section h3,
  .dungeon-loadout-actions p {
    margin: 0;
  }

  .dungeon-loadout-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
  }

  .dungeon-loadout-set {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid rgba(255, 214, 90, 0.62);
    border-radius: 999px;
    color: var(--yellow);
    background: rgba(255, 214, 90, 0.08);
    white-space: nowrap;
  }

  .dungeon-loadout-warning {
    margin: 16px 0 0;
    padding: 12px 14px;
  }

  .dungeon-loadout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
    gap: 16px;
    margin-top: 18px;
  }

  .dungeon-loadout-section {
    min-width: 0;
  }

  .dungeon-loadout-section h3 {
    margin-bottom: 10px;
    color: var(--cyan);
    font-size: 16px;
  }

  .dungeon-loadout-subheading h3 {
    margin-bottom: 10px;
  }

  .dungeon-loadout-subheading span {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
  }

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

  .dungeon-loadout-item {
    min-width: 0;
    padding: 10px 12px;
  }

  .dungeon-loadout-item .value {
    font-size: 15px;
  }

  .dungeon-loadout-item.is-empty .value {
    color: #ffb4ae;
  }

  .dungeon-loadout-carry-list {
    display: grid;
    gap: 6px;
    max-height: 180px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
  }

  .dungeon-loadout-carry-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px;
    border: 1px solid rgba(38, 50, 68, 0.9);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.52);
  }

  .dungeon-loadout-carry-list span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .dungeon-loadout-carry-list strong {
    flex: 0 0 auto;
    color: var(--cyan);
  }

  .dungeon-loadout-actions {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(38, 50, 68, 0.9);
  }

  .dungeon-loadout-actions p {
    color: var(--muted);
    font-size: 13px;
  }

  .dungeon-loadout-actions .home-actions {
    flex: 0 0 auto;
    margin: 0;
  }

  .theme-r18 .dungeon-loadout-kicker,
  .theme-r18 .dungeon-loadout-section h3,
  .theme-r18 .dungeon-loadout-carry-list strong {
    color: #ff9ebd;
  }

  @media (max-width: 760px) {
    .dungeon-loadout-heading,
    .dungeon-loadout-actions {
      align-items: stretch;
      flex-direction: column;
    }

    .dungeon-loadout-set {
      align-self: flex-start;
    }

    .dungeon-loadout-grid,
    .dungeon-loadout-equipment {
      grid-template-columns: 1fr;
    }

    .dungeon-loadout-actions .home-actions {
      display: grid;
      grid-template-columns: 1fr;
    }
  }

.dungeon-select-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  @media (min-width: 1040px) {
    .dungeon-select-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }

  @media (max-width: 620px) {
    .dungeon-select-grid {
      grid-template-columns: 1fr;
    }
  }

.dungeon-select-card {
    position: relative;
    overflow: hidden;
    min-height: 360px;
    padding: 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
  }

  .dungeon-select-card.has-dungeon-image::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
      linear-gradient(180deg, rgba(8, 10, 15, 0.56), rgba(8, 10, 15, 0.88)),
      linear-gradient(90deg, rgba(0, 229, 255, 0.08), rgba(255, 42, 109, 0.06));
    pointer-events: none;
  }

  .dungeon-card-body {
    position: relative;
    z-index: 1;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
  }

  .dungeon-card-body h2 {
    margin-top: 0;
  }

  .theme-r18 .r18-dungeon-card {
    border-color: rgba(255, 42, 109, 0.38);
    background:
      linear-gradient(145deg, rgba(255, 42, 109, 0.12), rgba(128, 80, 255, 0.1)),
      rgba(13, 15, 24, 0.9);
    box-shadow: 0 18px 42px rgba(255, 42, 109, 0.1);
  }

  .theme-r18 .r18-dungeon-card.has-dungeon-image {
    background-position: center;
    background-size: cover;
  }

  .theme-r18 .r18-dungeon-card.has-dungeon-image::before {
    background:
      linear-gradient(180deg, rgba(8, 10, 15, 0.18), rgba(8, 10, 15, 0.86)),
      linear-gradient(90deg, rgba(255, 42, 109, 0.18), rgba(128, 80, 255, 0.12));
  }

  .theme-r18 .r18-dungeon-card-body {
    gap: 12px;
  }

  .theme-r18 .r18-dungeon-notice {
    max-width: 760px;
  }

  .theme-r18 .r18-dungeon-notice h2 {
    margin-top: 0;
    color: #ffd6e2;
  }


/* explore.php */
.page-explore {
  /* Keep every exploration surface on one readable navy baseline. Individual
   * panels may still add semantic cyan/magenta/red accents, but their base
   * luminance and border contrast should not drift independently. */
  --explore-surface: rgba(18, 25, 38, 0.62);
  --explore-surface-soft: rgba(26, 40, 59, 0.5);
  --explore-surface-deep: rgba(14, 22, 34, 0.68);
  --explore-line: rgba(181, 204, 231, 0.68);
  --explore-line-strong: rgba(219, 235, 255, 0.84);
  --explore-copy: #ffffff;
  --explore-copy-muted: #d4e0ef;
  --explore-status-burn: #ff6259;
  --explore-status-corrosion: #7890ff;
  --explore-status-breakdown: #c784ff;
  --explore-status-weathering: #62e59b;
  --explore-status-freeze: #69ddff;
  --explore-status-r18: #ff78ba;
}

.page-explore .dungeon-backdrop {
  position: fixed;
  inset: 0 0 0 260px;
  z-index: 0;
  pointer-events: none;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0.72;
  filter: saturate(0.82) contrast(1.05);
}

.page-explore .dungeon-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 10, 15, 0.48), rgba(8, 10, 15, 0.24) 48%, rgba(8, 10, 15, 0.56)),
    linear-gradient(180deg, rgba(8, 10, 15, 0.22), rgba(8, 10, 15, 0.58));
}

.page-explore .page {
  position: relative;
  z-index: 1;
}

.page-explore .panel,
.page-explore .card,
.page-explore .message {
  background-color: rgba(18, 25, 38, 0.6);
  backdrop-filter: blur(2px);
}

  .room-card {
    border-color: rgba(0, 229, 255, 0.28);
  }

  .room-card--normal {
    background: rgba(18, 23, 34, 0.86);
  }

  .room-card--black {
    border-color: rgba(120, 16, 24, 0.82);
    background:
      linear-gradient(135deg, rgba(120, 16, 24, 0.18), transparent 50%),
      rgba(0, 0, 0, 0.9);
    color: #f0d8d8;
  }

  .room-card--glitch {
    border-color: rgba(255, 42, 109, 0.62);
    background:
      linear-gradient(90deg, rgba(255, 42, 109, 0.12), rgba(0, 229, 255, 0.08)),
      rgba(8, 10, 15, 0.88);
    box-shadow: inset 0 0 22px rgba(255, 42, 109, 0.08);
  }

  .room-risk-label {
    display: inline-flex;
    width: auto;
    margin: 0 0 8px;
    padding: 3px 8px;
    border: 1px solid rgba(0, 229, 255, 0.42);
    border-radius: 6px;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 900;
  }

  .room-risk-label--warning {
    border-color: rgba(252, 238, 9, 0.62);
    color: var(--yellow);
  }

  .room-risk-label--danger,
  .room-risk-label--anomaly {
    border-color: rgba(255, 59, 48, 0.72);
    color: #ffb4ae;
  }

  .room-risk-label--named {
    border-color: rgba(255, 42, 109, 0.72);
    color: var(--magenta);
  }

  .room-entry-text {
    border-left-color: var(--yellow);
    white-space: pre-wrap;
  }

  .floor-text {
    margin: 0 0 20px;
    border: 1px solid rgba(0, 229, 255, 0.34);
    border-left: 6px solid var(--cyan);
    border-radius: 8px;
    padding: 18px 20px;
    background:
      linear-gradient(90deg, rgba(0, 229, 255, 0.1), transparent 48%),
      rgba(18, 23, 34, 0.78);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(2px);
  }

  .floor-text h2 {
    margin: 0 0 8px;
    color: var(--cyan);
  }

  .floor-text p {
    margin: 0;
    white-space: pre-wrap;
  }

  .floor-text--black {
    border-color: rgba(120, 16, 24, 0.78);
    border-left-color: #ff6b6b;
    background:
      linear-gradient(135deg, rgba(120, 16, 24, 0.24), transparent 56%),
      rgba(0, 0, 0, 0.86);
  }

  .floor-text--glitch {
    border-color: rgba(255, 42, 109, 0.64);
    border-left-color: var(--magenta);
    background:
      linear-gradient(90deg, rgba(255, 42, 109, 0.14), rgba(0, 229, 255, 0.1)),
      rgba(8, 10, 15, 0.82);
  }

  .explore-vitals {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin: -8px 0 14px;
    border: 1px solid rgba(0, 229, 255, 0.48);
    border-left: 5px solid var(--cyan);
    border-radius: 7px;
    padding: 9px 12px;
    background: rgba(8, 10, 15, 0.9);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  }

  .explore-vitals--warning {
    border-color: #d97706;
    box-shadow: 0 0 20px rgba(217, 119, 6, 0.16);
  }

  .explore-vitals--danger {
    border-color: var(--red);
    box-shadow: 0 0 22px rgba(255, 59, 48, 0.22);
  }

  .explore-vitals__heading,
  .explore-vitals__status-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
  }

  .explore-vitals__resource {
    display: inline-flex;
    gap: 7px;
    align-items: baseline;
    color: var(--cyan);
    font-weight: 800;
  }

  .explore-vitals__resource strong {
    font-size: 17px;
  }

  .explore-vitals__resource--warning {
    color: #f59e0b;
  }

  .explore-vitals__resource--danger {
    color: #ff6259;
  }

  .explore-vitals__secondary {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-left: auto;
  }

  .explore-vitals__statuses,
  .explore-vitals__score {
    display: inline-flex;
    gap: 8px;
    align-items: center;
  }

  .explore-vitals__score {
    border-left: 1px solid rgba(142, 160, 184, 0.38);
    padding-left: 12px;
    color: var(--yellow);
    font-weight: 900;
  }

  .explore-vitals__score span {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  .run-status-details > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    color: var(--cyan);
    font-size: 1.25rem;
  }

  .run-status-details > summary span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .run-status-details[open] > summary {
    margin-bottom: 16px;
  }

  .run-status-details[open] > summary span {
    font-size: 0;
  }

  .run-status-details[open] > summary span::after {
    content: "詳細を閉じる";
    font-size: 12px;
  }

  @media (max-width: 760px) {
    .page-explore .dungeon-backdrop {
      inset: 0;
      opacity: 0.42;
    }

    .explore-vitals__heading {
      width: 100%;
    }

    .explore-vitals__secondary {
      width: 100%;
      margin-left: 0;
    }
  }

/* explore.php workspace redesign */
.page-explore .main-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.page-explore .content-wrap {
  min-height: 0;
  padding: 18px 24px;
}

.page-explore .page {
  width: min(1760px, 100%);
  height: 100%;
  min-height: 0;
}

.page-explore .page > h1,
.page-explore .page > .footer {
  display: none;
}

.explore-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.explore-runbar {
  position: relative;
  z-index: 2;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-left: 5px solid var(--cyan);
  border-radius: 8px;
  padding: 9px 16px;
  background: rgba(18, 25, 38, 0.62);
  color: var(--explore-copy);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(2px);
}

.explore-runbar > * {
  position: relative;
  z-index: 1;
}

.explore-runbar--warning {
  border-left-color: #f59e0b;
}

.explore-runbar--danger {
  border-left-color: var(--red);
}

.explore-location {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
}

.explore-location span,
.explore-runbar__metric small {
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92), 0 0 4px rgba(255, 255, 255, 0.18);
}

.explore-location span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.explore-location strong {
  display: -webkit-box;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--explore-copy);
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92), 0 0 4px rgba(255, 255, 255, 0.16);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.explore-location b {
  flex: 0 0 auto;
  color: var(--cyan);
  white-space: nowrap;
}

.explore-runbar__vitals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-left: auto;
}

.explore-runbar__metric {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.52);
  color: var(--explore-copy);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.explore-runbar__metric strong {
  color: #ffffff;
  font-size: 18px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92), 0 0 4px rgba(255, 255, 255, 0.18);
}

.explore-runbar__metric--vital {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "label value"
    "meter meter";
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
  padding: 0 8px;
}

.explore-runbar__metric--vital small {
  grid-area: label;
}

.explore-runbar__metric--vital strong {
  grid-area: value;
  text-align: right;
}

.explore-vital-meter {
  display: block;
  grid-area: meter;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.36), 0 0 5px rgba(255, 255, 255, 0.16);
}

.explore-vital-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #39d98a, #b6ff6b);
  box-shadow: 0 0 8px rgba(155, 255, 74, 0.36);
  filter: saturate(1.15) brightness(1.2);
}

.explore-runbar__metric--mp .explore-vital-meter i {
  background: linear-gradient(90deg, #18c9ee, #b5f5ff);
  box-shadow: 0 0 8px rgba(56, 220, 255, 0.46);
  filter: saturate(1.12) brightness(1.12);
}

.explore-runbar__metric--warning .explore-vital-meter i {
  background: linear-gradient(90deg, #f59e0b, #ffe08a);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.34);
}

.explore-runbar__metric--danger .explore-vital-meter i {
  background: linear-gradient(90deg, #ff4d5d, #ff9e96);
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.36);
}

.explore-runbar__metric--warning strong {
  color: #f59e0b;
}

.explore-runbar__metric--danger strong {
  color: #ff6259;
}

.explore-runbar__metric--score strong {
  color: var(--yellow);
}

.explore-status-summary--burn,
.explore-status-depth--burn {
  color: var(--explore-status-burn);
}

.explore-status-summary--corrosion,
.explore-status-depth--corrosion {
  color: var(--explore-status-corrosion);
}

.explore-status-summary--breakdown,
.explore-status-depth--breakdown {
  color: var(--explore-status-breakdown);
}

.explore-status-summary--weathering,
.explore-status-depth--weathering {
  color: var(--explore-status-weathering);
}

.explore-status-summary--freeze,
.explore-status-depth--freeze {
  color: var(--explore-status-freeze);
}

.explore-status-summary--r18,
.explore-status-depth--r18 {
  color: var(--explore-status-r18);
}

.explore-status-depth--normal {
  color: #ffffff;
}

.explore-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(310px, 0.75fr);
  gap: 12px;
  min-height: 0;
}

.explore-chat-mobile-launch {
  display: none;
}

.explore-primary,
.explore-secondary {
  display: grid;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.explore-primary {
  grid-template-rows: minmax(0, 1fr) minmax(236px, 0.72fr);
}

.explore-secondary {
  grid-template-rows: minmax(220px, 0.78fr) minmax(250px, 1fr);
}

.explore-pane {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--explore-line);
  border-radius: 8px;
  background: var(--explore-surface);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(2px);
}

.explore-pane__heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 43px;
  border-bottom: 1px solid var(--explore-line);
  padding: 11px 16px 9px;
}

.explore-pane__heading span {
  color: var(--cyan);
  font-size: 16px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.explore-pane__heading b {
  color: var(--explore-copy-muted);
  font-size: 15px;
}

.explore-scene {
  border-color: rgba(255, 42, 109, 0.54);
  background:
    linear-gradient(120deg, rgba(255, 42, 109, 0.1), transparent 50%),
    var(--explore-surface);
}

.explore-scene--black {
  border-color: rgba(255, 80, 80, 0.68);
  background: linear-gradient(135deg, rgba(120, 16, 24, 0.24), transparent 52%), var(--explore-surface);
}

.explore-scene--glitch {
  background: linear-gradient(110deg, rgba(255, 42, 109, 0.12), rgba(0, 229, 255, 0.06)), var(--explore-surface);
}

.explore-scene__scroll,
.explore-actions__scroll,
.explore-feed__scroll,
.explore-tab-panel {
  min-height: 0;
  overflow: auto;
  scrollbar-color: rgba(142, 160, 184, 0.42) transparent;
  scrollbar-width: thin;
}

.explore-scene__scroll {
  height: calc(100% - 43px);
  padding: clamp(18px, 3vh, 30px) clamp(20px, 3vw, 36px);
}

.explore-scene__context {
  margin-bottom: 10px;
  color: var(--explore-copy-muted);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.explore-scene h2 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: clamp(25px, 2.1vw, 36px);
  line-height: 1.3;
}

.explore-scene .room-risk-label {
  margin-bottom: 14px;
}

.explore-scene__lead {
  max-width: 45em;
  margin: 10px 0 0;
  color: #f1f5fb;
  font-size: clamp(17px, 1.25vw, 20px);
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.explore-scene__description {
  max-width: 62em;
  margin: 14px 0 0;
  border-top: 1px solid rgba(142, 160, 184, 0.2);
  padding-top: 11px;
  color: var(--muted);
  font-size: 16px;
}

.explore-room-event {
  margin-top: 22px;
  border-top: 1px solid rgba(142, 160, 184, 0.24);
  padding-top: 16px;
}

.explore-room-event__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--cyan);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.explore-room-event__meta .room-risk-label {
  margin: 0;
}

.explore-room-event h3 {
  margin: 0;
  font-size: clamp(21px, 1.65vw, 28px);
  line-height: 1.35;
}

.explore-room-event__entry {
  margin: 10px 0 0;
  color: #f1f5fb;
  font-size: 17px;
  line-height: 1.75;
}

.explore-item-use-log {
  margin-top: 24px;
  border-top: 1px solid rgba(0, 229, 255, 0.35);
  border-left: 3px solid var(--cyan);
  padding: 12px 14px;
  background: rgba(0, 229, 255, 0.06);
}

.explore-item-use-log__label {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.1em;
}

.explore-item-use-log p {
  margin: 6px 0 0;
  color: #f1f5fb;
  font-size: 17px;
  line-height: 1.7;
}

.explore-previous-result {
  margin-top: 22px;
  border-left: 3px solid var(--cyan);
  padding: 10px 14px;
  background: rgba(8, 10, 15, 0.48);
}

.explore-previous-result__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.explore-previous-result > strong {
  display: block;
  font-size: 16px;
}

.explore-previous-result p {
  margin: 7px 0 0;
  font-size: 17px;
  line-height: 1.7;
}

.explore-outcome {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
  white-space: nowrap;
}

.explore-outcome--success {
  color: var(--green);
}

.explore-outcome--failure {
  color: #ff7a72;
}

.explore-actions {
  border-color: rgba(255, 42, 109, 0.48);
}

.explore-actions__scroll {
  height: calc(100% - 43px);
  padding: 10px 14px 14px;
}

.explore-option-list {
  display: grid;
  gap: 8px;
}

.explore-option-list form {
  margin: 0;
}

.explore-option {
  display: grid;
  grid-template-columns: minmax(58px, auto) minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  margin: 0;
  border: 1px solid rgba(38, 50, 68, 0.96);
  border-radius: 7px;
  padding: 9px 13px;
  background: rgba(18, 25, 38, 0.44);
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.explore-option:hover,
.explore-option:focus-visible {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.1);
  outline: none;
  transform: translateX(2px);
}

.explore-option--result {
  min-height: 82px;
}

.explore-option--result-success {
  border-color: rgba(57, 255, 20, 0.58);
  background: linear-gradient(100deg, rgba(57, 255, 20, 0.1), transparent 58%), rgba(18, 25, 38, 0.52);
}

.explore-option--result-failure {
  border-color: rgba(255, 59, 48, 0.64);
  background: linear-gradient(100deg, rgba(255, 59, 48, 0.13), transparent 58%), rgba(18, 25, 38, 0.52);
}

.explore-previous-result--finish {
  margin-top: 18px;
}

.theme-r18 .explore-option:hover,
.theme-r18 .explore-option:focus-visible {
  background: rgba(255, 42, 109, 0.12);
}

.explore-option.room-warning {
  border-color: rgba(252, 238, 9, 0.54);
  background: rgba(252, 238, 9, 0.07);
}

.explore-option.room-danger,
.explore-option.room-card--black {
  border-color: rgba(255, 59, 48, 0.62);
  background: linear-gradient(110deg, rgba(120, 16, 24, 0.18), transparent 56%), rgba(8, 10, 15, 0.62);
}

.explore-option.room-card--glitch {
  border-color: rgba(255, 42, 109, 0.58);
  background: linear-gradient(100deg, rgba(255, 42, 109, 0.1), rgba(0, 229, 255, 0.06)), rgba(18, 25, 38, 0.5);
}

.explore-option__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 44px;
  border: 1px solid rgba(255, 42, 109, 0.66);
  border-radius: 6px;
  padding: 4px 7px;
  color: var(--cyan);
  font-size: 18px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.explore-option__copy,
.explore-option__meta {
  min-width: 0;
}

.explore-option__copy strong,
.explore-option__copy small {
  display: block;
}

.explore-option__copy strong {
  font-size: 16px;
  line-height: 1.35;
}

.explore-option__copy small {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.explore-option__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 210px;
  color: var(--muted);
  text-align: right;
}

.explore-option__meta small {
  font-size: 15px;
}

.explore-option__meta .room-risk-label {
  margin: 0;
}

.explore-option__arrow {
  color: var(--cyan);
  font-size: 28px;
  line-height: 1;
}

.explore-inline-alert {
  border: 1px solid rgba(255, 59, 48, 0.58);
  border-left: 5px solid var(--red);
  border-radius: 7px;
  padding: 14px;
  background: rgba(255, 59, 48, 0.08);
  color: #ffb4ae;
}

.explore-inline-alert strong,
.explore-inline-alert span {
  display: block;
}

.explore-feed {
  border-color: rgba(0, 229, 255, 0.68);
}

.explore-feed__scroll {
  height: calc(100% - 43px);
  padding: 10px 12px 14px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
}

.explore-feed__result {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--explore-line);
  padding: 2px 2px 9px;
}

.explore-feed__result small {
  min-width: 0;
  overflow: visible;
  overflow-wrap: anywhere;
  color: var(--explore-copy-muted);
  font-size: 15px;
  line-height: 1.5;
  white-space: normal;
}

.explore-feed-row {
  display: grid;
  grid-template-columns: minmax(70px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 39px;
  margin-top: 6px;
  border: 1px solid var(--explore-line);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--explore-surface-soft);
}

.explore-feed-row span {
  color: var(--explore-copy-muted);
  font-size: 15px;
  font-weight: 800;
}

.explore-feed-row strong {
  overflow-wrap: anywhere;
  text-align: right;
  font-size: 17px;
}

.explore-feed-row--positive strong {
  color: var(--green);
}

.explore-feed-row--negative strong {
  color: #ff6f67;
}

.explore-feed-row--reward {
  grid-template-columns: 48px minmax(0, 1fr);
}

.explore-feed-row--reward strong {
  color: var(--cyan);
  font-size: 16px;
}

.explore-feed-row--item strong {
  color: var(--cyan);
}

.explore-feed-note,
.explore-feed__notice,
.explore-feed-empty {
  margin-top: 8px;
  border-left: 3px solid rgba(142, 160, 184, 0.5);
  padding: 7px 9px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.explore-feed__notice--success {
  border-left-color: var(--green);
  color: var(--text);
}

.explore-feed__notice--error {
  border-left-color: var(--red);
  color: #ffb4ae;
}

.explore-data-tabs {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.explore-character-summary {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 82px;
  border-bottom: 1px solid rgba(38, 50, 68, 0.94);
  padding: 10px 13px;
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.07), transparent 70%);
}

.explore-character-summary__icon {
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  border: 1px solid var(--line-hot);
  border-radius: 8px;
}

.explore-character-summary__icon .character-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.explore-character-summary__icon .character-image-placeholder {
  font-size: 12px;
}

.explore-character-summary__identity {
  min-width: 0;
}

.explore-character-summary__identity small,
.explore-character-summary__identity strong,
.explore-character-summary__identity span {
  display: block;
}

.explore-character-summary__identity small {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.explore-character-summary__identity strong {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explore-character-summary__identity span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.explore-tab-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.explore-tab-labels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid rgba(38, 50, 68, 0.94);
}

.explore-tab-labels label {
  min-width: 0;
  border-right: 1px solid rgba(38, 50, 68, 0.82);
  padding: 10px 5px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 850;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
}

.explore-tab-labels label:last-child {
  border-right: 0;
}

.explore-tab-labels label.explore-tab-label--over-capacity {
  color: #ff6259;
  text-shadow: 0 0 5px rgba(255, 59, 48, 0.3);
}

#explore-tab-inventory:checked ~ .explore-tab-labels label.explore-tab-label--over-capacity,
#explore-finish-tab-inventory:checked ~ .explore-tab-labels label.explore-tab-label--over-capacity {
  box-shadow: inset 0 -3px #ff6259;
  background: rgba(255, 59, 48, 0.1);
  color: #ff8c86;
}

.explore-tab-panels {
  min-height: 0;
}

.explore-tab-panel {
  display: none;
  height: 100%;
  padding: 10px;
}

#explore-tab-inventory:checked ~ .explore-tab-labels label[for="explore-tab-inventory"],
#explore-tab-status:checked ~ .explore-tab-labels label[for="explore-tab-status"],
#explore-tab-equipment:checked ~ .explore-tab-labels label[for="explore-tab-equipment"],
#explore-tab-log:checked ~ .explore-tab-labels label[for="explore-tab-log"],
#explore-finish-tab-inventory:checked ~ .explore-tab-labels label[for="explore-finish-tab-inventory"],
#explore-finish-tab-status:checked ~ .explore-tab-labels label[for="explore-finish-tab-status"],
#explore-finish-tab-equipment:checked ~ .explore-tab-labels label[for="explore-finish-tab-equipment"],
#explore-finish-tab-log:checked ~ .explore-tab-labels label[for="explore-finish-tab-log"] {
  box-shadow: inset 0 -3px var(--cyan);
  background: rgba(0, 229, 255, 0.08);
  color: var(--text);
}

#explore-tab-inventory:focus-visible ~ .explore-tab-labels label[for="explore-tab-inventory"],
#explore-tab-status:focus-visible ~ .explore-tab-labels label[for="explore-tab-status"],
#explore-tab-equipment:focus-visible ~ .explore-tab-labels label[for="explore-tab-equipment"],
#explore-tab-log:focus-visible ~ .explore-tab-labels label[for="explore-tab-log"],
#explore-finish-tab-inventory:focus-visible ~ .explore-tab-labels label[for="explore-finish-tab-inventory"],
#explore-finish-tab-status:focus-visible ~ .explore-tab-labels label[for="explore-finish-tab-status"],
#explore-finish-tab-equipment:focus-visible ~ .explore-tab-labels label[for="explore-finish-tab-equipment"],
#explore-finish-tab-log:focus-visible ~ .explore-tab-labels label[for="explore-finish-tab-log"] {
  outline: 2px solid var(--yellow);
  outline-offset: -3px;
}

#explore-tab-inventory:checked ~ .explore-tab-panels [data-tab-panel="inventory"],
#explore-tab-status:checked ~ .explore-tab-panels [data-tab-panel="status"],
#explore-tab-equipment:checked ~ .explore-tab-panels [data-tab-panel="equipment"],
#explore-tab-log:checked ~ .explore-tab-panels [data-tab-panel="log"],
#explore-finish-tab-inventory:checked ~ .explore-tab-panels [data-tab-panel="inventory"],
#explore-finish-tab-status:checked ~ .explore-tab-panels [data-tab-panel="status"],
#explore-finish-tab-equipment:checked ~ .explore-tab-panels [data-tab-panel="equipment"],
#explore-finish-tab-log:checked ~ .explore-tab-panels [data-tab-panel="log"] {
  display: block;
}

.explore-inventory-list,
.explore-equipment-list {
  display: grid;
  gap: 7px;
}

.explore-inventory-picker {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.explore-inventory-row,
.explore-equipment-list > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid rgba(38, 50, 68, 0.86);
  border-radius: 6px;
  padding: 8px 9px;
  background: rgba(8, 10, 15, 0.32);
}

.explore-inventory-row--selected {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
}

.explore-inventory-row > span,
.explore-inventory-row small,
.explore-inventory-row strong,
.explore-equipment-list small,
.explore-equipment-list strong {
  display: block;
  min-width: 0;
}

.explore-inventory-select {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  margin: -8px 0 -8px -9px;
  border: 0;
  padding: 8px 0 8px 9px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.explore-inventory-select > span {
  display: block;
  min-width: 0;
}

.explore-inventory-select:hover strong,
.explore-inventory-select:focus-visible strong,
.explore-inventory-select.is-selected strong {
  color: var(--cyan);
}

.explore-inventory-select:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--yellow);
  outline-offset: -2px;
}

.explore-inventory-row small,
.explore-equipment-list small {
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
}

.explore-inventory-row strong,
.explore-equipment-list strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.explore-inventory-actions {
  display: flex;
  gap: 5px;
  flex: 0 0 auto;
}

.explore-inventory-actions form {
  margin: 0;
}

.explore-inventory-actions button {
  border: 1px solid rgba(0, 229, 255, 0.4);
  border-radius: 5px;
  padding: 5px 8px;
  background: rgba(0, 229, 255, 0.08);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}

.explore-inventory-detail {
  display: none;
  flex: 0 0 100%;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--explore-line);
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--explore-surface-soft);
}

.explore-inventory-detail__label,
.explore-inventory-detail strong,
.explore-inventory-detail p {
  display: block;
}

.explore-inventory-detail__label {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.explore-inventory-detail strong {
  margin-top: 2px;
  color: var(--explore-copy);
  font-size: 16px;
}

.explore-inventory-detail p {
  margin: 4px 0 0;
  color: var(--explore-copy-muted);
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* Desktop: show an item's effect only while the pointer/keyboard is over it. */
@media (hover: hover) and (pointer: fine) {
  .explore-inventory-row--selectable:hover .explore-inventory-detail,
  .explore-inventory-row--selectable:focus-within .explore-inventory-detail {
    display: block;
  }
}

/* Touch devices: the script toggles a persistent selection on tap. */
@media (hover: none), (pointer: coarse) {
  .explore-inventory-row--selected .explore-inventory-detail,
  .explore-inventory-row--selectable:focus-within .explore-inventory-detail {
    display: block;
  }
}

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

.explore-stat-grid span {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  border: 1px solid rgba(38, 50, 68, 0.82);
  border-radius: 5px;
  padding: 7px 8px;
  background: rgba(8, 10, 15, 0.32);
}

.explore-stat-grid small {
  color: var(--muted);
  font-size: 15px;
}

.explore-stat-grid strong {
  font-size: 17px;
}

.explore-log-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.explore-log-list li {
  border-left: 3px solid rgba(142, 160, 184, 0.44);
  padding: 7px 9px;
  background: rgba(8, 10, 15, 0.32);
  font-size: 17px;
  line-height: 1.65;
}

.explore-log-list li.explore-log-battle {
  border-left: 0;
  padding: 0;
  background: transparent;
}

.explore-log-battle details {
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 6px;
  background: rgba(8, 10, 15, 0.28);
}

.explore-log-battle summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 8px 10px;
  color: #ffffff;
  font-weight: 850;
}

.explore-log-battle summary::-webkit-details-marker {
  display: none;
}

.explore-log-battle summary::before {
  content: "▶";
  flex: 0 0 auto;
  color: var(--cyan);
  font-size: 11px;
  transition: transform 0.16s ease;
}

.explore-log-battle details[open] summary::before {
  transform: rotate(90deg);
}

.explore-log-battle summary > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explore-log-battle__outcome {
  flex: 0 0 auto;
  font-size: 14px;
}

.explore-log-battle__outcome--success {
  color: var(--green);
}

.explore-log-battle__outcome--failure {
  color: #ff7a72;
}

.explore-log-battle__outcome--warning {
  color: var(--yellow);
}

.explore-log-battle__body {
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  padding: 7px 10px 9px 27px;
}

.explore-log-battle__entry {
  padding: 5px 0;
  color: #f1f5fb;
  font-size: 16px;
  line-height: 1.55;
}

.explore-log-battle__entry + .explore-log-battle__entry {
  border-top: 1px solid rgba(142, 160, 184, 0.2);
}

.explore-data-empty {
  margin: 0;
  padding: 16px;
  color: var(--muted);
  font-size: 16px;
  text-align: center;
}

.explore-chat {
  position: relative;
  z-index: 2;
  isolation: isolate;
  display: none;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(18, 25, 38, 0.52);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(2px);
}

.explore-chat > * {
  position: relative;
  z-index: 1;
}

.explore-chat__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 53px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.58);
  padding: 9px 12px;
}

.explore-chat__heading > div:first-child {
  min-width: 0;
}

.explore-chat__heading span,
.explore-chat__heading b {
  display: block;
}

.explore-chat__heading span {
  color: var(--cyan);
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92), 0 0 5px rgba(0, 229, 255, 0.26);
}

.explore-chat__heading b {
  overflow: hidden;
  margin-top: 2px;
  color: var(--explore-copy);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92), 0 0 4px rgba(255, 255, 255, 0.16);
}

.explore-chat__heading-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.explore-chat__heading-actions button,
.explore-chat__heading-actions a {
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 5px;
  padding: 5px 7px;
  background: rgba(25, 38, 57, 0.95);
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.explore-chat__heading-actions button:hover,
.explore-chat__heading-actions button:focus-visible,
.explore-chat__heading-actions a:hover,
.explore-chat__heading-actions a:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan);
  outline: none;
}

.explore-chat__tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(14, 21, 32, 0.4);
}

.explore-chat__tabs button {
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.48);
  border-bottom: 2px solid transparent;
  padding: 8px 5px 7px;
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92);
}

.explore-chat__tabs button:last-child {
  border-right: 0;
}

.explore-chat__tabs button:hover,
.explore-chat__tabs button:focus-visible,
.explore-chat__tabs button.is-active {
  border-bottom-color: var(--cyan);
  background: rgba(0, 229, 255, 0.09);
  color: #ffffff;
  outline: none;
}

.explore-chat__log {
  display: flex;
  min-height: 0;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  overflow-y: scroll;
  padding: 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  scrollbar-color: rgba(142, 160, 184, 0.42) transparent;
  scrollbar-width: thin;
}

/* Keep a short log visually anchored at the bottom, while allowing the
 * normal scroll box to grow upward when the 20-message history is taller than
 * the panel. A flex-end container hides start-side overflow in some browsers.
 */
.explore-chat__log > :first-child {
  margin-top: auto;
}

.explore-chat__log > * {
  flex: 0 0 auto;
}

.explore-chat-message {
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 6px;
  padding: 8px 9px;
  background: rgba(34, 50, 73, 0.38);
}

.explore-chat-message.is-info {
  border-color: rgba(84, 224, 255, 0.86);
  background: rgba(0, 171, 204, 0.16);
}

.explore-chat-message__layout {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
}

.explore-chat-message__icon {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 5px;
  object-fit: cover;
}

.explore-chat-message__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.explore-chat-message__head strong {
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92);
}

.explore-chat-message__head time {
  flex: 0 0 auto;
  color: #eef5ff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92);
}

.explore-chat-message__body {
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.55;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92);
}

/* Keep rainbow markup identical to the regular chat design. The body shadow
   otherwise remains visible behind transparent gradient text and looks embossed. */
.explore-chat-message__body .markup-rainbow {
  text-shadow: none;
}

.explore-chat-empty {
  margin: auto 0;
  padding: 16px 8px;
  color: #eef5ff;
  font-size: 15px;
  text-align: center;
}

.explore-chat__composer {
  border-top: 1px solid rgba(255, 255, 255, 0.58);
  padding: 8px 10px 10px;
  background: rgba(14, 21, 32, 0.56);
}

.explore-chat__status {
  min-height: 18px;
  color: #eef5ff;
  font-size: 12px;
}

.explore-chat__status.is-error {
  color: #ff9e96;
}

.explore-chat__composer form {
  display: grid;
  gap: 7px;
}

.explore-chat__composer-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
}

.explore-chat__icon-frame {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 6px;
}

.explore-chat__icon-frame .character-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.explore-chat__icon-frame .character-image-placeholder {
  font-size: 8px;
}

.explore-chat__composer-fields {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.explore-chat__icon-select {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #ffffff;
  font-size: 12px;
}

.explore-chat__icon-select select,
.explore-chat__composer textarea {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 5px;
  background: rgba(24, 37, 56, 0.98);
  color: #ffffff;
  font: inherit;
}

.explore-chat__icon-select select {
  flex: 1;
  padding: 3px 4px;
  font-size: 12px;
}

.explore-chat__composer textarea {
  width: 100%;
  min-height: 52px;
  resize: vertical;
  padding: 6px 7px;
  font-size: 14px;
  line-height: 1.45;
}

.explore-chat__composer textarea::placeholder {
  color: #d4e0ef;
  opacity: 1;
}

.explore-chat__submit {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 5px;
  padding: 6px 8px;
  background: rgba(0, 185, 220, 0.2);
  color: #ffffff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.explore-chat__submit:hover,
.explore-chat__submit:focus-visible {
  background: rgba(0, 229, 255, 0.22);
  outline: none;
}

@media (min-width: 1250px) {
  .explore-shell {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.34fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 12px;
  }

  .explore-shell > .explore-runbar,
  .explore-shell > .explore-workspace {
    grid-column: 1;
  }

  .explore-shell > .explore-runbar {
    grid-row: 1;
  }

  .explore-shell > .explore-workspace {
    grid-row: 2;
  }

  .explore-workspace {
    grid-template-columns: minmax(0, 1.75fr) minmax(300px, 0.75fr);
  }

  .explore-chat {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: grid;
    height: 100%;
  }
}

@media (max-width: 1100px) {
  .explore-runbar {
    align-items: flex-start;
    gap: 10px;
  }

  .explore-location {
    min-width: 200px;
  }

  .explore-runbar__vitals {
    grid-template-columns: repeat(2, minmax(118px, 1fr));
  }
}

@media (max-width: 980px), (max-height: 620px) {
  .page-explore .main-column {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .page-explore .page {
    height: auto;
    min-height: 0;
  }

  .explore-shell,
  .explore-primary,
  .explore-secondary {
    display: block;
  }

  .explore-workspace {
    grid-template-columns: 1fr;
  }

  .explore-pane {
    margin-top: 12px;
  }

  .explore-scene__scroll,
  .explore-actions__scroll,
  .explore-feed__scroll,
  .explore-tab-panel {
    height: auto;
    max-height: 430px;
  }

  .explore-secondary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .explore-chat {
    display: none;
  }

  .explore-chat-mobile-launch {
    display: block;
    margin: 0 0 12px;
    border: 1px solid rgba(0, 229, 255, 0.52);
    border-radius: 7px;
    padding: 10px 12px;
    background: rgba(0, 229, 255, 0.08);
    color: var(--cyan);
    font-size: 14px;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
  }

  .explore-chat-mobile-launch:hover,
  .explore-chat-mobile-launch:focus-visible {
    background: rgba(0, 229, 255, 0.16);
    outline: none;
  }
}

@media (max-width: 760px) {
  .page-explore .topbar {
    min-height: 60px;
    padding: 10px 16px;
  }

  .page-explore .terminal-status {
    display: none;
  }

  .page-explore .content-wrap {
    padding: 10px 12px 22px;
  }

  .explore-runbar {
    position: sticky;
    top: 60px;
    z-index: 4;
    display: block;
    padding: 9px 11px;
  }

  .explore-vital-maximum {
    display: none;
  }

  .explore-location {
    min-width: 0;
  }

  .explore-location span {
    display: none;
  }

  .explore-runbar__vitals {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-top: 7px;
  }

  .explore-runbar__metric {
    display: block;
    border-left: 0;
    text-align: center;
  }

  .explore-runbar__metric small,
  .explore-runbar__metric strong {
    display: block;
  }

  .explore-runbar__metric small {
    font-size: 12px;
  }

  .explore-runbar__metric strong {
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
  }

  .explore-secondary {
    display: block;
  }

  .explore-scene__scroll {
    max-height: none;
    padding: 22px 18px;
  }

  .explore-scene h2 {
    font-size: 26px;
  }

  .explore-scene__lead {
    font-size: 17px;
    line-height: 1.82;
  }

  .explore-actions__scroll,
  .explore-feed__scroll,
  .explore-tab-panel {
    max-height: none;
  }

  .explore-option {
    grid-template-columns: 64px minmax(0, 1fr) 14px;
    min-height: 76px;
    padding: 10px;
  }

  .explore-option__index {
    min-width: 0;
    min-height: 42px;
    padding-right: 4px;
    padding-left: 4px;
    font-size: 16px;
  }

  .explore-option__meta {
    grid-column: 2;
    justify-content: flex-start;
    max-width: none;
    text-align: left;
  }

  .explore-option__arrow {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .explore-option--result {
    grid-template-columns: 72px minmax(0, 1fr) 14px;
  }

  .explore-option--result .explore-option__index {
    min-width: 68px;
    font-size: 14px;
  }

  .explore-feed {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 50vh;
    height: min(430px, 50dvh);
    min-height: 220px;
    max-height: 50vh;
    max-height: min(430px, 50dvh);
  }

  .explore-feed__scroll {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    touch-action: pan-y;
  }

  .explore-tab-labels {
    position: sticky;
    bottom: 0;
    z-index: 2;
    order: 2;
    border-top: 1px solid rgba(38, 50, 68, 0.94);
    border-bottom: 0;
    background: rgba(8, 10, 15, 0.98);
  }

  .explore-tab-labels label {
    min-height: 48px;
    padding: 14px 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .explore-option {
    transition: none;
  }
}


/* result.php */
.result-hero {
    overflow: hidden;
    margin-bottom: 18px;
    border: 1px solid rgba(0, 229, 255, 0.48);
    border-radius: 8px;
    padding: 24px;
    background:
      linear-gradient(120deg, rgba(0, 229, 255, 0.16), transparent 46%),
      linear-gradient(290deg, rgba(255, 42, 109, 0.14), transparent 52%),
      rgba(18, 23, 34, 0.9);
    box-shadow: 0 0 34px rgba(0, 229, 255, 0.12);
  }

  .result-status {
    color: var(--yellow);
    font-size: clamp(42px, 8vw, 88px);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: 0;
  }

  .result-status.failed {
    color: #ffb4ae;
  }

  .result-vital-value--warning {
    color: #f59e0b !important;
  }

  .result-vital-value--danger {
    color: #ff6259 !important;
  }

  .result-settle-home-form {
    margin-top: 18px;
  }

  .result-settle-home-button {
    width: 100%;
    border-color: var(--green);
    background:
      linear-gradient(90deg, rgba(155, 255, 74, 0.2), rgba(0, 229, 255, 0.14)),
      rgba(18, 23, 34, 0.96);
    color: var(--green);
  }

  .result-title {
    margin: 12px 0 6px;
    color: var(--cyan);
    font-size: 13px;
    font-weight: 900;
  }

  .result-lead {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    font-weight: 800;
  }

  .result-section {
    margin-bottom: 16px;
  }

  .result-section h2 {
    color: var(--cyan);
  }

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

  .result-performance-layout {
    display: grid;
    grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
  }

  .result-character-visual {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 420px;
    border: 1px solid rgba(0, 229, 255, 0.42);
    border-radius: 8px;
    background:
      linear-gradient(rgba(8, 10, 15, 0.26), rgba(8, 10, 15, 0.78)),
      var(--table-grid) center / cover,
      rgba(8, 10, 15, 0.9);
    box-shadow: inset 0 0 28px rgba(0, 229, 255, 0.08);
  }

  .result-character-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: var(--scanline) center / 360px auto repeat;
    opacity: 0.08;
    mix-blend-mode: screen;
  }

  .result-visual-label,
  .result-visual-meta {
    position: relative;
    z-index: 1;
    padding: 10px 12px;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 900;
  }

  .result-visual-label {
    border-bottom: 1px solid rgba(0, 229, 255, 0.24);
  }

  .result-visual-meta {
    border-top: 1px solid rgba(0, 229, 255, 0.24);
    background: rgba(8, 10, 15, 0.66);
    color: var(--muted);
  }

  .result-character-image-wrap {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: end center;
    min-height: 330px;
    padding: 14px 12px 0;
  }

  .result-character-image {
    width: min(100%, 240px);
    max-height: 390px;
    object-fit: contain;
    object-position: bottom center;
    filter: drop-shadow(0 0 16px rgba(0, 229, 255, 0.18));
  }

  .result-metric {
    border-color: rgba(0, 229, 255, 0.32);
  }

  .result-metric .value {
    color: var(--yellow);
    font-size: 24px;
  }

  .legacy-result-metric-grid {
    display: none;
  }

.page-result .page > section.result-section:nth-of-type(5) .grid .item:nth-child(n+5) {
    display: none;
  }

  .result-item-list,
  .result-notice-list,
  .result-log-list {
    display: grid;
    gap: 10px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
  }

  .result-reward-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .result-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid rgba(0, 229, 255, 0.42);
    border-radius: 6px;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 900;
  }

  .result-badge.rare {
    border-color: rgba(252, 238, 9, 0.62);
    color: var(--yellow);
  }

  .result-badge.speed {
    border-color: rgba(155, 255, 74, 0.62);
    color: var(--green);
  }

  .result-badge.critical {
    border-color: rgba(255, 42, 109, 0.72);
    color: var(--magenta);
  }

  .result-archive summary,
  .battle-log-entry summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 800;
    overflow-wrap: anywhere;
  }

  .battle-log-entry {
    border-left: 5px solid var(--cyan);
  }

  .battle-log-detail {
    display: grid;
    gap: 10px;
    margin-top: 12px;
  }

  .battle-log-detail-part {
    padding-top: 10px;
    border-top: 1px solid rgba(38, 50, 68, 0.9);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .result-actions {
    display: grid;
    gap: 12px;
  }

  .result-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
  }

  .result-confirmation-card {
    display: grid;
    gap: 14px;
    border-width: 2px;
  }

  .result-confirmation-card--clone {
    border-color: rgba(255, 98, 89, 0.76);
    background:
      linear-gradient(120deg, rgba(255, 98, 89, 0.12), transparent 58%),
      rgba(18, 23, 34, 0.9);
  }

  .result-confirmation-card--rescue {
    border-color: rgba(245, 158, 11, 0.76);
    background:
      linear-gradient(120deg, rgba(245, 158, 11, 0.1), transparent 58%),
      rgba(18, 23, 34, 0.9);
  }

  .result-confirmation-warning {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 12px 14px;
    border-left: 4px solid currentColor;
    color: var(--text);
    background: rgba(8, 10, 15, 0.38);
  }

  .result-confirmation-card--clone .result-confirmation-warning {
    color: #ffb4ae;
  }

  .result-confirmation-card--rescue .result-confirmation-warning {
    color: #ffd37a;
  }

  .result-confirmation-warning p {
    margin: 0;
    line-height: 1.65;
  }

  .result-confirmation-warning strong {
    color: #fff;
    font-weight: 900;
  }

  .result-confirmation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .result-confirmation-actions form {
    margin: 0;
  }

  .result-confirmation-cancel {
    border-color: rgba(188, 204, 229, 0.68);
    background: transparent;
    color: var(--text);
  }

  @media (max-width: 760px) {
    .result-performance-layout,
    .result-metric-grid {
      grid-template-columns: 1fr;
    }

    .result-character-visual {
      min-height: 360px;
    }

    .result-confirmation-actions,
    .result-confirmation-actions form,
    .result-confirmation-actions .button {
      width: 100%;
    }
  }


/* battle.php */
.battle-compare {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
  }

  .battle-column {
    display: grid;
    gap: 16px;
  }

  .battle-enemy-phase:not(:last-child) {
    margin-bottom: 12px;
  }

  .battle-enemy-action-list {
    margin-top: 10px;
  }

  .battle-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    border: 1px solid rgba(0, 229, 255, 0.28);
    border-radius: 8px;
    overflow: hidden;
  }

  .battle-table th,
  .battle-table td {
    border-bottom: 1px solid rgba(38, 50, 68, 0.92);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
  }

  .battle-table tr:last-child th,
  .battle-table tr:last-child td {
    border-bottom: 0;
  }

  .battle-table th {
    width: 38%;
    background: rgba(0, 229, 255, 0.12);
    color: var(--muted);
    font-size: 13px;
  }

  .action-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .action-card {
    background: rgba(8, 10, 15, 0.52);
    border: 1px solid rgba(38, 50, 68, 0.9);
    border-radius: 6px;
    padding: 12px;
  }

  .action-title {
    display: block;
    font-weight: 800;
  }

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

  .status-effects {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    font-weight: 800;
  }

  .status-effect {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 20px;
    border-radius: 999px;
    background: rgba(8, 10, 15, 0.72);
    border: 1px solid currentColor;
    font-size: 13px;
    line-height: 1;
    cursor: help;
  }

  .status-burn {
    color: #d64545;
  }

  .status-corrosion {
    color: #2f80ed;
  }

  .status-breakdown {
    color: #7c3aed;
  }

  .status-weathering {
    color: #2f855a;
  }

  .status-freeze {
    color: #0891b2;
  }

  .use-item-current-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 18px;
  }

  .use-item-current-vitals,
  .use-item-current-statuses {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
  }

  .use-item-current-vitals strong {
    color: var(--cyan);
  }

  .use-item-current-statuses .label {
    margin: 0;
  }

  @media (max-width: 620px) {
    .use-item-current-statuses {
      width: 100%;
    }
  }

  .reward-pair {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
  }

  .reward-score {
    color: var(--cyan);
  }

  .reward-money {
    color: var(--yellow);
  }

  @media (max-width: 900px) {
    .battle-compare,
    .battle-actions {
      grid-template-columns: 1fr;
    }
  }

/* battle.php combat forecast terminal */
.page-battle {
  --battle-surface: rgba(13, 25, 36, 0.94);
  --battle-surface-soft: rgba(17, 31, 44, 0.94);
  --battle-surface-deep: rgba(7, 16, 25, 0.97);
  --battle-line: rgba(107, 143, 170, 0.62);
  --battle-copy: #e7f4ff;
  --battle-muted: #afc4d6;
  --battle-player: #18d9ef;
  --battle-enemy: #ff4f82;
  --battle-warning: #ffbd3e;
  --battle-ready: #77e69c;
}

.page-battle .main-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.page-battle .content-wrap {
  min-height: 0;
  padding: 14px 18px;
}

.page-battle .page {
  width: min(1760px, 100%);
  height: 100%;
  min-height: 0;
}

.page-battle .page > h1,
.page-battle .page > .footer {
  display: none;
}

.battle-terminal-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--battle-line);
  border-radius: 9px;
  background:
    radial-gradient(circle at 32% 0%, rgba(24, 217, 239, 0.11), transparent 34%),
    linear-gradient(135deg, rgba(7, 16, 25, 0.98), rgba(9, 17, 28, 0.98) 68%, rgba(18, 14, 27, 0.98));
  color: var(--battle-copy);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

.battle-terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 45px;
  border-bottom: 1px solid var(--battle-line);
  padding: 7px 13px;
  background: rgba(8, 13, 19, 0.98);
}

.battle-terminal-brand,
.battle-terminal-context {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.battle-terminal-brand strong {
  color: var(--battle-player);
  font-size: 13px;
  letter-spacing: 0.1em;
}

.battle-terminal-brand span,
.battle-terminal-context span {
  color: var(--battle-muted);
  font-size: 11px;
}

.battle-terminal-context span {
  overflow: hidden;
  max-width: 260px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-terminal-context b {
  flex: 0 0 auto;
  border: 1px solid var(--battle-enemy);
  padding: 4px 7px;
  color: #ffc0d2;
  font-size: 11px;
}

.battle-terminal-runbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) minmax(190px, 1.1fr);
  gap: 1px;
  border-bottom: 1px solid var(--battle-line);
  background: var(--battle-line);
}

.battle-terminal-runbar > div {
  background: rgba(13, 25, 36, 0.96);
}

.battle-terminal-meter {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 9px;
  padding: 7px 11px;
}

.battle-terminal-meter span,
.battle-terminal-scan span {
  color: var(--battle-muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.battle-terminal-meter strong {
  text-align: right;
  font-size: 13px;
}

.battle-terminal-meter i {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  background: rgba(92, 117, 136, 0.3);
}

.battle-terminal-meter i b {
  display: block;
  height: 100%;
  background: var(--battle-ready);
}

.battle-terminal-meter--mp i b {
  background: linear-gradient(90deg, #18c9ee, #b5f5ff);
  box-shadow: 0 0 7px rgba(56, 220, 255, 0.42);
}

.battle-terminal-meter--enemy i b {
  background: var(--battle-enemy);
}

.battle-terminal-scan {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-content: center;
  padding: 7px 11px;
}

.battle-terminal-scan strong,
.battle-terminal-scan b {
  text-align: right;
}

.battle-terminal-scan strong {
  color: var(--battle-ready);
  font-size: 13px;
}

.battle-terminal-scan b {
  grid-column: 1 / -1;
  color: var(--battle-ready);
  font-size: 9px;
  font-weight: 700;
}

.battle-terminal-workspace {
  display: grid;
  grid-template-columns: minmax(175px, 0.65fr) minmax(520px, 2.25fr) minmax(200px, 0.78fr);
  gap: 9px;
  min-height: 0;
  padding: 9px;
}

.battle-terminal-intel,
.battle-terminal-matrix {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--battle-line);
  background: var(--battle-surface);
}

.battle-terminal-intel {
  align-self: stretch;
}

.battle-terminal-section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 37px;
  border-bottom: 1px solid var(--battle-line);
  padding: 8px 10px;
  background: rgba(9, 19, 28, 0.96);
}

.battle-terminal-section-title span {
  color: var(--battle-player);
  font-size: 9px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.battle-terminal-section-title strong {
  font-size: 13px;
}

.battle-terminal-matrix-title small {
  margin-left: auto;
  color: var(--battle-muted);
  font-size: 9px;
  text-align: right;
}

.battle-terminal-identity {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 10px;
}

.battle-terminal-avatar {
  width: 50px;
  aspect-ratio: 1;
  border: 1px solid var(--battle-player);
  border-radius: 0;
  background: linear-gradient(135deg, rgba(24, 217, 239, 0.16), rgba(8, 19, 28, 0.96));
  color: var(--battle-player);
}

.battle-terminal-avatar--enemy {
  border-color: var(--battle-enemy);
  background: linear-gradient(135deg, rgba(255, 79, 130, 0.18), rgba(25, 12, 20, 0.96));
  color: #ff9fba;
}

.battle-terminal-avatar .character-image-placeholder {
  display: grid;
  place-items: center;
  inset: 0;
  font-size: 11px;
}

.battle-terminal-avatar .character-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.battle-terminal-identity > div:last-child {
  min-width: 0;
}

.battle-terminal-identity small,
.battle-terminal-identity strong,
.battle-terminal-identity span {
  display: block;
}

.battle-terminal-identity small {
  color: var(--battle-muted);
  font-size: 9px;
}

.battle-terminal-identity strong {
  overflow: hidden;
  margin: 3px 0;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-terminal-identity span {
  color: var(--battle-muted);
  font-size: 10px;
  line-height: 1.5;
}

.battle-terminal-statuses,
.battle-terminal-data-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 7px;
  border-top: 1px solid rgba(91, 123, 148, 0.38);
  padding: 8px 10px;
  font-size: 10px;
}

.battle-terminal-statuses > span,
.battle-terminal-data-row span {
  flex: 0 0 auto;
  color: var(--battle-muted);
}

.battle-terminal-statuses > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.battle-terminal-statuses b,
.battle-terminal-data-row strong {
  color: var(--battle-copy);
  text-align: right;
}

.battle-terminal-status {
  border: 1px solid currentColor;
  padding: 2px 4px;
}

.battle-terminal-tactics-link {
  display: block;
  border-top: 1px solid rgba(91, 123, 148, 0.38);
  padding: 10px;
  color: var(--battle-player);
  font-size: 10px;
  font-weight: 800;
  text-decoration: none;
}

.battle-terminal-tactics-link:hover,
.battle-terminal-tactics-link:focus-visible {
  background: rgba(24, 217, 239, 0.1);
  outline: none;
}

.battle-terminal-description {
  margin: 0;
  padding: 0 10px 10px;
  color: var(--battle-muted);
  font-size: 10px;
  line-height: 1.55;
}

.battle-terminal-matrix {
  display: flex;
  flex-direction: column;
}

.battle-terminal-phase-tabs {
  display: grid;
  grid-auto-columns: minmax(115px, 1fr);
  grid-auto-flow: column;
  overflow-x: auto;
  border-bottom: 1px solid var(--battle-line);
  background: var(--battle-surface-deep);
}

.battle-terminal-phase-tabs button {
  border: 0;
  border-right: 1px solid var(--battle-line);
  padding: 6px 8px;
  background: transparent;
  color: var(--battle-muted);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.battle-terminal-phase-tabs button small {
  display: block;
  margin-top: 2px;
  font-size: 8px;
}

.battle-terminal-phase-tabs button[aria-selected="true"] {
  background: rgba(24, 217, 239, 0.14);
  color: var(--battle-player);
}

.battle-terminal-phase-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.battle-terminal-phase-panel[hidden] {
  display: none;
}

.battle-terminal-column-labels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  gap: 5px;
  padding: 6px 8px 3px;
  color: var(--battle-muted);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.battle-terminal-column-labels i {
  text-align: center;
  font-style: normal;
}

.battle-terminal-column-labels span:last-child {
  text-align: right;
}

.battle-terminal-overflow-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 3px 8px 4px;
  border: 1px solid rgba(255, 189, 62, 0.7);
  padding: 5px 8px;
  background: rgba(255, 189, 62, 0.1);
  color: var(--battle-warning);
  font-size: 10px;
}

.battle-terminal-overflow-note span {
  color: #ffe0a0;
  font-size: 9px;
}

.battle-terminal-turns {
  display: grid;
  gap: 4px;
  min-height: 0;
  margin: 0;
  padding: 4px 8px 6px;
  list-style: none;
}

.battle-terminal-turns--scroll {
  flex: 1 1 auto;
  max-height: min(430px, calc(100dvh - 330px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--battle-warning) rgba(52, 72, 88, 0.42);
  scrollbar-width: thin;
  scroll-snap-type: y proximity;
}

.battle-terminal-turns--scroll:focus-visible {
  outline: 2px solid var(--battle-warning);
  outline-offset: -2px;
}

.battle-terminal-turns li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  gap: 5px;
  min-width: 0;
  scroll-snap-align: start;
}

.battle-terminal-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  align-items: center;
  min-width: 0;
  min-height: 58px;
  border-left: 3px solid var(--battle-player);
  padding: 5px 8px;
  background: var(--battle-surface-soft);
}

.battle-terminal-action--enemy {
  border-right: 3px solid var(--battle-enemy);
  border-left: 0;
  text-align: right;
}

.battle-terminal-action--warning {
  border-right-color: var(--battle-warning);
  background: linear-gradient(90deg, var(--battle-surface-soft), rgba(83, 55, 18, 0.36));
}

.battle-terminal-action > div {
  min-width: 0;
}

.battle-terminal-action small,
.battle-terminal-action strong {
  display: block;
}

.battle-terminal-action small {
  color: var(--battle-muted);
  font-size: 8px;
}

.battle-terminal-action strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-terminal-action > b {
  color: var(--battle-player);
  font-size: 12px;
  white-space: nowrap;
}

.battle-terminal-action--enemy > b {
  color: #ff91b0;
}

.battle-terminal-action--warning > b {
  color: var(--battle-warning);
}

.battle-terminal-action > span {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--battle-muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-terminal-action--enemy > span {
  text-align: right;
}

.battle-terminal-turn {
  display: grid;
  place-items: center;
  border: 1px solid var(--battle-line);
  background: var(--battle-surface-deep);
}

.battle-terminal-turn strong {
  font-size: 14px;
}

.battle-terminal-turn span {
  color: var(--battle-enemy);
}

.battle-terminal-matrix-note {
  margin: auto 0 0;
  border-top: 1px solid var(--battle-line);
  padding: 5px 8px;
  color: var(--battle-muted);
  font-size: 9px;
  line-height: 1.35;
}

.battle-terminal-matrix-note b {
  color: var(--battle-player);
}

.battle-terminal-commandbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--battle-line);
  padding: 7px 9px;
  background: rgba(8, 13, 19, 0.98);
}

.battle-terminal-commandbar form {
  margin: 0;
}

.battle-terminal-commandbar button {
  min-height: 36px;
  border: 1px solid var(--battle-line);
  padding: 0 14px;
  background: #111d28;
  color: var(--battle-copy);
  font: inherit;
  cursor: pointer;
}

.battle-terminal-commandbar button:hover,
.battle-terminal-commandbar button:focus-visible {
  border-color: var(--battle-player);
  outline: none;
}

.battle-terminal-commandbar .battle-terminal-engage {
  border-color: var(--battle-player);
  background: rgba(13, 67, 80, 0.96);
  color: #ffffff;
  font-weight: 800;
}

.battle-terminal-engage span {
  padding-left: 12px;
}

.battle-terminal-commandbar p {
  margin: 0;
  text-align: center;
}

.battle-terminal-commandbar p span,
.battle-terminal-commandbar p strong {
  display: block;
}

.battle-terminal-commandbar p span {
  color: var(--battle-ready);
  font-size: 8px;
  letter-spacing: 0.1em;
}

.battle-terminal-commandbar p strong {
  margin-top: 2px;
  font-size: 10px;
}

@media (max-width: 1180px) {
  .battle-terminal-workspace {
    grid-template-columns: minmax(160px, 0.62fr) minmax(460px, 2fr) minmax(180px, 0.7fr);
  }

  .battle-terminal-context span:nth-child(2),
  .battle-terminal-matrix-title small {
    display: none;
  }
}

@media (max-width: 980px), (max-height: 680px) {
  .page-battle .main-column {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .page-battle .page,
  .battle-terminal-shell {
    height: auto;
    min-height: 0;
  }

  .battle-terminal-shell {
    overflow: visible;
  }

  .battle-terminal-workspace {
    display: flex;
    flex-direction: column;
  }

  .battle-terminal-intel--player {
    order: 1;
  }

  .battle-terminal-intel--enemy {
    order: 2;
  }

  .battle-terminal-matrix {
    order: 3;
  }

  .battle-terminal-turns--scroll {
    max-height: 520px;
  }
}

@media (max-width: 760px) {
  .page-battle .topbar {
    min-height: 60px;
    padding: 10px 16px;
  }

  .page-battle .terminal-status {
    display: none;
  }

  .page-battle .content-wrap {
    padding: 10px 11px 20px;
  }

  .battle-terminal-header {
    position: sticky;
    top: 60px;
    z-index: 3;
  }

  .battle-terminal-brand span,
  .battle-terminal-context span {
    display: none;
  }

  .battle-terminal-runbar {
    grid-template-columns: 1fr 1fr;
  }

  .battle-terminal-meter--enemy {
    display: none;
  }

  .battle-terminal-scan {
    grid-column: 1 / -1;
  }

  .battle-terminal-column-labels {
    display: none;
  }

  .battle-terminal-turns li {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 4px;
  }

  .battle-terminal-turn {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .battle-terminal-action {
    grid-column: 2;
  }

  .battle-terminal-action--enemy {
    border-right: 0;
    border-left: 3px solid var(--battle-enemy);
    text-align: left;
  }

  .battle-terminal-action--warning {
    border-left-color: var(--battle-warning);
  }

  .battle-terminal-action--enemy > span {
    text-align: left;
  }

  .battle-terminal-overflow-note {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .battle-terminal-commandbar {
    position: sticky;
    bottom: 0;
    z-index: 3;
    grid-template-columns: 1fr 1.25fr;
  }

  .battle-terminal-commandbar p {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .battle-terminal-commandbar form {
    grid-row: 2;
  }

  .battle-terminal-commandbar button {
    width: 100%;
    padding: 0 7px;
    font-size: 11px;
  }
}


/* battle.php independent forecast lanes */
.battle-terminal-workspace {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 8px;
}

.battle-terminal-combatants {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  flex: 0 0 auto;
  min-height: 0;
}

.battle-terminal-intel {
  position: relative;
  align-self: auto;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(24, 217, 239, 0.045) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(rgba(24, 217, 239, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--battle-surface);
}

.battle-terminal-intel--enemy {
  background:
    linear-gradient(90deg, rgba(255, 79, 130, 0.045) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(rgba(255, 79, 130, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--battle-surface);
}

.battle-terminal-section-title {
  min-height: 38px;
  padding: 7px 11px;
}

.battle-terminal-section-title span {
  font-size: 11px;
}

.battle-terminal-section-title strong {
  font-size: 15px;
}

.battle-terminal-matrix-title small {
  font-size: 11px;
}

.battle-terminal-intel-body {
  display: grid;
  grid-template-columns: minmax(210px, 0.9fr) minmax(250px, 1.25fr);
  align-items: stretch;
  min-height: 86px;
}

.battle-terminal-identity {
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 11px;
  padding: 10px 12px;
}

.battle-terminal-avatar {
  width: 64px;
}

.battle-terminal-avatar .character-image-placeholder {
  font-size: 13px;
}

.battle-terminal-identity small {
  font-size: 11px;
}

.battle-terminal-identity strong {
  margin: 2px 0 4px;
  font-size: 16px;
}

.battle-terminal-identity span {
  font-size: 12px;
}

.battle-terminal-intel-detail {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  border-left: 1px solid rgba(91, 123, 148, 0.38);
}

.battle-terminal-statuses,
.battle-terminal-data-row {
  border-top: 0;
  padding: 7px 11px;
  font-size: 12px;
}

.battle-terminal-tactics-link {
  margin-top: auto;
  padding: 8px 11px;
  font-size: 12px;
}

.battle-terminal-description {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  padding: 8px 11px 4px;
  color: var(--battle-muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.battle-terminal-matrix {
  flex: 1 1 auto;
  min-height: 0;
}

.battle-terminal-phase-tabs button {
  padding: 7px 9px;
  font-size: 12px;
}

.battle-terminal-phase-tabs button small {
  font-size: 10px;
}

.battle-terminal-phase-panel {
  min-height: 0;
}

.battle-terminal-lanes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 1 1 auto;
  gap: 8px;
  min-height: 0;
  padding: 8px;
}

.battle-terminal-lane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(107, 143, 170, 0.52);
  background: rgba(7, 16, 25, 0.72);
}

.battle-terminal-lane > header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid rgba(107, 143, 170, 0.52);
  padding: 6px 10px;
  background: rgba(10, 22, 32, 0.96);
}

.battle-terminal-lane > header span {
  color: var(--battle-player);
  font-size: 11px;
  letter-spacing: 0.09em;
}

.battle-terminal-lane--enemy > header span {
  color: var(--battle-enemy);
}

.battle-terminal-lane > header strong {
  justify-self: end;
  font-size: 13px;
}

.battle-terminal-lane > header small {
  grid-column: 1 / -1;
  color: var(--battle-warning);
  font-size: 11px;
  text-align: right;
}

.battle-terminal-lane-actions {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: repeat(5, minmax(58px, 1fr));
  gap: 5px;
  min-height: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
}

.battle-terminal-enemy-sequence {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 5px;
  min-height: 0;
  padding: 6px;
}

.battle-terminal-enemy-sequence > .battle-terminal-lane-actions {
  margin: 0;
  padding: 0;
}

.battle-terminal-enemy-sequence > .battle-terminal-lane-actions:not(.battle-terminal-lane-actions--scroll) {
  display: contents;
}

.battle-terminal-lane-actions--scroll {
  grid-row: 1 / -1;
  grid-template-rows: none;
  grid-auto-rows: minmax(62px, auto);
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--battle-warning) rgba(52, 72, 88, 0.42);
  scrollbar-width: thin;
  scroll-snap-type: y proximity;
}

.battle-terminal-lane-actions--scroll:focus-visible {
  outline: 2px solid var(--battle-warning);
  outline-offset: -3px;
}

.battle-terminal-lane-actions li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 5px;
  min-width: 0;
  min-height: 0;
  scroll-snap-align: start;
}

.battle-terminal-action-index {
  display: grid;
  place-items: center;
  border: 1px solid rgba(107, 143, 170, 0.68);
  background: var(--battle-surface-deep);
  color: var(--battle-copy);
  font-size: 15px;
  font-weight: 800;
}

.battle-terminal-lane--enemy .battle-terminal-action-index {
  border-color: rgba(255, 79, 130, 0.62);
}

.battle-terminal-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.72fr);
  gap: 3px 10px;
  align-items: center;
  min-height: 0;
  padding: 6px 10px;
}

.battle-terminal-action--enemy {
  border-right: 3px solid var(--battle-enemy);
  border-left: 0;
  text-align: left;
}

.battle-terminal-action small {
  font-size: 11px;
  letter-spacing: 0.025em;
}

.battle-terminal-action strong {
  font-size: 15px;
}

.battle-terminal-action-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
}

.battle-terminal-action-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-terminal-action-copy span {
  overflow: hidden;
  color: var(--battle-muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-terminal-action-output {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 3px 8px;
  min-width: 0;
  text-align: center;
}

.battle-terminal-action-output b {
  color: var(--battle-player);
  font-size: 16px;
  line-height: 1.25;
}

.battle-terminal-action--enemy .battle-terminal-action-output b {
  color: #ff91b0;
}

.battle-terminal-action--warning .battle-terminal-action-output b {
  color: var(--battle-warning);
}

.battle-terminal-action > span {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--battle-muted);
  font-size: 12px;
  line-height: 1.3;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-terminal-loop-end {
  display: grid;
  grid-row: span var(--loop-gap);
  place-content: center;
  min-height: 0;
  margin: 0;
  border: 1px dashed rgba(255, 79, 130, 0.42);
  background:
    linear-gradient(90deg, rgba(255, 79, 130, 0.05) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(rgba(255, 79, 130, 0.04) 1px, transparent 1px) 0 0 / 22px 22px,
    rgba(22, 12, 20, 0.52);
  color: var(--battle-muted);
  text-align: center;
}

.battle-terminal-loop-end span {
  color: var(--battle-enemy);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.battle-terminal-loop-end strong {
  margin: 3px 0;
  color: var(--battle-copy);
  font-size: 17px;
}

.battle-terminal-loop-end small {
  font-size: 11px;
}

.battle-terminal-matrix-note {
  flex: 0 0 auto;
  margin: 0;
  padding: 7px 10px;
  font-size: 11px;
  line-height: 1.4;
}

.battle-terminal-brand strong,
.battle-terminal-meter strong,
.battle-terminal-scan strong {
  font-size: 14px;
}

.battle-terminal-brand span,
.battle-terminal-context span,
.battle-terminal-context b {
  font-size: 12px;
}

.battle-terminal-meter span,
.battle-terminal-scan span,
.battle-terminal-scan b {
  font-size: 10px;
}

.battle-terminal-commandbar p span {
  font-size: 10px;
}

.battle-terminal-commandbar p strong {
  font-size: 12px;
}

.battle-terminal-command-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.battle-terminal-command-actions button {
  width: 100%;
  min-width: 142px;
}

.battle-terminal-commandbar .battle-terminal-tactics-button {
  border-color: rgba(24, 217, 239, 0.74);
  color: var(--battle-player);
}

@media (max-width: 1180px) {
  .battle-terminal-intel-body {
    grid-template-columns: minmax(190px, 0.9fr) minmax(210px, 1fr);
  }

  .battle-terminal-action {
    grid-template-columns: minmax(0, 1fr) minmax(130px, 0.66fr);
  }
}

@media (max-width: 980px), (max-height: 680px) {
  .battle-terminal-workspace {
    display: flex;
  }

  .battle-terminal-combatants {
    grid-template-columns: 1fr;
  }

  .battle-terminal-lanes {
    grid-template-columns: 1fr;
  }

  .battle-terminal-lane-actions,
  .battle-terminal-lane--enemy .battle-terminal-lane-actions:not(.battle-terminal-lane-actions--scroll) {
    flex: none;
    grid-template-rows: none;
    grid-auto-rows: minmax(68px, auto);
  }

  .battle-terminal-enemy-sequence {
    flex: none;
    grid-template-rows: repeat(5, minmax(68px, auto));
  }

  .battle-terminal-lane-actions--scroll {
    max-height: 430px;
  }

  .battle-terminal-loop-end {
    flex: none;
    min-height: 86px;
  }
}

@media (max-width: 620px) {
  .battle-terminal-intel-body {
    grid-template-columns: 1fr;
  }

  .battle-terminal-intel-detail {
    border-top: 1px solid rgba(91, 123, 148, 0.38);
    border-left: 0;
  }

  .battle-terminal-lanes {
    padding: 6px;
  }

  .battle-terminal-lane-actions li {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .battle-terminal-action-index {
    font-size: 13px;
  }

  .battle-terminal-action {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 9px;
  }

  .battle-terminal-action-output b {
    font-size: 16px;
  }

  .battle-terminal-matrix-title small {
    display: none;
  }

  .battle-terminal-commandbar {
    grid-template-columns: minmax(0, 2fr) minmax(108px, 1fr);
  }

  .battle-terminal-command-actions {
    grid-column: 1;
    grid-row: 2;
  }

  .battle-terminal-command-actions button {
    min-width: 0;
    padding-inline: 5px;
    font-size: 10px;
  }

  .battle-terminal-commandbar > form:last-child {
    grid-column: 2;
    grid-row: 2;
  }
}

/* battle_resolve.php */
.battle-actor-summary {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
  }

  .battle-actor-summary.no-battle-actor-icon {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .battle-actor-icon {
    width: 64px;
    aspect-ratio: 1;
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 7px;
  }

  .battle-actor-icon .character-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

.battle-presentation-log {
    display: grid;
    gap: 10px;
  }

  .battle-presentation-entry {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(38, 50, 68, 0.92);
    border-radius: 8px;
    background: rgba(8, 10, 15, 0.38);
  }

  .battle-presentation-entry--battle_start,
  .battle-presentation-entry--outcome {
    border-left: 4px solid var(--cyan);
  }

  .battle-presentation-entry--aftermath {
    border-left: 4px solid var(--yellow);
    background: rgba(252, 238, 9, 0.07);
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.7;
  }

  .battle-action-name {
    font-size: clamp(1.15rem, 2vw, 1.5rem);
    font-style: italic;
    font-weight: 950;
    letter-spacing: 0.04em;
  }

  .battle-presentation-turn {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .battle-action-name--player {
    color: var(--cyan);
  }

  .battle-action-name--enemy {
    color: #ff8c9b;
  }

  .battle-presentation-line {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .battle-speech {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 8px;
    border-radius: 7px;
    background: rgba(0, 229, 255, 0.06);
  }

  .battle-speech--enemy {
    background: rgba(255, 70, 110, 0.07);
  }

  .battle-speech-icon {
    width: 56px;
    aspect-ratio: 1;
    border: 1px solid rgba(0, 229, 255, 0.28);
    border-radius: 6px;
  }

  .battle-speech-icon .character-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .battle-speech-body {
    min-width: 0;
  }

  .battle-speech-icon-label {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .battle-speech-text {
    overflow-wrap: anywhere;
  }

  .battle-speech-editor,
  .battle-quote-editor {
    display: grid;
    gap: 7px;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: 7px;
    background: rgba(8, 10, 15, 0.28);
  }

  .battle-speech-inline {
    display: grid;
    grid-template-columns: minmax(145px, 190px) minmax(0, 1fr);
    gap: 8px;
    align-items: end;
  }

  .battle-speech-icon-field,
  .battle-speech-compose {
    display: grid;
    min-width: 0;
    gap: 4px;
  }

  .battle-speech-compose textarea {
    min-height: 42px;
    resize: vertical;
  }

  .battle-speech-editor label,
  .battle-quote-editor label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .battle-speech-editor select,
  .battle-speech-editor textarea,
  .battle-quote-editor select,
  .battle-quote-editor textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.78);
    color: var(--text);
    font: inherit;
  }

  .battle-speech-markup-buttons {
    gap: 5px;
  }

  .battle-speech-markup-buttons .button {
    width: auto;
    padding: 5px 8px;
    font-size: 11px;
  }

  @media (max-width: 680px) {
    .battle-speech-inline {
      grid-template-columns: 1fr;
    }

    .battle-actor-summary {
      grid-template-columns: 48px minmax(0, 1fr);
    }

    .battle-actor-icon {
      width: 48px;
    }

    .battle-speech {
      grid-template-columns: 48px minmax(0, 1fr);
    }

    .battle-speech-icon {
      width: 48px;
    }
  }

.battle-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
  }

  .battle-log-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .battle-log-list li {
    white-space: pre-wrap;
  }

  .log-value {
    font-weight: 900;
  }

  .log-value--hp-damage {
    color: #e87522;
  }

  .log-value--mp-loss {
    color: #287dcc;
  }

  .log-value--recovery {
    color: #74f28b;
  }

  .log-r18-history-change {
    color: #ff596d;
    font-weight: 900;
    text-shadow: 0 0 8px rgba(255, 38, 67, 0.42);
  }

  .result-victory {
    border-left-color: var(--green);
    color: var(--text);
    font-weight: 800;
    background: linear-gradient(90deg, rgba(155, 255, 74, 0.12), rgba(0, 229, 255, 0.06));
  }

  .result-defeat {
    border-left-color: var(--red);
    color: #ffb4ae;
    font-weight: 800;
    background: linear-gradient(90deg, rgba(255, 59, 48, 0.12), rgba(255, 42, 109, 0.08));
  }

/* battle_resolve.php combat record */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-battle-resolve .page {
  width: min(1380px, 100%);
}

.battle-record-shell {
  display: grid;
  gap: 14px;
  position: relative;
  border: 1px solid rgba(76, 118, 146, 0.66);
  background:
    linear-gradient(rgba(7, 17, 27, 0.94), rgba(6, 12, 20, 0.97)),
    var(--table-grid) center / cover;
  box-shadow: inset 0 0 42px rgba(0, 229, 255, 0.05), 0 18px 42px rgba(0, 0, 0, 0.28);
}

.battle-record-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--scanline) center / 360px auto repeat;
  opacity: 0.055;
}

.battle-record-header,
.battle-record-log,
.battle-result-summary {
  position: relative;
  z-index: 1;
}

.battle-record-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(77, 118, 146, 0.58);
  background: rgba(6, 14, 23, 0.92);
}

.battle-record-header h2,
.battle-record-section-heading h2 {
  margin: 2px 0 0;
  line-height: 1.2;
}

.battle-record-header p,
.battle-record-section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.battle-record-kicker,
.battle-record-section-heading > span {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.battle-record-skip {
  width: auto;
  min-width: 190px;
  flex: 0 0 auto;
}

.battle-record-log {
  padding: 0 14px 14px;
}

.battle-record-section-heading {
  padding: 12px 4px;
}

#battle-record-log-title {
  scroll-margin-top: 110px;
}

.battle-presentation-log {
  gap: 8px;
}

.battle-presentation-entry,
.battle-turn-start {
  border-radius: 0;
  background: rgba(12, 27, 41, 0.72);
}

.battle-presentation-entry--battle_start {
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(0, 229, 255, 0.44);
  border-left-width: 4px;
}

.battle-turn-start {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(92, 131, 158, 0.55);
  border-left: 4px solid var(--yellow);
}

.battle-turn-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.battle-turn-heading span {
  color: var(--yellow);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.13em;
}

.battle-presentation-entry--battle_start .battle-turn-heading span {
  color: var(--cyan);
}

.battle-turn-heading b {
  color: var(--muted);
  font-size: 12px;
}

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

.battle-state-actor {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(0, 229, 255, 0.24);
  background: rgba(4, 12, 20, 0.76);
}

.battle-state-actor--enemy {
  border-color: rgba(255, 42, 109, 0.32);
}

.battle-state-icon {
  width: 70px;
  height: 70px;
  border: 1px solid rgba(0, 229, 255, 0.48);
  background: rgba(0, 229, 255, 0.05);
}

.battle-state-actor--enemy .battle-state-icon {
  border-color: rgba(255, 42, 109, 0.58);
  background: rgba(255, 42, 109, 0.06);
}

.battle-state-icon .character-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.battle-state-data {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
}

.battle-state-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.battle-state-identity > strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-state-statuses {
  display: grid;
  grid-template-columns: repeat(5, minmax(30px, auto));
  gap: 3px;
  flex: 0 0 auto;
}

.battle-state-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 24px;
  padding: 2px 5px;
  border: 1px solid currentColor;
  color: #bdc7d2;
  font-size: 10px;
  line-height: 1;
}

.battle-state-status b {
  font-size: 12px;
}

.battle-state-status--burn { color: #ff8a45; }
.battle-state-status--corrosion { color: #a7e95e; }
.battle-state-status--freeze { color: #70d9ff; }
.battle-state-status--weathering { color: #c48cff; }
.battle-state-status--breakdown { color: #ffd85a; }

.battle-state-status.is-zero {
  opacity: 0.34;
  filter: saturate(0.35);
}

.battle-state-meter {
  display: grid;
  gap: 3px;
}

.battle-state-meter-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.battle-state-meter-label b {
  color: var(--text);
  font-size: 12px;
}

.battle-state-meter-track {
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(130, 157, 177, 0.32);
  background: rgba(0, 0, 0, 0.55);
}

.battle-state-meter-track > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #56df8e, #9bffb2);
  box-shadow: 0 0 8px rgba(86, 223, 142, 0.42);
}

.battle-state-actor--enemy .battle-state-meter--hp .battle-state-meter-track > span {
  background: linear-gradient(90deg, #ff2a6d, #ff789e);
  box-shadow: 0 0 8px rgba(255, 42, 109, 0.42);
}

.battle-state-meter--mp .battle-state-meter-track > span {
  background: linear-gradient(90deg, #00b9e8, #58e8ff);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.42);
}

.battle-presentation-entry--action {
  margin-left: 18px;
  padding: 10px 14px;
  border-color: rgba(0, 229, 255, 0.26);
  border-left: 3px solid var(--cyan);
}

.battle-presentation-entry--enemy_action {
  border-color: rgba(255, 42, 109, 0.26);
  border-left-color: var(--magenta);
  background: rgba(31, 13, 27, 0.5);
}

.battle-presentation-turn {
  color: var(--cyan);
  letter-spacing: 0.12em;
}

.battle-presentation-entry--enemy_action .battle-presentation-turn {
  color: #ff779e;
}

.battle-presentation-entry--system,
.battle-presentation-entry--status {
  margin-left: 18px;
  border-left: 3px solid #c48cff;
}

.battle-result-summary {
  margin: 0 14px 14px;
  padding: 18px;
  scroll-margin-top: 110px;
  border: 1px solid rgba(252, 238, 9, 0.56);
  border-left: 5px solid var(--yellow);
  background: linear-gradient(135deg, rgba(252, 238, 9, 0.08), rgba(8, 16, 25, 0.94) 45%);
  outline: none;
}

.battle-result-summary--victory,
.battle-result-summary--escaped {
  border-color: rgba(155, 255, 74, 0.52);
  border-left-color: var(--green);
  background: linear-gradient(135deg, rgba(155, 255, 74, 0.11), rgba(8, 16, 25, 0.94) 45%);
}

.battle-result-summary--defeat {
  border-color: rgba(255, 59, 48, 0.6);
  border-left-color: var(--red);
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.12), rgba(8, 16, 25, 0.94) 45%);
}

.battle-result-aftermath {
  margin: 16px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--yellow);
  background: rgba(252, 238, 9, 0.08);
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.battle-result-summary:focus-visible,
.battle-result-summary:target {
  box-shadow: 0 0 0 2px var(--cyan), 0 0 24px rgba(0, 229, 255, 0.2);
}

.battle-result-summary .battle-record-section-heading h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

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

.battle-result-grid .item {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid rgba(94, 127, 151, 0.42);
  background: rgba(4, 11, 18, 0.62);
}

.battle-result-grid .label {
  color: var(--muted);
  font-size: 11px;
}

.battle-result-grid .value {
  font-size: 17px;
  font-weight: 950;
}

.battle-result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
}

.battle-result-actions > a:first-child {
  color: var(--muted);
  font-size: 12px;
}

.battle-result-actions .button {
  width: auto;
  min-width: 210px;
}

@media (max-width: 900px) {
  .battle-state-grid {
    grid-template-columns: 1fr;
  }

  .battle-record-header {
    align-items: flex-start;
  }
}

@media (max-width: 620px) {
  .page-battle-resolve .content-wrap {
    padding-inline: 6px;
  }

  .battle-record-header {
    display: grid;
    padding: 14px;
  }

  .battle-record-skip {
    width: 100%;
  }

  #battle-record-log-title,
  .battle-result-summary {
    scroll-margin-top: 175px;
  }

  .battle-record-log {
    padding-inline: 7px;
  }

  .battle-state-actor {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .battle-state-icon {
    width: 52px;
    height: 52px;
  }

  .battle-state-identity {
    display: grid;
  }

  .battle-state-statuses {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .battle-state-status {
    padding-inline: 3px;
  }

  .battle-presentation-entry--action,
  .battle-presentation-entry--system,
  .battle-presentation-entry--status {
    margin-left: 8px;
  }

  .battle-speech {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .battle-speech-icon {
    width: 42px;
  }

  .battle-result-summary {
    margin-inline: 7px;
    padding: 13px;
  }

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

  .battle-result-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .battle-result-actions .button {
    width: 100%;
    min-width: 0;
  }
}

/* ranking.php */
.ranking-period {
    display: grid;
    gap: 4px;
  }

  .ranking-table-wrap {
    overflow-x: auto;
    margin-top: 12px;
  }

  .ranking-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
  }

  .ranking-table th,
  .ranking-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(38, 50, 68, 0.92);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
  }

  .ranking-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    background: rgba(0, 229, 255, 0.12);
  }

  .ranking-rank {
    font-weight: 800;
    text-align: right;
  }

  .ranking-rank-with-icon {
    display: inline-grid;
    grid-template-columns: minmax(20px, auto) 48px;
    align-items: center;
    gap: 9px;
  }

  .ranking-rank-with-icon > strong {
    text-align: right;
  }

  .ranking-character-icon,
  .ranking-presentation-icon-preview {
    width: 48px;
    height: 48px;
    border-radius: 6px;
  }

  .ranking-character-icon .character-image,
  .ranking-presentation-icon-preview .character-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
  }

  .ranking-comment-cell {
    min-width: 190px;
    max-width: 360px;
    white-space: normal !important;
  }

  .ranking-comment {
    line-height: 1.55;
    overflow-wrap: anywhere;
  }

  .ranking-comment-empty {
    color: var(--muted);
  }

  .ranking-score {
    font-weight: 800;
  }

  .ranking-table .button {
    width: auto;
    padding: 8px 12px;
  }

  .ranking-presentation-settings {
    margin-top: 18px;
  }

  .ranking-presentation-form {
    display: grid;
    gap: 10px;
    margin-top: 14px;
  }

  .ranking-presentation-icon-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    align-items: end;
    gap: 12px;
    max-width: 620px;
  }

  .ranking-presentation-form select,
  .ranking-presentation-form textarea {
    width: 100%;
  }

  .ranking-presentation-form textarea {
    min-height: 104px;
    resize: vertical;
  }

  .ranking-markup-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .ranking-markup-buttons .button {
    width: auto;
    min-height: 32px;
    padding: 6px 9px;
    font-size: 12px;
  }

  .ranking-presentation-preview {
    padding: 10px 12px;
    border: 1px solid rgba(0, 229, 255, 0.24);
    border-radius: 6px;
    background: rgba(4, 7, 12, 0.62);
  }

  .ranking-presentation-preview > .label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .ranking-presentation-form .chat-submit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .ranking-presentation-form .chat-submit-actions .button {
    width: auto;
  }

  .theme-r18 .r18-ranking-panel {
    border-color: rgba(255, 80, 160, 0.42);
    background: rgba(28, 8, 22, 0.76);
  }

  @media (max-width: 620px) {
    .ranking-rank-with-icon {
      grid-template-columns: minmax(18px, auto) 42px;
      gap: 7px;
    }

    .ranking-character-icon,
    .ranking-presentation-icon-preview {
      width: 42px;
      height: 42px;
    }

    .ranking-presentation-icon-control {
      grid-template-columns: minmax(0, 1fr) 42px;
    }

    .ranking-presentation-form .chat-submit-actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
    }

    .ranking-presentation-form .chat-submit-actions .button {
      width: 100%;
    }
  }


/* achievements.php */
.achievement-card {
    display: grid;
    gap: 10px;
  }

  .achievement-card.unlocked {
    border-left: 6px solid var(--green);
  }

  .achievement-card.locked {
    border-left: 6px solid rgba(142, 160, 184, 0.72);
  }

  .achievement-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: var(--muted);
    font-size: 13px;
  }

  .achievement-progress {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(8, 10, 15, 0.74);
    border: 1px solid rgba(0, 229, 255, 0.22);
  }

  .achievement-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--green));
  }

  .achievement-status {
    font-weight: 800;
  }

  .sponsor-point-summary {
    display: grid;
    gap: 8px;
  }


/* dungeon_logs.php */
.log-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: end;
  }

  .log-search-grid label {
    display: grid;
    gap: 6px;
    font-weight: 700;
  }

  .log-search-grid input,
  .log-search-grid select {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(0, 229, 255, 0.34);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.72);
    color: var(--text);
  }

  .log-table-wrap {
    overflow-x: auto;
  }

  .log-table {
    width: 100%;
    border-collapse: collapse;
  }

  .log-table th,
  .log-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(38, 50, 68, 0.92);
    text-align: left;
    white-space: nowrap;
  }

  .log-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    background: rgba(0, 229, 255, 0.12);
  }

  .log-table .button {
    width: auto;
    padding: 8px 12px;
  }

  .pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
  }

  .pagination a,
  .pagination span {
    min-width: 40px;
    padding: 8px 10px;
    border: 1px solid rgba(0, 229, 255, 0.24);
    border-radius: 6px;
    background: rgba(18, 23, 34, 0.88);
    color: var(--muted);
    text-align: center;
    text-decoration: none;
  }

  .pagination .current {
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.22), rgba(255, 42, 109, 0.14));
    color: var(--text);
  }


/* dungeon_log_detail.php */
.detail-log-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .detail-log-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    color: var(--muted);
    font-size: 13px;
  }

  .detail-log-text {
    margin-top: 8px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .detail-battle-log {
    border-left: 5px solid var(--cyan);
  }

  .detail-battle-log summary {
    cursor: pointer;
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .detail-battle-parts {
    display: grid;
    gap: 12px;
    margin-top: 12px;
  }

  .detail-battle-part {
    padding-top: 10px;
    border-top: 1px solid rgba(38, 50, 68, 0.9);
  }


/* contact.php */
.contact-form {
    display: grid;
    gap: 14px;
  }

  .contact-form label {
    display: grid;
    gap: 6px;
    font-weight: 700;
  }

  .contact-form input,
  .contact-form select,
  .contact-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0, 229, 255, 0.32);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.74);
    color: var(--text);
    font: inherit;
  }

  .contact-form textarea {
    min-height: 220px;
    resize: vertical;
  }


/* admin_contacts.php */
  .admin-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .user-search-filter {
    margin-top: 10px;
  }

  .admin-filter input,
  .admin-filter select {
    padding: 10px 12px;
    border: 1px solid rgba(0, 229, 255, 0.32);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.74);
    color: var(--text);
    font: inherit;
  }

  .admin-filter .button,
  .admin-table .button,
  .admin-pager .button {
    width: auto;
  }

  .admin-table-wrap {
    overflow-x: auto;
  }

  .admin-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
  }

  .admin-table th,
  .admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(38, 50, 68, 0.92);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
  }

  .admin-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    background: rgba(0, 229, 255, 0.12);
  }


/* admin_contact_detail.php */
.admin-contact-form {
    display: grid;
    gap: 14px;
  }

  .admin-contact-form label {
    display: grid;
    gap: 6px;
    font-weight: 700;
  }

  .admin-contact-form textarea,
  .admin-contact-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0, 229, 255, 0.32);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.74);
    color: var(--text);
    font: inherit;
  }

  .admin-contact-form textarea {
    min-height: 180px;
    resize: vertical;
  }


/* admin_chat_notice.php */
.admin-chat-form {
    display: grid;
    gap: 12px;
  }

  .admin-chat-form label {
    display: grid;
    gap: 6px;
    font-weight: 800;
  }

  .admin-chat-form textarea {
    width: 100%;
    min-height: 220px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 59, 48, 0.48);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.74);
    color: var(--text);
    font: inherit;
    resize: vertical;
  }

  .notice-preview {
    display: grid;
    gap: 10px;
  }

  .notice-preview .item {
    border-color: rgba(255, 59, 48, 0.58);
    color: #ffb4ae;
  }


/* admin_grants.php */
.admin-grant-form,
  .admin-grant-search {
    display: grid;
    gap: 14px;
  }

  .admin-grant-form label,
  .admin-grant-search label {
    display: grid;
    gap: 6px;
    font-weight: 700;
  }

  .admin-grant-form input,
  .admin-grant-form select,
  .admin-grant-form textarea,
  .admin-grant-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0, 229, 255, 0.32);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.74);
    color: var(--text);
    font: inherit;
  }

  .admin-grant-form textarea {
    min-height: 140px;
    resize: vertical;
  }

  .admin-grant-inline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
  }

  .admin-table-wrap {
    overflow-x: auto;
  }

  .admin-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
  }

  .admin-table th,
  .admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(38, 50, 68, 0.92);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
  }

  .admin-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    background: rgba(0, 229, 255, 0.12);
  }

  .admin-table .summary-cell {
    max-width: 360px;
    white-space: normal;
  }

  .admin-table .button,
  .admin-grant-search .button {
    width: auto;
  }

  /* Keep the contact detail action visible even when a subject is long. */
  .admin-contacts-table {
    table-layout: fixed;
  }

  .admin-contacts-table th,
  .admin-contacts-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .admin-contacts-table th:last-child,
  .admin-contacts-table td:last-child {
    width: 76px;
    white-space: nowrap;
  }

/* admin_battle_actions.php */
.admin-editor-page-nav {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
  }

.admin-editor-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
  }

  .admin-editor-heading h2,
  .admin-editor-heading p {
    margin-top: 0;
  }

  .admin-editor-filter {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
    gap: 10px;
    align-items: end;
    margin: 16px 0;
  }

  .admin-editor-filter label,
  .admin-content-editor-form label {
    display: grid;
    gap: 6px;
    font-weight: 700;
  }

  .admin-editor-filter input,
  .admin-editor-filter select,
  .admin-content-editor-form input,
  .admin-content-editor-form select,
  .admin-content-editor-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0, 229, 255, 0.32);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.74);
    color: var(--text);
    font: inherit;
  }

  .admin-content-editor-form input:disabled {
    opacity: 0.72;
    cursor: not-allowed;
  }

  .admin-content-editor-form small {
    color: var(--muted);
    font-weight: 400;
    line-height: 1.45;
  }

  .admin-content-editor-form {
    display: grid;
    gap: 16px;
  }

  .admin-content-editor-form fieldset {
    min-width: 0;
    margin: 0;
    padding: 16px;
    border: 1px solid rgba(0, 229, 255, 0.22);
    border-radius: 8px;
    background: rgba(8, 10, 15, 0.36);
  }

  .admin-content-editor-form legend {
    padding: 0 8px;
    color: var(--accent);
    font-weight: 800;
  }

  .admin-content-editor-form textarea {
    resize: vertical;
  }

  .conversation-page-body-editor {
    display: grid;
    gap: 6px;
    font-weight: 700;
  }

  .conversation-format-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(38, 50, 68, 0.92);
    border-radius: 6px;
    background: rgba(5, 9, 14, 0.72);
  }

  .conversation-format-toolbar button {
    width: auto;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: rgba(22, 29, 39, 0.96);
    color: var(--text);
    cursor: pointer;
  }

  .conversation-format-toolbar button:hover,
  .conversation-format-toolbar button:focus-visible {
    border-color: var(--cyan);
  }

  .conversation-format-large {
    font-size: 1.16em;
  }

  .conversation-format-color.is-cyan {
    color: #00e5ff;
  }

  .conversation-format-color.is-yellow {
    color: #ffcc33;
  }

  .conversation-format-color.is-red {
    color: #ff5c6c;
  }

  .conversation-format-color.is-pink {
    color: #ff79c6;
  }

  .admin-editor-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
  }

  .admin-editor-actions,
  .admin-editor-warning form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .admin-content-editor-form .admin-editor-confirm {
    display: flex;
    flex: 1 1 100%;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 171, 0, 0.52);
    border-radius: 6px;
    background: rgba(85, 48, 0, 0.2);
  }

  .admin-content-editor-form .admin-editor-confirm input {
    width: auto;
    margin: 0;
  }

  .admin-editor-table-wrap {
    overflow-x: auto;
  }

  .admin-editor-table td,
  .admin-editor-table th {
    vertical-align: middle;
  }

  .admin-editor-table tr.is-inactive td {
    opacity: 0.58;
  }

  .admin-editor-table code {
    color: var(--muted);
  }

  .admin-editor-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
  }

  .admin-editor-pagination .button {
    width: auto;
    min-width: 42px;
    text-align: center;
  }

  .admin-editor-pagination .button.is-current {
    border-color: var(--accent);
    background: rgba(0, 229, 255, 0.2);
    color: var(--text);
    cursor: default;
  }

  .admin-editor-warning {
    border-color: rgba(255, 171, 0, 0.72);
    background: rgba(85, 48, 0, 0.24);
  }

  .admin-editor-usage {
    border-color: rgba(255, 171, 0, 0.62);
  }

  .admin-editor-publish-box {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(38, 50, 68, 0.92);
  }

  .admin-item-filter {
    grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
  }

  .admin-item-effect-row {
    display: grid;
    grid-template-columns: minmax(180px, 2fr) minmax(150px, 1.3fr) minmax(110px, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px 0;
    border-bottom: 1px solid rgba(38, 50, 68, 0.72);
  }

  .admin-item-effect-row .button {
    width: auto;
  }

  .button-danger {
    border-color: rgba(255, 59, 48, 0.72);
    background: linear-gradient(180deg, rgba(128, 24, 20, 0.92), rgba(76, 14, 12, 0.96));
    color: #ffd7d4;
  }

  .admin-gacha-search {
    grid-template-columns: minmax(240px, 1fr) auto auto;
  }

  .admin-gacha-portal-grid,
  .admin-gacha-placement-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .admin-gacha-portal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(0, 229, 255, 0.22);
    border-radius: 7px;
    background: rgba(8, 10, 15, 0.36);
  }

  .admin-gacha-portal-item div {
    display: grid;
    gap: 4px;
  }

  .admin-gacha-portal-item small {
    color: var(--muted);
  }

  .admin-gacha-switch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 86px;
    padding: 8px 10px;
    border: 1px solid rgba(142, 151, 164, 0.62);
    border-radius: 6px;
    background: rgba(27, 31, 39, 0.96);
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
  }

  .admin-gacha-switch span {
    width: 22px;
    height: 12px;
    border-radius: 6px;
    background: rgba(142, 151, 164, 0.62);
  }

  .admin-gacha-switch.is-on {
    border-color: rgba(0, 229, 255, 0.72);
    color: var(--text);
  }

  .admin-gacha-switch.is-on span {
    background: var(--accent);
  }

  .admin-gacha-placement-grid fieldset {
    display: grid;
    gap: 12px;
  }

  .gacha-corner-placeholder {
    min-height: 220px;
    display: grid;
    place-items: center;
    text-align: center;
  }

  .admin-gacha-lineup-table input,
  .admin-gacha-lineup-table select,
  .admin-gacha-result-add input {
    width: 100%;
    min-width: 90px;
    padding: 8px;
    border: 1px solid rgba(0, 229, 255, 0.32);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.74);
    color: var(--text);
    font: inherit;
  }

  .admin-gacha-row-actions,
  .admin-gacha-result-add {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: end;
  }

  .admin-gacha-row-actions .button,
  .admin-gacha-result-add .button {
    width: auto;
  }

  .admin-gacha-result-add label {
    display: grid;
    gap: 4px;
    font-size: 0.82rem;
  }

  .admin-dungeon-floor-row {
    margin: 12px 0;
    padding: 14px;
    border: 1px solid rgba(38, 50, 68, 0.82);
    border-radius: 7px;
    background: rgba(5, 8, 13, 0.32);
  }

  .admin-dungeon-floor-row h3 {
    margin: 0 0 12px;
    color: var(--accent);
  }

  .admin-choice-relation-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 10px;
    align-items: end;
    padding: 12px 0;
    border-bottom: 1px solid rgba(38, 50, 68, 0.72);
  }

  .admin-choice-relation-row .button {
    width: auto;
  }

  @media (max-width: 900px) {
    .admin-editor-filter,
    .admin-item-filter,
    .admin-editor-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-gacha-portal-grid,
    .admin-gacha-placement-grid {
      grid-template-columns: 1fr;
    }

    .admin-item-effect-row {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-choice-relation-row {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @media (max-width: 600px) {
    .admin-editor-filter,
    .admin-item-filter,
    .admin-gacha-search,
    .admin-item-effect-row,
    .admin-choice-relation-row,
    .admin-editor-grid {
      grid-template-columns: 1fr;
    }
  }

/* characters.php */
.character-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: end;
  }

  .character-search-form label {
    display: grid;
    flex: 1 1 220px;
    gap: 4px;
  }

  .character-search-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0, 229, 255, 0.32);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.74);
    color: var(--text);
    font: inherit;
  }

  .character-search-form .button,
  .character-pager .button {
    width: auto;
  }

  .character-pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 24px 0 0;
  }

  .character-page-numbers {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .character-pager .character-page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 42px;
    padding: 8px 10px;
  }

  .character-pager .character-page-number.is-current {
    border-color: var(--cyan);
    background: rgba(0, 229, 255, 0.24);
    color: #ffffff;
    box-shadow: 0 0 18px rgba(0, 229, 255, 0.18);
    cursor: default;
  }

  .character-pager-step {
    min-height: 42px;
    padding: 8px 14px;
  }

  .character-table-wrap {
    overflow-x: auto;
    margin-top: 12px;
  }

  .character-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
  }

  .character-table th,
  .character-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(38, 50, 68, 0.92);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
  }

  .character-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    background: rgba(0, 229, 255, 0.12);
  }

  .character-summary-cell {
    min-width: 220px;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .character-table .button {
    width: auto;
    padding: 8px 12px;
  }

  .character-card-grid,
  .r18-character-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
  }

  .character-list-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    min-width: 0;
    padding: 18px;
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 8px;
    background:
      linear-gradient(180deg, rgba(0, 229, 255, 0.1), rgba(8, 10, 15, 0.74)),
      rgba(18, 23, 34, 0.88);
    box-shadow: 0 16px 38px rgba(0, 229, 255, 0.08);
  }

  .character-list-photo {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 3 / 4;
    align-self: start;
    border: 1px solid rgba(0, 229, 255, 0.34);
    border-radius: 6px;
    background:
      linear-gradient(180deg, rgba(0, 229, 255, 0.1), rgba(155, 255, 74, 0.04)),
      rgba(8, 10, 15, 0.58);
  }

  .character-list-photo .character-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .character-list-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
  }

  .character-list-name {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
    margin: 0;
    color: var(--text);
    font-size: 20px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .character-list-eno {
    color: var(--cyan);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }

  .character-list-name a {
    color: inherit;
    text-decoration: none;
  }

  .character-list-name a:hover {
    color: var(--cyan);
  }

  .character-list-summary {
    margin: 0;
    color: var(--text);
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .character-list-tags {
    min-height: 32px;
    padding: 8px 10px;
    border: 1px solid rgba(0, 229, 255, 0.26);
    border-radius: 6px;
    color: var(--cyan);
    background: rgba(8, 10, 15, 0.5);
    font-size: 13px;
    font-weight: 800;
    overflow-wrap: anywhere;
  }

  .character-tag-list {
    display: block;
    min-width: 0;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .character-tag-list--clamped {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .character-tag-link {
    color: inherit;
    font-weight: 800;
    text-decoration: none;
  }

  .character-tag-link + .character-tag-link {
    margin-left: 0.45em;
  }

  .character-tag-link:hover,
  .character-tag-link:focus-visible {
    color: var(--yellow);
    text-decoration: underline;
  }

  .character-tags-empty {
    color: var(--muted);
  }

  .character-list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: start;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .character-list-meta span {
    padding: 3px 7px;
    border: 1px solid rgba(38, 50, 68, 0.9);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.45);
  }

  .character-list-detail {
    width: 100%;
    align-self: end;
    margin-top: auto;
  }

  .r18-character-grid {
    --character-card-accent: rgba(255, 42, 109, 0.48);
  }

  .theme-r18 .r18-character-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    padding: 18px;
    border: 1px solid rgba(255, 42, 109, 0.48);
    border-radius: 8px;
    border-color: rgba(255, 42, 109, 0.48);
    background:
      linear-gradient(180deg, rgba(255, 42, 109, 0.12), rgba(8, 10, 15, 0.74)),
      rgba(18, 23, 34, 0.88);
    box-shadow: 0 16px 38px rgba(255, 42, 109, 0.12);
  }

  .theme-r18 .r18-character-photo-slot {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 3 / 4;
    border: 1px solid rgba(255, 42, 109, 0.38);
    border-radius: 6px;
    background:
      linear-gradient(180deg, rgba(255, 42, 109, 0.12), rgba(0, 229, 255, 0.06)),
      rgba(8, 10, 15, 0.58);
    color: rgba(255, 214, 226, 0.72);
    font-size: 11px;
    font-weight: 800;
  }

  .theme-r18 .r18-character-photo-slot .character-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .r18-character-card-body {
    display: grid;
    gap: 10px;
    min-width: 0;
  }

  .r18-card-topline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .theme-r18 .r18-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid rgba(255, 42, 109, 0.5);
    border-radius: 6px;
    background: rgba(255, 42, 109, 0.16);
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
  }

  .theme-r18 .r18-badge-secondary {
    border-color: rgba(0, 229, 255, 0.34);
    background: rgba(0, 229, 255, 0.08);
  }

  .theme-r18 .r18-character-name {
    margin: 0;
    color: var(--text);
    font-size: 20px;
    line-height: 1.3;
  }

  .theme-r18 .character-list-eno {
    color: #ff9fbd;
  }

  .theme-r18 .r18-character-name a {
    color: inherit;
    text-decoration: none;
  }

  .theme-r18 .r18-character-tags {
    min-height: 32px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 42, 109, 0.32);
    border-radius: 6px;
    color: #ffd6e2;
    background: rgba(8, 10, 15, 0.5);
    font-size: 13px;
    font-weight: 800;
    overflow-wrap: anywhere;
  }

  .theme-r18 .r18-character-summary {
    margin: 0;
    color: var(--text);
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .theme-r18 .r18-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .theme-r18 .r18-card-meta span {
    padding: 3px 7px;
    border: 1px solid rgba(38, 50, 68, 0.9);
    border-radius: 6px;
    background: rgba(8, 10, 15, 0.45);
  }

  .theme-r18 .r18-empty-message {
    border-color: rgba(255, 42, 109, 0.42);
    background: rgba(255, 42, 109, 0.08);
  }

  .theme-r18 .r18-shop-panel,
  .theme-r18 .r18-chat-panel,
  .theme-r18 .r18-equipment-panel,
  .theme-r18 .r18-tactics-panel,
  .theme-r18 .r18-dungeon-panel {
    border-color: rgba(255, 42, 109, 0.46);
    background:
      linear-gradient(180deg, rgba(255, 42, 109, 0.1), rgba(8, 10, 15, 0.82)),
      rgba(18, 23, 34, 0.88);
    box-shadow: 0 16px 38px rgba(255, 42, 109, 0.12);
  }

  .theme-r18 .r18-shop-title,
  .theme-r18 .r18-chat-title,
  .theme-r18 .r18-equipment-title,
  .theme-r18 .r18-tactics-title,
  .theme-r18 .r18-dungeon-title {
    color: #ffd6e2;
  }

  .theme-r18 .loadout-tab.active {
    border-color: rgba(255, 42, 109, 0.78);
    color: #ffd6e2;
  }

  .theme-r18 .r18-chat-panel .chat-message {
    border-color: rgba(255, 42, 109, 0.28);
    background: rgba(8, 10, 15, 0.58);
  }

  .theme-r18 .chat-room-select-row select {
    border-color: rgba(255, 42, 109, 0.46);
    background: rgba(255, 42, 109, 0.08);
  }

  @media (max-width: 860px) {
    .character-card-grid,
    .r18-character-grid {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 520px) {
    .character-list-card,
    .theme-r18 .r18-character-card {
      grid-template-columns: 86px minmax(0, 1fr);
      padding: 14px;
    }
  }


/* use_item.php */
.use-item-success {
    border-left-color: var(--green);
    color: var(--text);
    font-weight: 800;
    background: linear-gradient(90deg, rgba(155, 255, 74, 0.12), rgba(0, 229, 255, 0.06));
  }

  .consumable-list {
    display: grid;
    gap: 14px;
  }

  .consumable-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 16px;
    align-items: center;
  }

  .effect-text {
    margin-top: 6px;
    color: var(--cyan);
    font-weight: 800;
  }

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


/* seed_dates/seed_food_items.php */
.seed-page {
      font-family: Arial, "Yu Gothic", Meiryo, sans-serif;
      line-height: 1.7;
      padding: 24px;
      background: var(--bg);
      color: var(--text);
    }

.seed-page table {
      border-collapse: collapse;
      width: min(900px, 100%);
      background: rgba(18, 23, 34, 0.86);
    }

.seed-page th,
.seed-page td {
      border: 1px solid rgba(38, 50, 68, 0.92);
      padding: 8px 10px;
      text-align: left;
    }

.seed-page th {
      background: rgba(0, 229, 255, 0.12);
      color: var(--muted);
    }

    .seed-page .warning {
      color: #ffb4ae;
      font-weight: 800;
    }


/* casino.php alcohol rotation */
.casino-alcohol-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.casino-alcohol-gacha-form {
  flex: 0 0 auto;
}

@media (max-width: 760px) {
  .casino-alcohol-heading {
    display: grid;
  }
}


/* rulebook.php */
.page-rulebook {
  scroll-behavior: smooth;
}

.rulebook-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--line-hot);
  background:
    linear-gradient(125deg, rgba(0, 229, 255, 0.12), transparent 52%),
    linear-gradient(315deg, rgba(255, 42, 109, 0.1), transparent 48%),
    rgba(10, 15, 24, 0.94);
  box-shadow: 0 0 28px rgba(0, 229, 255, 0.1);
}

.rulebook-hero::after {
  content: "LDC // RULEBOOK";
  position: absolute;
  right: 20px;
  bottom: 4px;
  color: rgba(0, 229, 255, 0.07);
  font-size: clamp(32px, 7vw, 76px);
  font-weight: 900;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.rulebook-hero > * {
  position: relative;
  z-index: 1;
}

.rulebook-eyebrow,
.rulebook-section-no {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.rulebook-hero h1 {
  max-width: 820px;
  margin: 8px 0 14px;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.08;
}

.rulebook-hero > p {
  max-width: 800px;
  color: var(--text);
  font-size: 17px;
}

.rulebook-notice {
  max-width: 800px;
  margin: 20px 0 0;
}

.rulebook-toc {
  margin-bottom: 20px;
}

.rulebook-toc ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 28px;
  margin: 0;
  padding-left: 28px;
}

.rulebook-toc a {
  color: var(--text);
  text-decoration-color: rgba(0, 229, 255, 0.45);
  text-underline-offset: 3px;
}

.rulebook-toc a:hover {
  color: var(--cyan);
}

.rulebook-content {
  display: grid;
  gap: 20px;
}

.rulebook-section {
  position: relative;
  scroll-margin-top: 20px;
}

.rulebook-section-no {
  display: block;
  margin-bottom: 2px;
}

.rulebook-section h2 {
  margin-top: 0;
}

.rulebook-section h3 {
  margin: 24px 0 8px;
  color: var(--cyan);
  font-size: 17px;
}

.rulebook-section li + li {
  margin-top: 5px;
}

.rulebook-steps {
  counter-reset: rulebook-step;
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.rulebook-steps li {
  counter-increment: rulebook-step;
  position: relative;
  min-height: 44px;
  padding: 10px 12px 10px 54px;
  border-left: 2px solid var(--cyan);
  background: rgba(0, 229, 255, 0.06);
}

.rulebook-steps li::before {
  content: counter(rulebook-step, decimal-leading-zero);
  position: absolute;
  left: 12px;
  color: var(--cyan);
  font-weight: 900;
}

.rulebook-flow,
.rulebook-definition-grid,
.rulebook-choice-grid,
.rulebook-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.rulebook-flow .item,
.rulebook-definition-grid .item,
.rulebook-choice-grid .item,
.rulebook-menu-grid .item {
  display: grid;
  align-content: start;
  gap: 6px;
}

.rulebook-flow strong,
.rulebook-definition-grid strong,
.rulebook-choice-grid strong,
.rulebook-menu-grid strong {
  color: var(--cyan);
}

.rulebook-table-wrap {
  overflow-x: auto;
}

.rulebook-table {
  width: 100%;
  border-collapse: collapse;
}

.rulebook-table th,
.rulebook-table td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.rulebook-table th {
  width: 150px;
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
}

.rulebook-warning {
  border-left-color: var(--yellow);
}

.rulebook-status-list {
  display: grid;
  gap: 12px;
}

.rulebook-status-list .item h3 {
  margin-top: 0;
}

.rulebook-status-list .item p:last-child {
  margin-bottom: 0;
}

.rulebook-alert-text {
  color: var(--yellow);
}

.rulebook-faq {
  border-bottom: 1px solid var(--line);
  padding: 12px 4px;
}

.rulebook-faq summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.rulebook-faq[open] summary {
  color: var(--cyan);
}

.rulebook-faq p {
  margin: 10px 0 0 20px;
  color: var(--muted);
}

.rulebook-back-to-top {
  margin-top: 20px;
  text-align: right;
}

.page-rulebook-r18 .rulebook-hero {
  border-color: rgba(255, 91, 163, 0.58);
  background:
    radial-gradient(circle at 92% 0%, rgba(255, 112, 190, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(77, 15, 48, 0.52), rgba(18, 12, 27, 0.96));
  box-shadow: inset 0 0 30px rgba(255, 70, 150, 0.08), 0 0 30px rgba(255, 42, 109, 0.14);
}

.page-rulebook-r18 .rulebook-hero::after {
  content: "LDC // R18 RULEBOOK";
  color: rgba(255, 138, 199, 0.1);
}

.page-rulebook-r18 .rulebook-eyebrow,
.page-rulebook-r18 .rulebook-section-no,
.page-rulebook-r18 .rulebook-section h3,
.page-rulebook-r18 .rulebook-flow strong,
.page-rulebook-r18 .rulebook-definition-grid strong,
.page-rulebook-r18 .rulebook-choice-grid strong,
.page-rulebook-r18 .rulebook-menu-grid strong,
.page-rulebook-r18 .rulebook-table th {
  color: #ff78ba;
}

.page-rulebook-r18 .rulebook-notice,
.page-rulebook-r18 .rulebook-warning {
  border-color: rgba(255, 91, 163, 0.52);
  background: rgba(77, 15, 48, 0.28);
}

.page-rulebook-r18 .rulebook-toc,
.page-rulebook-r18 .rulebook-section {
  border-color: rgba(255, 91, 163, 0.38);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 112, 190, 0.08), transparent 32%),
    linear-gradient(145deg, rgba(35, 13, 31, 0.92), rgba(13, 15, 24, 0.96));
  box-shadow: inset 0 0 22px rgba(255, 70, 150, 0.04), 0 0 18px rgba(255, 42, 109, 0.06);
}

.page-rulebook-r18 .rulebook-toc a {
  text-decoration-color: rgba(255, 120, 186, 0.5);
}

.page-rulebook-r18 .rulebook-toc a:hover,
.page-rulebook-r18 .rulebook-faq[open] summary {
  color: #ff8bc5;
}

.page-rulebook-r18 .rulebook-table th {
  background: rgba(255, 42, 109, 0.12);
}

.page-rulebook-r18 .rulebook-section-no {
  text-shadow: 0 0 12px rgba(255, 95, 180, 0.52);
}

@media (max-width: 760px) {
  .rulebook-toc ol,
  .rulebook-flow,
  .rulebook-definition-grid,
  .rulebook-choice-grid,
  .rulebook-menu-grid {
    grid-template-columns: 1fr;
  }

  .rulebook-hero {
    padding: 24px 18px;
  }

  .rulebook-table th {
    width: 100px;
  }
}


/* world.php */
.page-world-guide {
  scroll-behavior: smooth;
}

.world-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  padding: clamp(26px, 5vw, 52px);
  border: 1px solid var(--line-hot);
  background:
    linear-gradient(125deg, rgba(0, 229, 255, 0.14), transparent 48%),
    linear-gradient(315deg, rgba(255, 42, 109, 0.13), transparent 46%),
    rgba(10, 15, 24, 0.96);
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.1);
}

.world-hero::before {
  content: "LDC // ORIENTATION";
  position: absolute;
  right: 18px;
  bottom: -4px;
  color: rgba(0, 229, 255, 0.065);
  font-size: clamp(32px, 6vw, 72px);
  font-weight: 900;
  letter-spacing: 0.08em;
  white-space: nowrap;
  pointer-events: none;
}

.world-hero > * {
  position: relative;
  z-index: 1;
}

.world-eyebrow,
.world-section-no,
.world-speaker {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.world-hero h1 {
  max-width: 860px;
  margin: 8px 0 14px;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.08;
}

.world-hero > p {
  max-width: 800px;
  color: var(--text);
  font-size: 17px;
}

.world-system-message {
  max-width: 840px;
  margin-top: 24px;
  padding: 15px 18px;
  border-left: 3px solid var(--cyan);
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.1), rgba(255, 42, 109, 0.05));
}

.world-system-message p {
  margin: 7px 0 0;
  color: var(--text);
  font-weight: 800;
}

.world-system-message small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.world-system-message--dark {
  max-width: none;
  background: rgba(8, 10, 15, 0.58);
}

.world-toc {
  margin-bottom: 20px;
}

.world-toc h2 {
  margin-top: 0;
}

.world-toc ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 28px;
  margin: 0;
  padding-left: 28px;
}

.world-toc a {
  color: var(--text);
  text-decoration-color: rgba(0, 229, 255, 0.45);
  text-underline-offset: 3px;
}

.world-toc a:hover {
  color: var(--cyan);
}

.world-content {
  display: grid;
  gap: 20px;
}

.world-section {
  scroll-margin-top: 20px;
}

.world-section h2 {
  margin-top: 2px;
}

.world-section h3 {
  margin: 5px 0 8px;
}

.world-section p {
  max-width: 980px;
}

.world-data-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.world-data-strip span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: rgba(0, 229, 255, 0.045);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.world-data-strip b {
  margin-right: 6px;
  color: var(--cyan);
}

.world-warning {
  margin-top: 18px;
  border-left-color: var(--yellow);
  background: rgba(252, 238, 9, 0.06);
}

.world-element-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.world-element-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 19, 0.72);
}

.world-element-card > span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.world-element-card h3 {
  color: var(--text);
}

.world-element-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.element-fire { border-top-color: #ff5d5d; }
.element-fire > span { color: #ff7676; }
.element-water { border-top-color: #4b82ff; }
.element-water > span { color: #7ba1ff; }
.element-thunder { border-top-color: var(--yellow); }
.element-thunder > span { color: var(--yellow); }
.element-wind { border-top-color: var(--green); }
.element-wind > span { color: var(--green); }
.element-ice { border-top-color: var(--cyan); }
.element-ice > span { color: var(--cyan); }

.world-reference-note {
  color: var(--muted);
  font-size: 13px;
}

.world-company-grid,
.world-activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.world-company-grid .item,
.world-activity-grid .item {
  display: grid;
  gap: 6px;
}

.world-company-grid strong,
.world-activity-grid strong {
  color: var(--cyan);
}

.world-company-disclaimer {
  border-color: rgba(252, 238, 9, 0.4);
  background: rgba(252, 238, 9, 0.045);
}

.world-company-disclaimer strong {
  color: var(--yellow);
}

.world-broadcast-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 22px 0;
  border: 1px solid var(--line-hot);
  background: var(--line);
}

.world-broadcast-flow > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 15px;
  background: rgba(8, 12, 19, 0.94);
}

.world-broadcast-flow span {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
}

.world-broadcast-flow b {
  color: var(--text);
  letter-spacing: 0.08em;
}

.world-broadcast-flow small {
  color: var(--muted);
}

.world-contract-card {
  display: grid;
  gap: 1px;
  margin-top: 20px;
  border: 1px solid var(--line);
  background: var(--line);
}

.world-contract-card > div {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  padding: 11px 14px;
  background: rgba(8, 12, 19, 0.86);
}

.world-contract-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.world-contract-card strong {
  color: var(--cyan);
  overflow-wrap: anywhere;
}

.world-continuity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.world-choice-card {
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 19, 0.72);
}

.world-choice-card > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.world-choice-card p {
  color: var(--muted);
}

.world-choice-card > strong {
  display: block;
  margin-top: 16px;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.clone-choice {
  border-left: 3px solid var(--magenta);
}

.clone-choice > strong {
  color: var(--magenta);
}

.rescue-choice {
  border-left: 3px solid var(--yellow);
}

.rescue-choice > strong {
  color: var(--yellow);
}

.world-closing {
  margin-top: 20px;
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid var(--line-hot);
  background:
    linear-gradient(100deg, rgba(0, 229, 255, 0.1), rgba(255, 42, 109, 0.08)),
    rgba(10, 15, 24, 0.94);
  text-align: center;
}

.world-closing p {
  margin: 10px auto 18px;
  max-width: 820px;
  color: var(--text);
  font-weight: 800;
}

.world-closing .button + .button {
  margin-left: 8px;
}

.world-back-to-top {
  margin-top: 20px;
  text-align: right;
}

@media (max-width: 980px) {
  .world-element-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .world-element-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .world-toc ol,
  .world-company-grid,
  .world-activity-grid,
  .world-continuity-grid,
  .world-broadcast-flow {
    grid-template-columns: 1fr;
  }

  .world-hero {
    padding: 24px 18px;
  }

  .world-contract-card > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 460px) {
  .world-element-grid {
    grid-template-columns: 1fr;
  }

  .world-element-card:last-child {
    grid-column: auto;
  }

  .world-closing .button {
    display: block;
    width: 100%;
  }

  .world-closing .button + .button {
    margin: 8px 0 0;
  }
}


/* admin_rulebook.php */
.rulebook-editor-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 18px;
}

.rulebook-editor-form {
  display: grid;
  gap: 18px;
}

.rulebook-editor-sticky-actions {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line-hot);
  background: rgba(8, 12, 19, 0.96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

.rulebook-editor-section {
  scroll-margin-top: 80px;
}

.rulebook-editor-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.rulebook-editor-heading h2 {
  margin: 2px 0;
}

.rulebook-editor-active {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: var(--green);
  font-weight: 800;
}

.rulebook-editor-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 120px;
  gap: 12px;
  margin-bottom: 14px;
}

.rulebook-editor-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.rulebook-editor-fields input,
.rulebook-source-editor {
  width: 100%;
}

.rulebook-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: rgba(0, 229, 255, 0.05);
}

.rulebook-editor-toolbar button {
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
}

.rulebook-editor-toolbar button:hover,
.rulebook-editor-toolbar button:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan);
}

.rulebook-rich-editor,
.rulebook-source-editor {
  min-height: 260px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 19, 0.8);
  color: var(--text);
  font: inherit;
  line-height: 1.7;
}

.rulebook-rich-editor:focus,
.rulebook-source-editor:focus {
  outline: 1px solid var(--cyan);
  border-color: var(--cyan);
}

.rulebook-rich-editor h3 {
  color: var(--cyan);
}

.rulebook-source-editor {
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.rulebook-editor-bottom-actions {
  text-align: right;
}

@media (max-width: 800px) {
  .rulebook-editor-fields {
    grid-template-columns: 1fr;
  }

  .announcement-editor-fields {
    grid-template-columns: 1fr;
  }

  .announcement-editor-fields label:first-child,
  .announcement-editor-fields label:nth-child(2) {
    grid-column: auto;
  }

  .rulebook-editor-heading {
    display: grid;
  }
}


/* admin_game_settings.php */
.game-setting-panel {
  max-width: 900px;
}

.game-setting-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.game-setting-heading h2 {
  margin-top: 0;
}

.game-setting-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 110px;
  padding: 12px 16px;
  border: 1px solid var(--line-hot);
  background: rgba(0, 229, 255, 0.07);
  color: var(--cyan);
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}

.game-setting-switch input {
  width: 20px;
  height: 20px;
  accent-color: var(--cyan);
}

.game-setting-enabled {
  border-left-color: var(--green);
  color: var(--green);
}

@media (max-width: 680px) {
  .game-setting-heading {
    display: grid;
  }
}
/* Conversation events */
.page-conversation-event {
  min-height: 100vh;
}

.conversation-event-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 88px);
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  place-items: center;
}

.conversation-event-error {
  width: min(720px, 100%);
}

.conversation-event-stage {
  position: relative;
  width: 100%;
  min-height: min(760px, calc(100vh - 120px));
  overflow: hidden;
  border: 1px solid rgba(0, 229, 255, 0.4);
  border-radius: 12px;
  background:
    radial-gradient(circle at 24% 32%, rgba(0, 229, 255, 0.13), transparent 34%),
    linear-gradient(145deg, rgba(12, 18, 27, 0.97), rgba(5, 7, 12, 0.99));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42), inset 0 0 48px rgba(0, 229, 255, 0.04);
}

.conversation-event-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--scanline) center / 360px auto repeat;
  opacity: 0.07;
}

.conversation-event-header {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.22);
  background: rgba(5, 9, 14, 0.76);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.conversation-event-header strong {
  color: var(--cyan);
  font-size: 14px;
}

.conversation-event-portrait {
  position: absolute;
  inset: 58px 0 150px;
  display: grid;
  place-items: end center;
  padding: 20px 20px 0;
}

.conversation-event-portrait img {
  display: block;
  width: min(54vw, 400px);
  max-height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.46));
}

.conversation-event-portrait-placeholder {
  width: min(54vw, 400px);
  height: min(72vh, 620px);
  display: grid;
  place-content: center;
  gap: 18px;
  border: 1px dashed rgba(0, 229, 255, 0.35);
  border-radius: 48% 48% 10px 10px;
  background:
    linear-gradient(180deg, rgba(0, 229, 255, 0.08), rgba(0, 229, 255, 0.015)),
    rgba(7, 14, 20, 0.42);
  color: rgba(0, 229, 255, 0.65);
  text-align: center;
}

.conversation-event-portrait-placeholder span {
  font-size: clamp(34px, 7vw, 72px);
  font-weight: 900;
  letter-spacing: 0.14em;
}

.conversation-event-portrait-placeholder small {
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: 0.18em;
}

.conversation-event-dialogue {
  position: absolute;
  z-index: 4;
  right: 22px;
  bottom: 22px;
  left: 22px;
  min-height: 174px;
  padding: 32px 24px 18px;
  border: 1px solid rgba(0, 229, 255, 0.5);
  border-radius: 9px;
  background: rgba(5, 9, 14, 0.94);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.46), inset 0 0 24px rgba(0, 229, 255, 0.04);
}

.conversation-event-speaker {
  position: absolute;
  top: -17px;
  left: 18px;
  min-width: 150px;
  padding: 8px 18px;
  border: 1px solid rgba(0, 229, 255, 0.62);
  border-radius: 6px;
  background: #071017;
  color: var(--cyan);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.conversation-event-body {
  min-height: 64px;
  color: var(--text);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.85;
}

.conversation-event-body .conversation-text-bold {
  font-weight: 900;
}

.conversation-event-body .conversation-text-large {
  font-size: 1.45em;
  line-height: 1.35;
}

.conversation-event-body .conversation-text-color {
  font-weight: inherit;
}

.conversation-preview-badge {
  position: absolute;
  z-index: 6;
  top: 58px;
  right: 14px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 204, 51, 0.72);
  border-radius: 999px;
  background: rgba(8, 10, 14, 0.88);
  color: #ffcc33;
  font-size: 12px;
  font-weight: 900;
}

.conversation-event-replay-badge {
  position: absolute;
  z-index: 6;
  top: 58px;
  right: 14px;
  padding: 6px 10px;
  border: 1px solid rgba(92, 255, 157, 0.72);
  border-radius: 999px;
  background: rgba(8, 10, 14, 0.88);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.conversation-event-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.conversation-event-footer form {
  margin: 0;
}

.conversation-event-history-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: min(280px, 100%);
}

.conversation-event-history-actions .button {
  width: auto;
  min-width: 120px;
}

@media (max-width: 700px) {
  .conversation-event-shell {
    width: min(100% - 16px, 1120px);
    min-height: calc(100vh - 72px);
    padding: 12px 0;
  }

  .conversation-event-stage {
    min-height: calc(100vh - 96px);
  }

  .conversation-event-header {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
  }

  .conversation-event-portrait {
    inset: 76px 0 230px;
  }

  .conversation-event-portrait img,
  .conversation-event-portrait-placeholder {
    width: min(76vw, 400px);
  }

  .conversation-event-dialogue {
    right: 10px;
    bottom: 10px;
    left: 10px;
    min-height: 220px;
    padding: 30px 16px 14px;
  }

  .conversation-event-body {
    font-size: 15px;
    line-height: 1.7;
  }

  .conversation-event-footer {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .conversation-event-history-actions {
    flex: 1 1 100%;
    min-width: 0;
  }

  .conversation-event-history-actions .button {
    flex: 1 1 0;
  }

  .conversation-event-replay-badge {
    top: 76px;
    right: 10px;
    font-size: 10px;
  }
}

/* user_uploads.php */
.profile-page-tools {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 18px;
}

.profile-page-tools .button,
.user-upload-back-link {
  width: auto;
}

.user-upload-page {
  display: grid;
  gap: 20px;
}

.user-upload-heading,
.user-upload-quota-heading,
.user-upload-list-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.user-upload-heading h1,
.user-upload-quota-heading h2,
.user-upload-list-heading h2 {
  margin-top: 0;
}

.user-upload-heading p {
  margin: 0;
}

.user-upload-quota-heading strong {
  color: var(--cyan);
  white-space: nowrap;
}

.user-upload-progress {
  display: block;
  width: 100%;
  height: 16px;
  accent-color: var(--cyan);
}

.user-upload-dropzone {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 150px;
  padding: 26px 18px;
  border: 1px dashed rgba(0, 229, 255, 0.6);
  border-radius: 8px;
  background: rgba(0, 229, 255, 0.05);
  text-align: center;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.user-upload-dropzone:hover,
.user-upload-dropzone:focus,
.user-upload-dropzone.is-dragging {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.12);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.12);
  outline: none;
}

.user-upload-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.user-upload-dropzone-label {
  display: grid;
  gap: 4px;
  color: var(--text);
  cursor: pointer;
}

.user-upload-dropzone-label strong {
  color: var(--cyan);
  font-size: 18px;
}

.user-upload-selected-file {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
}

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

.user-upload-options label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.user-upload-spec-grid .item {
  display: grid;
  gap: 4px;
}

.user-upload-spec-grid .item span {
  color: var(--muted);
  font-size: 13px;
}

.user-upload-spec-note {
  margin: 16px 0 0;
}

.user-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.user-upload-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(38, 50, 68, 0.92);
  border-radius: 8px;
  background: rgba(8, 10, 15, 0.62);
}

.user-upload-copy {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: rgba(0, 229, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.user-upload-copy img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.user-upload-copy span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  left: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.78);
  color: var(--text);
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.user-upload-copy:hover span,
.user-upload-copy:focus span {
  opacity: 1;
}

.user-upload-card-body {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.user-upload-card-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-upload-card-body span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.user-upload-delete {
  margin-top: 6px;
  border-color: rgba(255, 59, 48, 0.62);
  background: rgba(255, 59, 48, 0.12);
}

.user-upload-delete-form {
  margin: 0;
}

@media (max-width: 680px) {
  .user-upload-heading,
  .user-upload-quota-heading,
  .user-upload-list-heading {
    display: grid;
  }

  .user-upload-back-link {
    width: 100%;
  }

  .user-upload-options {
    grid-template-columns: 1fr;
  }
}

/* Normal Home dashboard */
.page-home-normal .main-column {
  position: relative;
  isolation: isolate;
}

.page-home-normal .main-column::before {
  content: "";
  position: fixed;
  z-index: -1;
  top: 72px;
  right: 0;
  bottom: 0;
  width: min(42vw, 720px);
  pointer-events: none;
  background:
    linear-gradient(90deg, #080a0f 0%, rgba(8, 10, 15, 0.94) 18%, rgba(8, 10, 15, 0.42) 58%, rgba(8, 10, 15, 0.12) 100%),
    linear-gradient(180deg, rgba(8, 10, 15, 0.18), rgba(8, 10, 15, 0.56)),
    url("assets/ui/home-dungeon-dispatch-bg.png") right center / cover no-repeat;
  opacity: 0.82;
}

.page-home-normal .content-wrap {
  position: relative;
  z-index: 1;
}

.page-home-normal .page {
  width: min(1460px, 100%);
}

.normal-home-dashboard {
  display: grid;
  gap: 20px;
}

.normal-home-dashboard .home-hero,
.normal-home-dashboard .panel,
.normal-home-dashboard .message,
.normal-home-dashboard .character-public-icons {
  backdrop-filter: blur(4px);
}

.normal-home-dashboard .home-hero {
  margin: 0;
}

.normal-home-dashboard .home-hero + .message,
.normal-home-dashboard .message {
  margin-bottom: 0;
}

.home-command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 16px;
  align-items: start;
}

.home-command-stack,
.home-dashboard-stack,
.home-profile-reading {
  display: grid;
  gap: 16px;
}

.home-notifications-panel,
.home-character-panel,
.home-equipment-panel,
.home-status-panel,
.home-meal-panel,
.home-summary-panel,
.home-profile-panel {
  min-width: 0;
}

.normal-home-dashboard .panel > h2,
.normal-home-dashboard .character-public-icons > h2,
.home-equipment-panel > h2 {
  margin: 0 0 12px;
  color: var(--cyan);
}

.home-notifications-panel .notification-list {
  align-content: start;
}

.home-overview-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.page-home-normal .fullbody-frame {
  position: sticky;
  top: 92px;
  width: 100%;
}

.page-home-normal .fullbody-image-wrap {
  width: 100%;
  min-height: 0;
  aspect-ratio: 1 / 2;
  padding: 0;
  background:
    linear-gradient(rgba(4, 7, 12, 0.54), rgba(4, 7, 12, 0.72)),
    var(--table-grid) center / cover,
    rgba(4, 7, 12, 0.72);
}

.page-home-normal .fullbody-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  object-position: center;
}

.page-home-normal .fullbody-image.character-image-frozen {
  height: 100%;
}

.home-character-panel .home-actions {
  margin-top: 0;
}

.home-character-status-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(210px, 0.65fr);
  gap: 16px;
  align-items: start;
}

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

.home-character-tags {
  grid-column: 1 / -1;
}

.home-system-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.home-equipment-panel .profile-equipment-grid {
  margin-top: 0;
}

.home-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid rgba(38, 50, 68, 0.9);
  border-left: 1px solid rgba(38, 50, 68, 0.9);
}

.home-status-stat {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-right: 1px solid rgba(38, 50, 68, 0.9);
  border-bottom: 1px solid rgba(38, 50, 68, 0.9);
  background: rgba(8, 10, 15, 0.52);
}

.home-status-stat .label {
  flex: 0 1 auto;
  font-size: 12px;
}

.home-status-stat .value {
  flex: 0 0 auto;
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
}

.home-meal-panel .item,
.home-summary-panel .item,
.home-profile-panel .item {
  background: rgba(8, 10, 15, 0.72);
}

.page-home-normal .character-public-icons,
.page-character-detail .character-public-icons {
  margin: 0;
  padding: 20px;
  border: 1px solid rgba(0, 229, 255, 0.26);
  border-radius: 8px;
  background: rgba(18, 23, 34, 0.86);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
}

.page-home-normal .character-public-icon-grid,
.page-character-detail .character-public-icon-grid {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

.home-profile-reading {
  position: relative;
}

.home-summary-panel,
.home-profile-panel {
  border-color: rgba(0, 229, 255, 0.3);
}

.home-summary-panel .summary {
  font-size: 16px;
  line-height: 1.75;
}

.home-profile-panel .profile-box {
  min-height: 120px;
  font-size: 16px;
  line-height: 1.8;
}

/* Character detail dashboard */
.page-character-detail .page {
  width: min(1280px, 100%);
}

.character-detail-overview {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.character-detail-dashboard {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.character-detail-character-status-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(210px, 0.65fr);
  gap: 16px;
  align-items: start;
}

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

.character-detail-tags {
  grid-column: 1 / -1;
}

.page-character-detail .fullbody-frame {
  width: 100%;
}

.page-character-detail .fullbody-image-wrap {
  width: 100%;
  min-height: 0;
  aspect-ratio: 1 / 2;
  padding: 0;
  background:
    linear-gradient(rgba(4, 7, 12, 0.54), rgba(4, 7, 12, 0.72)),
    var(--table-grid) center / cover,
    rgba(4, 7, 12, 0.72);
}

.page-character-detail .fullbody-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  object-position: center;
}

.page-character-detail .fullbody-image.character-image-frozen {
  height: 100%;
}

.character-detail-profile-reading {
  margin-top: 20px;
}

@media (max-width: 1180px) {
  .home-command-grid {
    grid-template-columns: 1fr;
  }

  .home-overview-grid {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  }

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

@media (max-width: 900px) {
  .page-home-normal .main-column::before {
    width: 62vw;
    opacity: 0.48;
  }

  .home-overview-grid {
    grid-template-columns: 1fr;
  }

  .home-character-status-grid,
  .character-detail-character-status-grid,
  .character-detail-overview {
    grid-template-columns: 1fr;
  }

  .page-home-normal .fullbody-frame {
    position: relative;
    top: auto;
    width: min(400px, 100%);
    margin: 0 auto;
  }

  .page-character-detail .fullbody-frame {
    position: relative;
    top: auto;
    width: min(400px, 100%);
    margin: 0 auto;
  }
}

@media (max-width: 620px) {
  .page-home-normal .main-column::before {
    display: none;
  }

  .home-character-grid,
  .home-status-grid,
  .character-detail-character-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-command-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .normal-home-dashboard .panel,
  .page-home-normal .character-public-icons,
  .page-character-detail .character-public-icons {
    padding: 16px;
  }

  .normal-home-dashboard .home-hero p {
    display: none;
  }
}

/* Communication workspace */
.page-communication-log .page {
  width: min(1470px, 100%);
}

.page-communication-log .main-column {
  position: relative;
  isolation: isolate;
}

.page-communication-log .main-column::before {
  content: '';
  position: fixed;
  inset: 70px 0 0 auto;
  z-index: -1;
  width: min(44vw, 700px);
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(5, 9, 16, 0.48) 48%, rgba(5, 9, 16, 0.78)),
    radial-gradient(circle at 70% 28%, rgba(255, 42, 109, 0.1), transparent 36%),
    var(--table-grid) center / cover;
  opacity: 0.32;
  mask-image: linear-gradient(90deg, transparent, #000 34%);
}

.chat-page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  min-height: 88px;
  margin-bottom: 18px;
  padding: 18px 22px;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 8px;
  background: linear-gradient(110deg, rgba(0, 229, 255, 0.08), rgba(8, 10, 15, 0.76) 44%, rgba(255, 42, 109, 0.08));
}

.chat-page-head h1 {
  margin: 2px 0 0;
}

.chat-page-kicker,
.chat-compose-kicker,
.chat-log-kicker {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.chat-workspace {
  display: grid;
  grid-template-columns: minmax(165px, 220px) minmax(380px, 1fr) minmax(270px, 340px);
  grid-template-rows: auto auto auto;
  gap: 16px;
  align-items: start;
}

.chat-workspace > .chat-room-select-form,
.chat-workspace > .chat-room-head,
.chat-workspace > .chat-feed-nav,
.chat-workspace > .chat-search-panel,
.chat-workspace > .chat-log-panel,
.chat-workspace > .chat-post-panel,
.chat-workspace > .chat-access-panel {
  min-width: 0;
  margin: 0;
}

.chat-navigation-column {
  display: grid;
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  gap: 16px;
  height: auto;
  min-height: 0;
  min-width: 0;
  position: sticky;
  top: 86px;
}

.chat-log-column {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  gap: 16px;
  min-width: 0;
}

.chat-log-column > .chat-room-head,
.chat-log-column > .chat-access-panel,
.chat-log-column > .chat-log-panel,
.chat-log-column > .chat-room-locked,
.chat-log-column > .cafe-obsidian-game-entry {
  min-width: 0;
  margin: 0;
}

.chat-log-column > .chat-room-head {
  padding: 17px 20px;
}

.r18-peeping-window {
  position: relative;
  padding: 13px 16px;
  border-color: rgba(255, 117, 163, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 42, 109, 0.12), transparent 60%),
    rgba(8, 10, 15, 0.84);
}

.r18-peeping-window__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.r18-peeping-window__heading small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.r18-peeping-window__viewport {
  position: relative;
  display: grid;
  gap: 4px;
  max-height: 10.6em;
  overflow: hidden;
  color: #f4dce7;
  font-size: 13px;
  line-height: 1.55;
}

.r18-peeping-window__viewport::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1.9em;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(8, 10, 15, 0.96));
  content: '';
}

.r18-peeping-window__entry {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  min-height: 40px;
}

.r18-peeping-window__entry.no-chat-icon {
  grid-template-columns: minmax(0, 1fr);
}

.r18-peeping-window__icon {
  width: 40px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 117, 163, 0.36);
  border-radius: 5px;
}

.r18-peeping-window__icon .character-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.r18-peeping-window__content {
  min-width: 0;
}

.r18-peeping-window__author {
  display: block;
  color: #ff9ebd;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.r18-peeping-window__body {
  display: -webkit-box;
  min-width: 0;
  overflow-wrap: anywhere;
  overflow: hidden;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.r18-peeping-window__empty {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.cafe-obsidian-game-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-color: rgba(201, 126, 255, 0.46);
  background:
    linear-gradient(120deg, rgba(142, 62, 190, 0.16), transparent 56%),
    rgba(8, 10, 15, 0.78);
}

.cafe-obsidian-game-entry > div {
  display: grid;
  gap: 2px;
}

.cafe-obsidian-game-entry strong {
  font-size: 17px;
}

.cafe-obsidian-game-entry small {
  color: var(--muted);
}

.cafe-obsidian-game-entry .is-disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

@media (max-width: 620px) {
  .cafe-obsidian-game-entry {
    align-items: stretch;
    flex-direction: column;
  }

  .cafe-obsidian-game-entry .button {
    width: 100%;
    text-align: center;
  }
}

.chat-log-column > .chat-log-panel {
  padding: 14px;
  background: rgba(8, 10, 15, 0.66);
}

.chat-navigation-column > .chat-room-select-form,
.chat-navigation-column > .chat-feed-nav,
.chat-navigation-column > .chat-search-panel {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.chat-navigation-column > .chat-room-select-form {
  padding: 16px;
  border: 1px solid rgba(0, 229, 255, 0.26);
  border-radius: 8px;
  background: rgba(8, 10, 15, 0.76);
}

.chat-navigation-column > .chat-feed-nav,
.chat-navigation-column > .chat-search-panel {
  padding: 16px;
}

.chat-workspace > .chat-room-select-form {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  padding: 16px;
  border: 1px solid rgba(0, 229, 255, 0.26);
  border-radius: 8px;
  background: rgba(8, 10, 15, 0.76);
}

.chat-room-select-row {
  grid-template-columns: minmax(0, 1fr);
}

.chat-room-select-button {
  display: none;
}

.chat-workspace > .chat-room-head {
  grid-column: 2;
  grid-row: 1;
  min-height: 100%;
  padding: 17px 20px;
}

.chat-room-head h2 {
  margin-bottom: 6px;
}

.chat-workspace > .chat-feed-nav {
  grid-column: 1;
  grid-row: 2;
  padding: 16px;
}

.chat-feed-nav h2,
.chat-search-panel h2 {
  margin-bottom: 12px;
  font-size: 16px;
}

.chat-feed-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.chat-feed-buttons .button {
  width: 100%;
  min-height: 42px;
  text-align: left;
}

.chat-feed-current {
  display: block;
  padding-top: 4px;
}

.chat-feed-help {
  margin-bottom: 0;
  line-height: 1.55;
}

.chat-workspace > .chat-search-panel {
  grid-column: 1;
  grid-row: 3;
  padding: 16px;
}

.chat-search-form {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.chat-search-form .button {
  width: 100%;
}

.chat-search-name-option {
  white-space: normal;
}

.chat-workspace > .chat-access-panel {
  grid-column: 2;
  grid-row: 2;
}

.chat-workspace > .chat-log-panel {
  grid-column: 2;
  grid-row: 2 / 4;
  padding: 14px;
  background: rgba(8, 10, 15, 0.66);
}

.chat-workspace:has(> .chat-access-panel) > .chat-log-panel {
  grid-row: 3;
}

.chat-log-heading,
.chat-compose-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-log-heading {
  margin-bottom: 14px;
  padding: 2px 4px 12px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.18);
}

.chat-log-heading h2,
.chat-compose-heading h2 {
  margin: 2px 0 0;
}

.chat-log-count {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid rgba(0, 229, 255, 0.26);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chat-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: none;
  grid-auto-flow: row;
  gap: 12px;
  margin: 0;
}

.chat-message.admin-character-message,
.theme-r18 .chat-message.admin-character-message {
  border-color: rgba(255, 152, 46, 0.92);
  background:
    linear-gradient(105deg, rgba(255, 152, 46, 0.18), transparent 58%),
    rgba(30, 18, 6, 0.88);
}

.explore-chat-message.is-admin,
.casino-lounge-message.is-admin {
  border-color: rgba(255, 152, 46, 0.92);
  background: linear-gradient(105deg, rgba(255, 152, 46, 0.18), transparent 58%), rgba(30, 18, 6, 0.88);
}

.chat-message {
  padding: 14px;
  border-color: rgba(45, 61, 82, 0.92);
  background:
    linear-gradient(100deg, rgba(0, 229, 255, 0.035), transparent 42%),
    rgba(8, 10, 15, 0.78);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.chat-message:hover {
  border-color: rgba(0, 229, 255, 0.32);
}

.chat-message-layout {
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
}

.chat-icon-frame {
  width: 72px;
  border-color: rgba(0, 229, 255, 0.38);
}

.chat-message-head {
  font-size: 12px;
}

.chat-message-head strong {
  font-size: 16px;
}

.chat-body {
  margin: 9px 0 10px;
  font-size: 16px;
  line-height: 1.72;
}

.page-communication-log .chat-body {
  line-height: 1.36;
}

.chat-message.system-log {
  border-color: rgba(252, 238, 9, 0.48);
  background:
    linear-gradient(105deg, rgba(252, 238, 9, 0.1), transparent 55%),
    rgba(12, 12, 8, 0.82);
}

.chat-message.admin-notice {
  border-color: rgba(255, 59, 48, 0.62);
  background:
    linear-gradient(105deg, rgba(255, 59, 48, 0.1), transparent 55%),
    rgba(15, 8, 9, 0.82);
}

.chat-workspace > .chat-post-panel {
  grid-column: 3;
  grid-row: 1;
  position: sticky;
  top: 86px;
  width: 100%;
  max-height: calc(100vh - 104px);
  margin: 0;
  padding: 16px;
  overflow-y: auto;
  background:
    linear-gradient(145deg, rgba(255, 42, 109, 0.07), transparent 42%),
    rgba(8, 10, 15, 0.92);
}

.chat-compose-close {
  display: none;
}

.chat-compose-details {
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 7px;
  background: rgba(8, 10, 15, 0.5);
}

.chat-icon-quick-select {
  padding: 11px 12px;
  border: 1px solid rgba(0, 229, 255, 0.32);
  border-radius: 7px;
  background: linear-gradient(100deg, rgba(0, 229, 255, 0.08), rgba(8, 10, 15, 0.58));
}

.chat-icon-quick-select label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-weight: 800;
}

.chat-icon-quick-select label::before {
  content: 'すぐに切替';
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.theme-r18 .chat-icon-quick-select {
  border-color: rgba(255, 42, 109, 0.38);
  background: linear-gradient(100deg, rgba(255, 42, 109, 0.09), rgba(14, 7, 15, 0.62));
}

.theme-r18 .chat-icon-quick-select label::before {
  color: #ff75a3;
}

.chat-compose-details > summary {
  padding: 10px 12px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.chat-compose-details[open] > summary {
  border-bottom: 1px solid rgba(0, 229, 255, 0.16);
}

.chat-compose-details-body {
  display: grid;
  gap: 11px;
  padding: 12px;
}

.chat-post-panel .chat-identity-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 11px;
}

.chat-post-panel .chat-markup-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-post-panel .chat-markup-button {
  width: auto;
  min-width: 0;
  padding: 6px 8px;
  font-size: 12px;
}

.chat-post-panel .chat-form textarea {
  min-height: 160px;
}

.chat-post-panel .chat-compose-row {
  grid-template-columns: 54px minmax(0, 1fr);
}

.chat-post-panel .chat-compose-icon-frame {
  width: 54px;
}

.chat-mobile-compose-bar,
.chat-compose-overlay {
  display: none;
}

.theme-r18 .chat-page-head {
  border-color: rgba(255, 42, 109, 0.42);
  background: linear-gradient(110deg, rgba(255, 42, 109, 0.12), rgba(14, 7, 15, 0.82) 48%, rgba(131, 56, 236, 0.1));
}

.theme-r18 .chat-page-kicker,
.theme-r18 .chat-compose-kicker,
.theme-r18 .chat-log-kicker {
  color: #ff75a3;
}

@media (max-width: 1180px) {
  .chat-workspace {
    grid-template-columns: minmax(190px, 220px) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
  }

  .chat-workspace > .chat-post-panel {
    grid-column: 2;
    grid-row: 2;
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .page-communication-log .content-wrap {
    padding-bottom: 90px;
  }

  .page-communication-log .main-column::before {
    display: none;
  }

  .chat-page-head {
    min-height: 0;
    margin-bottom: 12px;
    padding: 14px 16px;
  }

  .chat-page-head h1 {
    font-size: 28px;
  }

  .chat-workspace {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .chat-navigation-column {
    display: contents;
  }

  .chat-log-column {
    display: contents;
  }

  .chat-workspace > .chat-room-select-form,
  .chat-workspace > .chat-room-head,
  .chat-workspace > .chat-feed-nav,
  .chat-workspace > .chat-search-panel,
  .chat-workspace > .chat-log-panel,
  .chat-workspace > .chat-access-panel {
    width: 100%;
  }

  .chat-navigation-column > .chat-room-select-form,
  .chat-navigation-column > .chat-feed-nav,
  .chat-navigation-column > .chat-search-panel {
    width: 100%;
  }

  .chat-log-column > .chat-room-head,
  .chat-log-column > .chat-access-panel,
  .chat-log-column > .chat-log-panel,
  .chat-log-column > .chat-room-locked {
    width: 100%;
  }

  .chat-workspace > .chat-room-select-form {
    order: 1;
    padding: 13px;
  }

  .chat-navigation-column > .chat-room-select-form {
    order: 1;
    padding: 13px;
  }

  .chat-workspace > .chat-room-head {
    order: 2;
    padding: 14px 16px;
  }

  .chat-log-column > .chat-room-head {
    order: 2;
    padding: 14px 16px;
  }

  .chat-workspace > .chat-access-panel {
    order: 3;
  }

  .chat-log-column > .chat-access-panel,
  .chat-log-column > .chat-room-locked {
    order: 3;
  }

  .chat-workspace > .chat-feed-nav {
    order: 4;
    padding: 12px;
    overflow: hidden;
  }

  .chat-navigation-column > .chat-feed-nav {
    order: 4;
    padding: 12px;
    overflow: hidden;
  }

  .chat-feed-nav h2,
  .chat-feed-help {
    display: none;
  }

  .chat-feed-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .chat-feed-buttons::-webkit-scrollbar {
    display: none;
  }

  .chat-feed-buttons .button {
    flex: 0 0 auto;
    width: auto;
    min-width: 108px;
    text-align: center;
  }

  .chat-feed-current {
    display: none;
  }

  .chat-workspace > .chat-log-panel {
    order: 5;
    padding: 10px;
  }

  .chat-log-column > .chat-log-panel {
    order: 5;
    padding: 10px;
  }

  .chat-workspace > .chat-search-panel {
    order: 6;
    padding: 14px;
  }

  .chat-navigation-column > .chat-search-panel {
    order: 6;
    padding: 14px;
  }

  .chat-log-column > .chat-search-panel {
    order: 6;
    width: 100%;
    padding: 14px;
  }

  .chat-log-heading {
    margin-bottom: 10px;
    padding: 2px 2px 10px;
  }

  .chat-message {
    padding: 12px;
  }

  .r18-peeping-window {
    padding: 11px 13px;
  }

  .r18-peeping-window__heading {
    display: grid;
    gap: 2px;
  }

  .r18-peeping-window__heading small {
    font-size: 10px;
  }

  .r18-peeping-window__viewport {
    max-height: 8.4em;
    font-size: 12px;
    line-height: 1.55;
  }

  .r18-peeping-window__entry {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 7px;
    min-height: 36px;
  }

  .r18-peeping-window__icon {
    width: 36px;
  }

  .r18-peeping-window__author {
    font-size: 10px;
  }

  .chat-message-layout {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 11px;
  }

  .chat-icon-frame {
    width: 58px;
  }

  .chat-message-head {
    gap: 3px 7px;
  }

  .chat-message-head strong {
    font-size: 15px;
  }

  .chat-body {
    font-size: 16px;
    line-height: 1.68;
  }

  .chat-message-stamp {
    width: 100%;
    margin-left: 0;
    text-align: left;
  }

  .chat-workspace > .chat-post-panel {
    display: block;
    position: fixed;
    inset: auto 0 0;
    z-index: 1002;
    width: 100%;
    max-height: min(86vh, 760px);
    padding: 16px;
    border-radius: 14px 14px 0 0;
    overflow-y: auto;
    transform: translateY(105%);
    transition: transform 180ms ease;
  }

  .chat-compose-open .chat-workspace > .chat-post-panel {
    transform: translateY(0);
  }

  .chat-compose-close {
    display: inline-flex;
    width: auto;
    min-width: 72px;
  }

  .chat-compose-overlay {
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.66);
    backdrop-filter: blur(3px);
  }

  .chat-compose-overlay:not([hidden]) {
    display: block;
  }

  .chat-mobile-compose-bar {
    display: flex;
    position: fixed;
    inset: auto 0 0;
    z-index: 1000;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 70px;
    padding: 10px max(14px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    border-top: 1px solid rgba(0, 229, 255, 0.42);
    background: rgba(5, 8, 13, 0.96);
    box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.38);
  }

  .chat-mobile-compose-bar span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .chat-mobile-compose-bar .button {
    flex: 0 0 auto;
    width: auto;
    min-width: 126px;
  }

  .chat-compose-open {
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  .chat-message-layout {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .chat-icon-frame {
    width: 52px;
  }

  .chat-mobile-compose-bar span {
    display: none;
  }

  .chat-mobile-compose-bar .button {
    width: 100%;
  }
}

/* Item information hierarchy refresh */
.page-storage .storage-toolbar {
  margin-bottom: 14px;
}

.page-storage .storage-capacity {
  display: grid;
  gap: 7px;
  width: min(360px, 100%);
  padding: 10px 14px;
}

.storage-capacity-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.storage-capacity-summary strong {
  margin-left: 0;
}

.storage-capacity-summary small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 11px;
}

.storage-capacity-meter {
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(70, 91, 118, 0.5);
}

.storage-capacity-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.storage-capacity.is-warning {
  border-color: rgba(252, 238, 9, 0.5);
  box-shadow: inset 3px 0 0 rgba(252, 238, 9, 0.82);
}

.storage-capacity.is-warning .storage-capacity-meter i {
  background: var(--yellow);
}

.storage-capacity.is-full {
  border-color: rgba(255, 82, 112, 0.58);
  box-shadow: inset 3px 0 0 rgba(255, 82, 112, 0.88);
}

.storage-capacity.is-full .storage-capacity-meter i {
  background: #ff5270;
}

.storage-run-notice {
  border-left-color: var(--yellow);
}

.page-storage .item-list-controls {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px) minmax(150px, 190px);
}

.item-filter-button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  min-height: 19px;
  margin-left: 3px;
  border-radius: 999px;
  padding: 1px 5px;
  background: rgba(70, 91, 118, 0.42);
  color: var(--text);
  font-size: 10px;
}

.item-sort-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.item-sort-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 6px;
  padding: 8px 30px 8px 11px;
  background: rgba(5, 9, 15, 0.9);
  color: var(--text);
}

.item-kind-badge,
.item-timing-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid rgba(70, 91, 118, 0.68);
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(18, 24, 35, 0.92);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.item-timing-badge {
  margin-top: 7px;
  border-color: rgba(188, 137, 255, 0.48);
  background: rgba(146, 88, 220, 0.14);
  color: #d7b4ff;
}

.item-effect-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.item-effect-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(0, 229, 255, 0.46);
  border-radius: 6px;
  padding: 4px 8px;
  background: rgba(0, 229, 255, 0.11);
  color: #c9f9ff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
}

.item-effect-chip.is-positive {
  border-color: rgba(80, 232, 164, 0.5);
  background: rgba(50, 204, 139, 0.12);
  color: #aaf4d0;
}

.item-effect-chip.is-negative {
  border-color: rgba(255, 82, 112, 0.52);
  background: rgba(255, 82, 112, 0.12);
  color: #ffb5c2;
}

.item-effect-empty {
  color: var(--muted);
  font-size: 12px;
}

.page-storage .storage-table {
  min-width: 880px;
  table-layout: fixed;
}

.page-storage .storage-item-column {
  width: 36%;
}

.page-storage .storage-effect-column {
  width: 27%;
}

.page-storage .storage-stock-column {
  width: 17%;
}

.storage-item-info,
.storage-effect {
  vertical-align: top !important;
}

.storage-item-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.storage-item-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.storage-item-badges .item-content-mode-badge {
  margin-left: 0;
}

.storage-sponsor {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.page-storage .storage-description {
  min-width: 0;
  max-width: none;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.storage-stock {
  vertical-align: top !important;
}

.storage-stock strong,
.storage-stock span {
  display: block;
}

.storage-stock strong {
  font-size: 17px;
}

.storage-stock span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.storage-quantity-mobile {
  display: none;
  color: var(--text);
  font-weight: 900;
  white-space: nowrap;
}

.sponsor-legend-details {
  margin-top: 14px;
  border: 1px solid rgba(70, 91, 118, 0.5);
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 12px;
}

.sponsor-legend-details summary {
  cursor: pointer;
  font-weight: 800;
}

.sponsor-legend-details p {
  margin: 8px 0 0;
}

@media (max-width: 900px) and (min-width: 761px) {
  .page-storage .item-list-controls {
    grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
  }

  .page-storage .item-sort-field {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  .page-storage .storage-toolbar {
    margin-bottom: 12px;
  }

  .page-storage .item-list-panel {
    padding: 14px;
  }

  .page-storage .item-list-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(118px, 0.42fr);
    gap: 10px;
    padding: 10px;
  }

  .page-storage .item-category-filters {
    grid-column: 1 / -1;
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .page-storage .item-filter-button {
    flex: 0 0 auto;
    min-height: 40px;
  }

  .page-storage .item-search-field,
  .page-storage .item-sort-field {
    min-width: 0;
  }

  .page-storage .storage-table tbody {
    gap: 12px;
  }

  .page-storage .storage-table tr {
    display: grid;
    grid-template-columns: 1fr;
  }

  .page-storage .storage-table td {
    display: block;
    padding: 10px 12px;
    border-bottom: 0;
  }

  .page-storage .storage-table td::before {
    display: none;
  }

  .page-storage .storage-item-info {
    padding-bottom: 9px;
  }

  .storage-quantity-mobile {
    display: inline;
  }

  .page-storage .storage-description {
    margin-top: 8px;
    font-size: 12px;
  }

  .page-storage .storage-effect {
    margin: 0 11px;
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 7px;
    padding: 10px;
    background: rgba(0, 229, 255, 0.045);
  }

  .page-storage .storage-stock {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 32px;
    padding-block: 6px;
  }

  .page-storage .storage-stock strong {
    display: none;
  }

  .page-storage .storage-stock span {
    margin-top: 0;
  }

  .page-storage .storage-action {
    width: 100%;
    min-width: 0;
    padding-top: 6px;
  }

  .page-storage .storage-action .button,
  .page-storage .storage-action form:not(.storage-carry-form) {
    width: 100%;
  }

  .page-storage .storage-carry-form {
    grid-template-columns: minmax(72px, 0.32fr) minmax(0, 1fr);
  }

  .page-storage .storage-action .button,
  .page-storage .storage-carry-form input {
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .page-storage .item-list-controls {
    grid-template-columns: 1fr;
  }

  .page-storage .item-category-filters {
    grid-column: 1;
  }
}

/* Casino hub visual system */
body.page-casino {
  background:
    linear-gradient(180deg, rgba(7, 8, 22, 0.68) 0%, rgba(10, 8, 28, 0.5) 44%, rgba(4, 8, 18, 0.8) 100%),
    radial-gradient(circle at 68% 8%, rgba(255, 42, 109, 0.18), transparent 28%),
    radial-gradient(circle at 12% 34%, rgba(0, 229, 255, 0.12), transparent 32%),
    url("assets/background/casino.png") center top / cover fixed no-repeat,
    linear-gradient(180deg, #080a0f 0%, #100d18 56%, #080a0f 100%);
  background-color: #080a0f;
}

body.page-casino .content-wrap {
  position: relative;
  isolation: isolate;
}

body.page-casino .content-wrap::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(115deg, transparent 0 62%, rgba(255, 42, 109, 0.06) 62% 63%, transparent 63%),
    var(--table-grid) right top / 520px auto no-repeat;
  opacity: 0.24;
  pointer-events: none;
}

body.page-casino .page {
  width: min(1420px, 100%);
}

.page-casino .casino-main-column > h1 {
  margin-bottom: 18px;
  text-shadow: 0 0 20px rgba(255, 42, 109, 0.2);
}

.page-casino .casino-status-grid {
  gap: 8px;
  margin-bottom: 14px;
}

.page-casino .casino-status-grid .item {
  min-height: 0;
  padding: 12px 14px;
  border-color: rgba(255, 42, 109, 0.2);
  background: linear-gradient(145deg, rgba(255, 42, 109, 0.1), rgba(8, 10, 15, 0.48));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.page-casino .casino-status-grid .value {
  font-size: 20px;
}

.page-casino .casino-games-panel,
.page-casino .casino-alcohol-panel,
.page-casino .casino-main-column > .panel,
.page-casino .casino-finance-grid > .panel {
  margin-bottom: 14px;
  border-color: rgba(0, 229, 255, 0.3);
  background:
    linear-gradient(135deg, rgba(255, 42, 109, 0.1), transparent 48%),
    linear-gradient(180deg, rgba(11, 18, 35, 0.72), rgba(6, 11, 24, 0.6)),
    rgba(8, 13, 25, 0.56);
  backdrop-filter: blur(5px) saturate(118%);
  -webkit-backdrop-filter: blur(5px) saturate(118%);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.26), inset 0 0 28px rgba(0, 229, 255, 0.035);
}

.page-casino .casino-finance-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.78fr) minmax(0, 1.42fr);
  gap: 14px;
  margin-bottom: 14px;
}

.page-casino .casino-finance-grid > .panel {
  margin-bottom: 0;
}

.page-casino .casino-games-panel {
  border-color: rgba(255, 42, 109, 0.34);
  background:
    linear-gradient(135deg, rgba(255, 42, 109, 0.12), transparent 46%),
    linear-gradient(180deg, rgba(14, 18, 39, 0.7), rgba(7, 11, 25, 0.58)),
    rgba(8, 13, 25, 0.56);
}

.page-casino .casino-games-advisor-layout {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 14px;
}

.page-casino .casino-advisor {
  min-height: 300px;
}

.page-casino .casino-game-list {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 9px;
}

.page-casino .casino-game-list > .button,
.page-casino .casino-game-list > .casino-advisor-form {
  min-height: 54px;
}

.page-casino .casino-game-list > .button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.page-casino .casino-exchange-form {
  grid-template-columns: minmax(150px, 240px) minmax(100px, 140px);
  max-width: 420px;
}

.page-casino .casino-exchange-panel,
.page-casino .casino-debt-exchange-panel {
  padding: 16px;
}

.page-casino .casino-debt-exchange-grid {
  gap: 8px;
}

.page-casino .casino-debt-exchange-form {
  padding: 11px;
}

.page-casino .casino-trade-table {
  min-width: 680px;
}

.page-casino-game .casino-main-column > .page-head {
  margin-bottom: 14px;
}

.page-casino-game .casino-status-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
  body.page-casino .content-wrap {
    padding: 20px;
  }

  .page-casino .casino-games-advisor-layout {
    grid-template-columns: 1fr;
  }

  .page-casino-game .casino-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  body.page-casino .content-wrap {
    padding: 14px;
  }

  .page-casino .casino-status-grid,
  .page-casino .casino-exchange-form,
  .page-casino .casino-debt-exchange-grid,
  .page-casino .casino-game-list,
  .page-casino-game .casino-status-grid {
    grid-template-columns: 1fr;
  }

  .page-casino .casino-finance-grid {
    grid-template-columns: 1fr;
  }

  .page-casino .casino-status-grid .item {
    padding: 10px 12px;
  }

  .page-casino .casino-status-grid .value {
    font-size: 18px;
  }
}

/* Unified item management and commerce pages */
body.page-item-management,
body.page-item-commerce {
  background:
    radial-gradient(circle at 82% 12%, rgba(0, 229, 255, 0.11), transparent 32%),
    radial-gradient(circle at 18% 82%, rgba(255, 42, 109, 0.08), transparent 30%),
    var(--bg);
}

.page-item-management .page,
.page-item-commerce .page {
  width: min(1180px, 100%);
}

.item-management-navigation,
.shop-page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.shop-page-heading h1 {
  margin-bottom: 0;
  flex-shrink: 0;
  white-space: nowrap;
}

.item-management-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(145px, 220px));
  gap: 8px;
}

.item-management-tab {
  padding: 11px 18px;
  border: 1px solid rgba(70, 91, 118, 0.8);
  border-radius: 7px;
  background: rgba(17, 23, 34, 0.9);
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-weight: 800;
}

.item-management-tab:hover,
.item-management-tab:focus-visible {
  border-color: rgba(0, 229, 255, 0.7);
  color: var(--text);
}

.item-management-tab.is-active {
  border-color: rgba(0, 229, 255, 0.78);
  background: linear-gradient(105deg, rgba(0, 229, 255, 0.2), rgba(28, 38, 54, 0.94));
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--cyan), 0 0 18px rgba(0, 229, 255, 0.1);
}

.item-management-shop-link {
  width: auto;
  white-space: nowrap;
}

.item-content-mode-navigation {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -6px 0 18px;
  padding: 10px 12px;
  border: 1px solid rgba(70, 91, 118, 0.52);
  border-radius: 8px;
  background: rgba(8, 13, 21, 0.82);
}

.item-content-mode-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.item-content-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(74px, 110px));
  gap: 6px;
}

.item-content-mode-tab {
  padding: 7px 12px;
  border: 1px solid rgba(70, 91, 118, 0.72);
  border-radius: 6px;
  background: rgba(17, 23, 34, 0.9);
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.item-content-mode-tab:hover,
.item-content-mode-tab:focus-visible {
  border-color: rgba(0, 229, 255, 0.7);
  color: var(--text);
}

.item-content-mode-tab.is-active {
  border-color: rgba(0, 229, 255, 0.76);
  background: rgba(0, 229, 255, 0.16);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--cyan);
}

.item-content-mode-tab[href*="item_mode=r18"].is-active {
  border-color: rgba(255, 42, 109, 0.74);
  background: rgba(255, 42, 109, 0.15);
  box-shadow: inset 0 -2px 0 var(--pink);
}

.item-content-mode-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid rgba(0, 229, 255, 0.48);
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.12);
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
  white-space: nowrap;
}

.item-content-mode-badge.is-r18 {
  border-color: rgba(255, 42, 109, 0.5);
  background: rgba(255, 42, 109, 0.13);
  color: #ff8bb8;
}

.item-content-mode-badge.is-both {
  border-color: rgba(188, 137, 255, 0.54);
  background: rgba(146, 88, 220, 0.16);
  color: #d7b4ff;
}

.storage-capacity,
.shop-balance-strip {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid rgba(0, 229, 255, 0.34);
  border-radius: 7px;
  background: rgba(9, 14, 22, 0.88);
  box-shadow: inset 3px 0 0 rgba(0, 229, 255, 0.72);
}

.storage-capacity span,
.shop-balance-strip span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.storage-capacity strong,
.shop-balance-strip strong {
  margin-left: auto;
  color: var(--text);
  font-size: 19px;
}

.shop-balance-strip {
  margin-bottom: 14px;
}

.item-list-panel,
.shop-items-panel {
  border-color: rgba(0, 229, 255, 0.23);
  background:
    linear-gradient(rgba(9, 13, 20, 0.94), rgba(9, 13, 20, 0.96)),
    var(--table-grid) center / cover;
}

.item-list-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 300px);
  gap: 14px;
  align-items: end;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid rgba(70, 91, 118, 0.45);
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.78);
}

.item-category-filters {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.item-filter-button {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid rgba(70, 91, 118, 0.72);
  border-radius: 999px;
  background: rgba(18, 24, 35, 0.92);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.item-filter-button:hover,
.item-filter-button:focus-visible,
.item-filter-button.is-active {
  border-color: rgba(0, 229, 255, 0.7);
  color: var(--text);
}

.item-filter-button.is-active {
  background: rgba(0, 229, 255, 0.17);
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.14);
}

.item-search-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.item-search-field input {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 6px;
  background: rgba(5, 9, 15, 0.9);
  color: var(--text);
}

.item-filter-empty {
  padding: 18px;
  border: 1px dashed rgba(70, 91, 118, 0.7);
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
}

.item-filter-empty[hidden],
[data-item-row][hidden] {
  display: none !important;
}

.page-storage .storage-table {
  min-width: 820px;
}

.page-storage .storage-table th,
.page-storage .storage-table td {
  padding: 10px;
}

.equipment-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 14px;
  margin-bottom: 18px;
}

.equipment-overview-grid > .panel {
  min-width: 0;
  margin-bottom: 0;
}

.equipment-current-panel {
  grid-column: 1;
  grid-row: 1;
}

.equipment-status-panel {
  grid-column: 2;
  grid-row: 1;
}

.equipment-overview-grid h2 {
  margin-top: 0;
}

.equipment-current-panel .equipment-slots {
  gap: 9px;
}

.equipment-current-panel .equipment-slot {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
}

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

.equipment-status-panel .status-total .item {
  min-width: 0;
  padding: 10px;
}

.equipment-status-panel .status-formula {
  font-size: 15px;
  white-space: nowrap;
}

.page-equipment .loadout-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 190px));
  gap: 8px;
  margin-bottom: 14px;
}

.page-equipment .loadout-tab {
  border: 1px solid rgba(70, 91, 118, 0.72);
  background: rgba(18, 24, 35, 0.9);
  color: var(--muted);
}

.page-equipment .loadout-tab.active {
  border-color: rgba(0, 229, 255, 0.75);
  background: rgba(0, 229, 255, 0.18);
  color: var(--text);
}

.page-equipment .equipment-details-content {
  padding: 14px;
}

.page-equipment .equipment-entry {
  grid-template-columns: minmax(0, 1fr) minmax(130px, 160px);
  gap: 12px;
  padding: 12px;
}

.page-shop .shop-tabs {
  grid-template-columns: repeat(4, minmax(120px, 180px));
  margin-bottom: 14px;
}

.page-shop .shop-category-tabs {
  margin: -4px 0 16px;
  padding-left: 4px;
}

.page-shop .shop-items-panel {
  position: relative;
  overflow: hidden;
}

.page-shop .shop-items-panel::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--cyan);
  content: "";
  opacity: 0.72;
}

.page-shop .shop-mode-sell::before {
  background: var(--pink);
}

.page-shop .shop-table {
  min-width: 720px;
}

.page-shop .shop-item-row:hover td {
  background: rgba(0, 229, 255, 0.055);
}

.page-shop .shop-mode-sell .shop-item-row:hover td {
  background: rgba(255, 42, 109, 0.05);
}

@media (max-width: 900px) {
  .equipment-overview-grid {
    grid-template-columns: 1fr;
  }

  .equipment-current-panel,
  .equipment-status-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .page-shop .shop-tabs {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 760px) {
  .item-management-navigation,
  .shop-page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .item-management-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .item-content-mode-navigation {
    align-items: stretch;
    flex-direction: column;
  }

  .item-content-mode-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .item-management-shop-link,
  .shop-page-heading .button {
    width: 100%;
  }

  .item-list-controls {
    grid-template-columns: 1fr;
  }

  .item-category-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .item-filter-button {
    padding-inline: 8px;
  }

  .storage-capacity,
  .shop-balance-strip {
    width: 100%;
  }

  .page-storage .storage-table-wrap,
  .page-shop .shop-table-wrap {
    overflow: visible;
  }

  .page-storage .storage-table,
  .page-storage .storage-table tbody,
  .page-shop .shop-table,
  .page-shop .shop-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .page-storage .storage-table thead,
  .page-shop .shop-table thead {
    display: none;
  }

  .page-storage .storage-table tbody,
  .page-shop .shop-table tbody {
    display: grid;
    gap: 10px;
  }

  .page-storage .storage-table tr,
  .page-shop .shop-item-row {
    display: block;
    overflow: hidden;
    border: 1px solid rgba(70, 91, 118, 0.58);
    border-radius: 8px;
    background: rgba(9, 14, 22, 0.92);
  }

  .page-storage .storage-table td,
  .page-shop .shop-item-row td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 9px 11px;
    border-bottom: 1px solid rgba(38, 50, 68, 0.7);
    text-align: left;
    white-space: normal;
  }

  .page-storage .storage-table td::before,
  .page-shop .shop-item-row td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 800;
  }

  .page-storage .storage-table td:last-child,
  .page-shop .shop-item-row td:last-child {
    border-bottom: 0;
  }

  .page-storage .storage-action {
    position: static;
    z-index: auto;
    box-shadow: none;
  }

  .page-storage .storage-carry-form,
  .page-shop .shop-operation form {
    grid-template-columns: minmax(64px, 90px) minmax(0, 1fr);
  }

  .page-shop .shop-description-row {
    display: block;
    margin-top: -11px;
    border: 1px solid rgba(70, 91, 118, 0.58);
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: rgba(15, 20, 30, 0.96);
  }

  .page-shop .shop-description-row td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    padding: 10px 11px;
    border: 0;
  }

  .page-shop .shop-description-row td::before {
    color: var(--cyan);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 800;
  }

  .page-shop .shop-description-label {
    display: none;
  }
}

@media (max-width: 480px) {
  .item-management-tabs,
  .page-shop .shop-tabs,
  .item-category-filters,
  .equipment-status-panel .status-total {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-equipment .loadout-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-equipment .equipment-current-panel .equipment-slot,
  .page-equipment .equipment-entry {
    grid-template-columns: 1fr;
  }
}

/* Final responsive overrides for refreshed item surfaces. */
.page-storage .storage-table {
  min-width: 880px;
}

.shop-item-badges,
.shop-mobile-description {
  display: none;
}

.page-shop .shop-effect .item-effect-chips,
.equipment-effects,
.carried-item-effects,
.consumable-entry .effect-text {
  margin-top: 8px;
}

.page-equipment .equipment-effects {
  color: inherit;
}

@media (max-width: 760px) {
  .page-storage .storage-table {
    min-width: 0;
  }

  .page-storage .item-category-filters {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .page-storage .item-category-filters::-webkit-scrollbar {
    display: none;
  }

  .page-storage .item-filter-button {
    flex: 0 0 auto;
  }

  .page-storage .storage-table tr {
    display: grid;
    grid-template-columns: 1fr;
  }

  .page-storage .storage-table td {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border-bottom: 0;
  }

  .page-storage .storage-table td::before {
    display: none;
  }

  .page-storage .storage-item-info {
    padding-bottom: 9px;
  }

  .page-storage .storage-effect {
    display: block;
    width: auto;
    margin: 0 11px;
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 7px;
    padding: 10px;
    background: rgba(0, 229, 255, 0.045);
  }

  .page-storage .storage-stock {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 32px;
    padding-block: 6px;
  }

  .page-storage .storage-action {
    display: block;
    width: 100%;
    min-width: 0;
    padding-top: 6px;
  }

  .page-shop .shop-item-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 7px;
  }

  .page-shop .shop-mobile-description {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
  }

  .page-shop .shop-item-row .shop-type,
  .page-shop .shop-item-row .shop-slot,
  .page-shop .shop-description-row {
    display: none;
  }

  .page-shop .shop-item-row .shop-name,
  .page-shop .shop-item-row .shop-effect,
  .page-shop .shop-item-row .shop-operation {
    display: block;
    padding: 10px 12px;
  }

  .page-shop .shop-item-row .shop-name::before,
  .page-shop .shop-item-row .shop-effect::before,
  .page-shop .shop-item-row .shop-operation::before {
    display: none;
  }

  .page-shop .shop-item-row .shop-effect {
    margin: 0 11px;
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 7px;
    background: rgba(0, 229, 255, 0.045);
  }

  .page-shop .shop-operation form,
  .page-shop .shop-operation .button {
    width: 100%;
  }

  .page-shop .shop-operation input,
  .page-shop .shop-operation .button,
  .page-equipment .equipment-entry .button,
  .consumable-entry .button {
    min-height: 44px;
  }

  .page-equipment .equipment-entry,
  .consumable-entry {
    gap: 10px;
  }

  .page-equipment .equipment-entry form,
  .page-equipment .equipment-entry .button,
  .consumable-entry form,
  .consumable-entry .button {
    width: 100%;
  }
}
