:root {
  color-scheme: dark;
  --bg: #0b0f0d;
  --line: #35423b;
  --text: #f4f1e8;
  --muted: #9da9a2;
  --gold: #e0b862;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
  --tile: clamp(18px, min(31px, calc((100vw - 48px) / 13), calc((100svh - 360px) / 13)), 31px);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(181, 139, 65, 0.13), transparent 38%),
    linear-gradient(180deg, #121815 0%, var(--bg) 100%);
  color: var(--text);
  overflow: hidden;
}

body {
  display: flex;
  justify-content: center;
  touch-action: manipulation;
}

button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #26312c, #1b231f);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.12s ease, border-color 0.12s ease, filter 0.12s ease, background 0.12s ease;
}

button:disabled {
  opacity: 0.45;
}

button:active:not(:disabled) {
  transform: translateY(1px);
  filter: brightness(1.12);
}

.app-shell {
  width: min(100vw, 520px);
  height: 100svh;
  padding: max(6px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) clamp(140px, 20svh, 190px);
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.app-shell.arena-mode {
  grid-template-rows: auto auto auto minmax(0, 1fr) clamp(104px, 17svh, 144px);
  background:
    radial-gradient(circle at 50% 24%, rgba(151, 57, 45, 0.2), transparent 48%),
    linear-gradient(180deg, rgba(25, 18, 15, 0.96), rgba(10, 9, 8, 0.99));
}

.app-shell.dungeon-mode {
  /* 高さ予算: 上部ログ105px + ヘッダー約90px + 操作パッド156px + 余白約40px。
     328px では中背丈端末(667px級)でパッド下段がログに重なった。 */
  --tile: clamp(15px, min(32px, calc((100vw - 42px) / 13), calc((100svh - 390px) / 13)), 32px);
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: clamp(105px, 15svh, 132px) minmax(0, 1fr);
  background:
    radial-gradient(circle at 50% 26%, rgba(74, 101, 84, 0.2), transparent 48%),
    linear-gradient(180deg, rgba(15, 22, 18, 0.94), rgba(8, 12, 10, 0.98));
}

.app-shell.dungeon-mode .status-bar {
  display: none;
}

.app-shell.dungeon-mode .status-hp {
  display: none;
}

.app-shell.dungeon-mode > .character-strip {
  display: none;
}

.app-shell.dungeon-mode #dungeonView {
  grid-column: 1;
  grid-row: 2;
  padding-bottom: 7px;
  scroll-padding-bottom: 7px;
  overflow: hidden;
}

.app-shell.dungeon-mode .log-panel {
  grid-column: 1 / -1;
  grid-row: 1;
}

.app-shell.dungeon-mode .equipment-strip {
  display: none;
}

.app-shell.dungeon-mode .tabs,
.app-shell.arena-mode .tabs {
  display: none;
}

.app-shell.town-mode #dungeonView {
  display: none !important;
}

.app-shell.town-mode {
  background:
    radial-gradient(circle at 50% 18%, rgba(171, 119, 47, 0.18), transparent 48%),
    linear-gradient(180deg, rgba(20, 22, 17, 0.92), rgba(10, 13, 11, 0.98));
}

.app-shell.town-mode .tabs {
  border-color: rgba(214, 174, 84, 0.55);
  background: rgba(52, 42, 27, 0.96);
}

.app-shell.dungeon-mode .equipment-strip,
.app-shell.dungeon-mode .log-panel,
.app-shell.arena-mode .status-bar,
.app-shell.arena-mode .equipment-strip,
.app-shell.arena-mode .log-panel {
  border-color: #4f6048;
  background: rgba(18, 25, 18, 0.97);
}

.app-shell.arena-mode .status-bar,
.app-shell.arena-mode .equipment-strip,
.app-shell.arena-mode .log-panel {
  border-color: rgba(156, 76, 62, 0.62);
  background: rgba(27, 18, 16, 0.97);
}

.status-bar,
.equipment-strip,
.tabs,
.view,
.log-panel,
.floor-line {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(29, 37, 32, 0.97), rgba(18, 24, 20, 0.97));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025), var(--shadow);
}

.status-bar {
  display: grid;
  grid-template-columns: 0.9fr 0.9fr 0.9fr 1fr 0.62fr 54px;
  gap: 1px;
  overflow: hidden;
}

.status-bar > div,
.equipment-strip > div,
.floor-line > div,
.character-strip > div {
  display: grid;
  gap: 2px;
  padding: 5px 6px;
  background: rgba(255, 255, 255, 0.025);
  min-width: 0;
}

.hp-bar {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.hp-bar i,
.mini-hp-bar i {
  display: block;
  height: 100%;
  transition: width 0.18s ease, background-color 0.18s ease;
}

.hp-healthy { background: linear-gradient(90deg, #4f9b55, #89d06d); }
.hp-warning { background: linear-gradient(90deg, #b58a2d, #e4c458); }
.hp-critical { background: linear-gradient(90deg, #9e352f, #e05b4e); }

.character-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(27, 35, 30, 0.96), rgba(18, 24, 20, 0.96));
}

.hunger-stat.is-hungry strong,
.dungeon-hunger-stat.is-hungry strong {
  color: #ffd36d;
}

.hunger-stat.is-starving strong,
.dungeon-hunger-stat.is-starving strong {
  color: #ff7369;
  text-shadow: 0 0 8px rgba(255, 60, 45, 0.45);
}

.hunger-stat.is-weakened,
.dungeon-hunger-stat.is-weakened {
  animation: hunger-warning-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes hunger-warning-pulse {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

.audio-button {
  min-height: auto;
  border: 0;
  border-radius: 0;
  display: grid;
  place-items: center;
  gap: 0;
  padding: 5px 3px;
  background: rgba(214, 174, 84, 0.08);
}

.audio-button span {
  color: var(--gold);
  font-size: 18px;
  line-height: 1;
}

.audio-button strong {
  font-size: 10px;
  color: #fff0b8;
}

.audio-button.is-on {
  background: rgba(214, 174, 84, 0.18);
  box-shadow: inset 0 0 18px rgba(214, 174, 84, 0.08);
}

.app-shell:not(.town-mode) .audio-button {
  display: none;
}

span,
.panel-title,
small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
}

strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.equipment-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, auto);
  gap: 1px;
  overflow: hidden;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(32px, auto));
  gap: 4px;
  padding: 4px;
  overflow: hidden;
}

.tabs button {
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  min-height: 32px;
  font-size: 13px;
  white-space: nowrap;
}

.tabs button.locked {
  color: #77736b;
  border-color: rgba(120, 116, 106, 0.28);
  background: #171816;
  filter: saturate(0.35);
}

.tabs button[data-view="dungeon"] {
  padding-inline: 2px;
  font-size: 11px;
}

.tabs button.active {
  color: #fff3c4;
  background: linear-gradient(180deg, #55462a, #352c1e);
  box-shadow: inset 0 0 0 1px rgba(224, 184, 98, 0.28), 0 3px 12px rgba(0, 0, 0, 0.24);
}

.tabs button[data-view="arena"] {
  padding-inline: 2px;
  font-size: 10px;
}

.view {
  min-height: 0;
  padding: 7px;
  overflow: auto;
}

#dungeonView {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.app-shell.arena-mode #arenaView {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.save-warning {
  position: fixed;
  z-index: 120;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  width: min(calc(100vw - 20px), 500px);
  padding: 10px;
  border: 1px solid #db8d78;
  border-radius: 11px;
  background: rgba(78, 25, 20, 0.97);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
}

.save-warning p {
  margin: 0;
  line-height: 1.5;
}

.save-warning button {
  border-color: #e5ae72;
}

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

.town-grid,
.card-list {
  display: grid;
  gap: 8px;
}

.town-card,
.recipe-card,
.research-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  padding: 11px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.042), rgba(255, 255, 255, 0.014));
  display: grid;
  gap: 7px;
  box-shadow: inset 3px 0 rgba(224, 184, 98, 0.12), 0 5px 18px rgba(0, 0, 0, 0.18);
}

.town-card h2,
.recipe-card h2,
.research-card h2,
.modal-card h2 {
  margin: 0;
  font-size: 16px;
}

.town-card p,
.recipe-card p,
.research-card p,
.modal-card p {
  margin: 0;
  color: #e5e1d0;
  font-size: 13px;
  line-height: 1.45;
}

.junk-dealer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid rgba(193, 132, 231, 0.46);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(104, 53, 126, 0.28), rgba(38, 28, 48, 0.2));
}

.junk-dealer-header h2,
.junk-dealer-header p {
  margin: 2px 0;
}

.junk-dealer-header > strong {
  color: #efc8ff;
  white-space: nowrap;
}

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

.tavern-snack-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.tavern-snack-menu button {
  min-height: 52px;
  padding: 7px;
  text-align: left;
  display: grid;
  gap: 2px;
}

.tavern-snack-menu small {
  color: var(--muted);
}

.job-grid button {
  min-height: 64px;
  padding: 7px;
  text-align: left;
  display: grid;
  gap: 3px;
}

.job-grid button.selected {
  border-color: var(--gold);
  color: #ffe6a5;
}

.choice-grid {
  display: grid;
  gap: 6px;
}

.choice-grid button {
  min-height: 58px;
  padding: 8px;
  text-align: left;
  display: grid;
  gap: 2px;
}

.choice-grid button.selected {
  border-color: var(--gold);
  color: #ffe6a5;
  box-shadow: inset 0 0 0 1px rgba(214, 174, 84, 0.22);
}

.floor-line {
  display: grid;
  grid-template-columns: 1fr 68px;
  gap: 5px;
  align-items: stretch;
  margin-bottom: 5px;
}

.floor-line button {
  margin: 4px 4px 4px 0;
  min-height: 30px;
  font-size: 13px;
}

.floor-line small {
  color: #b9c8ad;
  font-size: 10px;
}

.dungeon-projection {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
}

.dungeon-stats-overlay {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 12;
  width: 66px;
  display: grid;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  transform: none;
}

.dungeon-stats-overlay .dungeon-hp-stat {
  grid-template-columns: auto 1fr;
  width: 66px;
  margin-bottom: 2px;
}

.dungeon-hp-stat > strong {
  color: #fff3c4;
  font-size: 11px;
}

.dungeon-hp-stat .hp-bar {
  grid-column: 1 / -1;
  width: 66px;
  height: 4px;
}

.dungeon-stats-overlay > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px;
  align-items: baseline;
  min-width: 0;
  padding: 1px 0;
}

.dungeon-stats-overlay span {
  color: #a9b8aa;
  font-size: 9px;
  line-height: 1;
  text-shadow: 0 1px 3px #000, 0 0 5px #000;
}

.dungeon-stats-overlay strong {
  color: #fff0b3;
  font-size: 12px;
  line-height: 1;
  text-align: right;
  text-shadow: 0 1px 4px #000;
}

.map {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(13, var(--tile));
  grid-template-rows: repeat(13, var(--tile));
  gap: 0;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  padding: 4px;
  border: 1px solid #4b513f;
  border-radius: 12px;
  /* Fractional mobile tile widths can expose a subpixel seam; use the floor
     color underneath so the seam remains visually continuous. */
  background: #1b241c;
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.76), 0 8px 24px rgba(0, 0, 0, 0.32);
}

.map::after {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: 8;
  border-radius: 8px;
  pointer-events: none;
  background: radial-gradient(
    circle closest-side at 50% 50%,
    transparent 0 34%,
    rgba(0, 0, 0, 0.08) 46%,
    rgba(0, 0, 0, 0.36) 64%,
    rgba(0, 0, 0, 0.72) 84%,
    rgba(0, 0, 0, 0.91) 97%,
    rgba(0, 0, 0, 0.97) 100%
  );
  box-shadow: inset 0 0 24px 8px rgba(0, 0, 0, 0.78);
}

.map-grid-row {
  display: contents;
}

.cell {
  position: relative;
  z-index: 1;
  /* Slight overlap prevents Safari from exposing hairline gaps when --tile
     resolves to a fractional CSS pixel. The map clips the outer half-pixel. */
  width: calc(var(--tile) + 0.6px);
  height: calc(var(--tile) + 0.6px);
  display: grid;
  place-items: center;
  border-radius: 0;
  background: #11140f;
  color: var(--muted);
  font-size: calc(var(--tile) * 0.48);
  line-height: 1;
  transition: filter 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.cell.light-near {
  filter: brightness(1.18) saturate(1.08);
}

.cell.light-room {
  z-index: 9;
  filter: brightness(1.18) saturate(1.08);
}

.cell.light-room.tile-floor {
  background: #1b241c;
  box-shadow: none;
}

.cell.light-mid {
  filter: brightness(0.9) saturate(0.9);
}

.cell.light-darkvision {
  filter: brightness(0.86) saturate(0.58) hue-rotate(8deg);
}

.cell.light-far {
  filter: brightness(0.58) saturate(0.68);
}

.tile-wall {
  border: 1px solid rgba(141, 148, 126, 0.22);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.09), transparent 42%),
    repeating-linear-gradient(0deg, #343830 0 4px, #292d27 4px 8px);
  box-shadow: inset 1px 1px rgba(197, 202, 174, 0.08), inset -2px -2px rgba(0, 0, 0, 0.34);
}

.tile-floor {
  border: 0;
  background: #1b241c;
  box-shadow: none;
}

.tile-excavated {
  background:
    radial-gradient(circle at 25% 70%, rgba(186, 162, 116, 0.28) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 34%, rgba(162, 145, 108, 0.22) 0 1px, transparent 2px),
    linear-gradient(160deg, #29271f, #1b1c17);
  box-shadow: inset 0 0 0 1px rgba(188, 165, 119, 0.18), inset 0 0 7px rgba(0, 0, 0, 0.28);
}

.cell.room-madness {
  outline: 1px solid rgba(203, 64, 122, 0.3);
  outline-offset: -2px;
}

.cell.room-treasureVault {
  outline: 1px solid rgba(247, 202, 83, 0.34);
  outline-offset: -2px;
}

.cell.room-thrill {
  outline: 1px solid rgba(137, 210, 255, 0.34);
  outline-offset: -2px;
}

.tile-player {
  z-index: 9;
  background: #1b241c;
  color: #fff4c2;
  font-size: calc(var(--tile) * 0.62);
  font-weight: 400;
  box-shadow: none;
  text-shadow: 0 0 5px #fff5c9, 0 0 12px rgba(238, 198, 94, 0.96);
}

.player-unlit {
  text-shadow: none !important;
}

.capoeira-inverted {
  transform: rotate(180deg);
}

.cell.targetable-ranged {
  z-index: 9;
  cursor: crosshair;
  outline: 2px solid rgba(116, 211, 255, 0.88);
  outline-offset: -2px;
  box-shadow:
    inset 0 0 0 1px rgba(218, 247, 255, 0.46),
    0 0 10px rgba(72, 186, 238, 0.72);
  color: #dff8ff;
}

.combat-projectile-fx,
.combat-impact-fx {
  position: fixed;
  z-index: 150;
  display: block;
  pointer-events: none;
  contain: layout paint;
}

.combat-projectile-fx {
  width: 20px;
  height: 7px;
  border-radius: 999px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, var(--combat-fx-color) 36%, var(--combat-fx-accent));
  box-shadow:
    0 0 5px var(--combat-fx-color),
    0 0 13px color-mix(in srgb, var(--combat-fx-color) 76%, transparent);
  transform: translate(-50%, -50%) rotate(var(--combat-fx-angle));
  transform-origin: center;
  animation: combat-projectile-flight var(--combat-fx-duration) cubic-bezier(0.16, 0.7, 0.2, 1) both;
  will-change: left, top, transform, opacity;
}

.combat-projectile-fx::before,
.combat-projectile-fx::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.combat-projectile-fx::after {
  right: 72%;
  top: 50%;
  width: 34px;
  height: 2px;
  border-radius: 999px;
  opacity: 0.7;
  background: linear-gradient(90deg, transparent, var(--combat-fx-color));
  transform: translateY(-50%);
}

.combat-projectile-player-shot {
  width: 27px;
  height: 4px;
  border-radius: 1px 999px 999px 1px;
  background: linear-gradient(90deg, #8d6635 0 62%, var(--combat-fx-accent) 63% 100%);
  box-shadow: 0 0 7px var(--combat-fx-color);
}

.combat-projectile-player-shot::before {
  right: -5px;
  top: 50%;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--combat-fx-accent);
  transform: translateY(-50%);
}

.combat-projectile-enemy-shot {
  width: 18px;
  height: 9px;
  border: 1px solid color-mix(in srgb, var(--combat-fx-accent) 82%, transparent);
  background: radial-gradient(circle at 72% 50%, var(--combat-fx-accent), var(--combat-fx-color) 38%, transparent 72%);
}

.combat-projectile-fx.combat-projectile-enemy-spell {
  width: 22px;
  height: 22px;
  border: 2px solid var(--combat-fx-accent);
  border-radius: 42%;
  clip-path: polygon(50% 0, 88% 18%, 100% 58%, 76% 94%, 32% 100%, 0 68%, 8% 24%);
  background:
    radial-gradient(circle, #fff 0 8%, var(--combat-fx-accent) 14%, transparent 34%),
    conic-gradient(from 30deg, var(--combat-fx-color), transparent 24%, var(--combat-fx-accent) 48%, transparent 72%, var(--combat-fx-color));
  box-shadow: 0 0 10px var(--combat-fx-color), 0 0 24px var(--combat-fx-color);
}

.combat-projectile-fx.combat-projectile-enemy-spell::before {
  inset: -7px;
  border: 1px dashed var(--combat-fx-accent);
  border-radius: 36%;
  animation: combat-projectile-orbit 360ms linear infinite reverse;
}

.combat-projectile-fx.combat-projectile-enemy-spell::after {
  right: 72%;
  width: 42px;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--combat-fx-color), var(--combat-fx-accent));
  filter: blur(1px);
}

.combat-projectile-job-skill {
  width: 33px;
  height: 9px;
  border-top: 2px solid var(--combat-fx-accent);
  border-bottom: 2px solid var(--combat-fx-color);
  border-radius: 60% 8px 60% 8px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--combat-fx-color) 72%, transparent));
}

.combat-projectile-job-skill::before {
  inset: -5px 2px;
  border: 1px solid var(--combat-fx-color);
  border-radius: 50%;
  animation: combat-projectile-orbit 260ms linear infinite;
}

.combat-projectile-spell {
  width: 17px;
  height: 17px;
  border: 2px solid var(--combat-fx-accent);
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 12%, var(--combat-fx-accent) 18%, var(--combat-fx-color) 48%, transparent 74%);
  box-shadow: 0 0 8px var(--combat-fx-color), 0 0 20px var(--combat-fx-color);
}

.combat-projectile-spell::before {
  inset: -7px;
  border: 1px solid var(--combat-fx-color);
  border-style: dashed;
  border-radius: 50%;
  animation: combat-projectile-orbit 420ms linear infinite;
}

.combat-projectile-dragon-breath {
  width: 58px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--combat-fx-accent) 72%, transparent);
  border-radius: 50% 12% 12% 50%;
  clip-path: polygon(0 39%, 100% 0, 86% 50%, 100% 100%, 0 61%);
  background:
    repeating-linear-gradient(0deg, transparent 0 5px, color-mix(in srgb, var(--combat-fx-accent) 62%, transparent) 6px 8px),
    linear-gradient(90deg, transparent, var(--combat-fx-color) 24%, var(--combat-fx-accent));
  box-shadow: 0 0 12px var(--combat-fx-color), 0 0 28px var(--combat-fx-color);
  animation-name: combat-breath-flight;
  animation-timing-function: cubic-bezier(0.08, 0.58, 0.2, 1);
  mix-blend-mode: screen;
}

.combat-projectile-dragon-breath::after {
  right: 82%;
  width: 48px;
  height: 22px;
  border-radius: 50%;
  filter: blur(4px);
}

.combat-projectile-variant-venom {
  width: 15px;
  height: 13px;
  border-radius: 58% 42% 64% 36%;
  filter: saturate(1.35);
}

.combat-projectile-variant-spark {
  width: 30px;
  height: 12px;
  border: 0;
  border-radius: 0;
  clip-path: polygon(0 43%, 28% 22%, 38% 52%, 65% 8%, 58% 44%, 100% 34%, 73% 61%, 52% 100%, 54% 60%, 22% 78%);
  background: var(--combat-fx-accent);
}

.combat-projectile-variant-ember {
  width: 19px;
  height: 15px;
  border-radius: 55% 45% 55% 45%;
  background: radial-gradient(circle at 70% 50%, #fff 0 9%, var(--combat-fx-accent) 20%, var(--combat-fx-color) 54%, transparent 76%);
}

.combat-projectile-variant-gust {
  width: 29px;
  height: 18px;
  border: 2px solid var(--combat-fx-color);
  border-left-color: transparent;
  border-radius: 50%;
  background: transparent;
}

.combat-projectile-variant-feather {
  width: 28px;
  height: 7px;
  border-radius: 100% 8% 100% 8%;
  background: linear-gradient(170deg, transparent 0 24%, var(--combat-fx-accent) 28% 54%, var(--combat-fx-color) 58% 100%);
}

.combat-projectile-variant-ray {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--combat-fx-color) 18%, #fff 72%, var(--combat-fx-accent));
}

.combat-projectile-variant-shard {
  width: 24px;
  height: 12px;
  border-radius: 0;
  clip-path: polygon(0 50%, 74% 0, 100% 50%, 74% 100%);
  background: linear-gradient(145deg, var(--combat-fx-accent), var(--combat-fx-color) 58%, transparent);
}

.combat-projectile-variant-pulse {
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 8%, var(--combat-fx-accent) 18%, var(--combat-fx-color) 48%, transparent 76%);
}

.combat-impact-fx {
  width: 18px;
  height: 18px;
  border: 3px solid var(--combat-fx-accent);
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 10px var(--combat-fx-color), inset 0 0 8px var(--combat-fx-color);
  transform: translate(-50%, -50%);
  animation: combat-impact-burst 400ms ease-out both;
}

.combat-impact-fx::before,
.combat-impact-fx::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: var(--combat-fx-color);
  box-shadow: 0 0 7px var(--combat-fx-color);
  transform: translate(-50%, -50%) rotate(45deg);
}

.combat-impact-fx::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.combat-impact-dragon-breath {
  width: 52px;
  height: 52px;
  border-width: 5px;
  animation-name: combat-breath-impact;
  animation-duration: 600ms;
  mix-blend-mode: screen;
}

.combat-impact-enemy-spell {
  width: 30px;
  height: 30px;
  border-width: 2px;
  border-radius: 30%;
  clip-path: polygon(50% 0, 63% 34%, 100% 50%, 63% 66%, 50% 100%, 37% 66%, 0 50%, 37% 34%);
  background: color-mix(in srgb, var(--combat-fx-color) 34%, transparent);
  mix-blend-mode: screen;
}

@keyframes combat-projectile-flight {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--combat-fx-angle)) scaleX(0.28);
  }
  12% { opacity: 1; }
  82% { opacity: 1; }
  100% {
    left: var(--combat-fx-end-x);
    top: var(--combat-fx-end-y);
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--combat-fx-angle)) scaleX(1.08);
  }
}

@keyframes combat-breath-flight {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--combat-fx-angle)) scale(0.12, 0.35);
  }
  14% { opacity: 0.92; }
  72% { opacity: 1; }
  100% {
    left: var(--combat-fx-end-x);
    top: var(--combat-fx-end-y);
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--combat-fx-angle)) scale(1.7, 1.22);
  }
}

@keyframes combat-projectile-orbit {
  to { transform: rotate(360deg); }
}

@keyframes combat-impact-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.15); }
  24% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.35); }
}

@keyframes combat-breath-impact {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.18) rotate(0); }
  20% { opacity: 0.96; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.8) rotate(28deg); }
}

@media (prefers-reduced-motion: reduce) {
  .combat-projectile-fx {
    animation-duration: 90ms !important;
  }

  .combat-impact-fx {
    animation-duration: 120ms !important;
  }
}

.tile-enemy {
  background: #22271f;
  color: #f0a090;
  font-weight: 800;
  text-shadow: 0 1px 3px #000;
}

.tile-enemy,
.tile-unique,
.tile-flower-pet {
  position: relative;
}

.tile-flower-pet {
  background: radial-gradient(circle, rgba(255, 151, 211, 0.3), #1d3322 68%);
  color: #ff9cda !important;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255, 143, 207, 0.8), 0 0 9px rgba(116, 236, 137, 0.5);
}

.tile-flower-pet .monster-marker {
  color: #ff9cda !important;
  text-shadow: 0 0 6px #ff5fbd, 0 0 10px #63e77b;
}

.tile-sleeping {
  filter: brightness(0.78) saturate(0.62);
  box-shadow: inset 0 0 0 1px rgba(151, 184, 222, 0.32);
}

.sleep-indicator {
  position: absolute;
  top: 1px;
  right: 2px;
  color: #baddff;
  font-size: calc(var(--tile) * 0.28);
  font-weight: 900;
  text-shadow: 0 0 4px #4e79a8;
  animation: sleep-drift 1.8s ease-in-out infinite alternate;
}

@keyframes sleep-drift {
  from { transform: translateY(1px); opacity: 0.58; }
  to { transform: translateY(-2px); opacity: 1; }
}

.tile-invisible-seen {
  opacity: 0.68;
  background-image: repeating-linear-gradient(115deg, transparent 0 4px, rgba(201, 244, 255, 0.16) 5px 6px);
  box-shadow: inset 0 0 0 1px rgba(185, 235, 244, 0.42), 0 0 10px rgba(140, 220, 238, 0.24);
  animation: invisible-shimmer 1.8s ease-in-out infinite alternate;
}

.tile-phasing-wall {
  background: repeating-linear-gradient(135deg, #222820 0 5px, #35413a 6px 8px) !important;
  opacity: 0.82;
  box-shadow: inset 0 0 0 1px rgba(178, 223, 235, 0.46), 0 0 8px rgba(133, 205, 225, 0.3) !important;
}

@keyframes invisible-shimmer {
  from { filter: contrast(0.82) brightness(0.85); transform: translateX(-1px); }
  to { filter: contrast(1.2) brightness(1.28); transform: translateX(1px); }
}

.monster-tier-white { color: #f4f4f4 !important; text-shadow: 0 1px 3px #000; }
.monster-tier-blue { color: #57a8ff !important; text-shadow: 0 0 5px rgba(40, 116, 255, 0.72); }
.monster-tier-green { color: #62db78 !important; text-shadow: 0 0 5px rgba(31, 157, 69, 0.72); }
.monster-tier-yellow { color: #ffe052 !important; text-shadow: 0 0 6px rgba(205, 154, 0, 0.8); }
.monster-tier-red { color: #ff625e !important; text-shadow: 0 0 6px rgba(210, 42, 37, 0.86); }
.monster-tier-purple { color: #cf79ff !important; text-shadow: 0 0 7px rgba(151, 49, 211, 0.9); }
.monster-tier-rainbow {
  animation: deep-rainbow-text 1.2s steps(6, end) infinite;
}

.monster-tier-white .monster-marker,
.monster-tier-blue .monster-marker,
.monster-tier-green .monster-marker,
.monster-tier-yellow .monster-marker,
.monster-tier-red .monster-marker,
.monster-tier-purple .monster-marker,
.monster-tier-rainbow .monster-marker {
  color: inherit !important;
  text-shadow: inherit;
}

.monster-tier-rainbow .monster-marker {
  animation: deep-rainbow-text 1.2s steps(6, end) infinite;
}

@keyframes deep-rainbow-text {
  0% { color: #ff5252; }
  20% { color: #ffd740; }
  40% { color: #69f0ae; }
  60% { color: #40c4ff; }
  80% { color: #b388ff; }
  100% { color: #ff80ab; }
}

.attr { font-weight: 800; }
.attr-fire { color: #ff655e; }
.attr-water { color: #58b8ff; }
.attr-thunder { color: #ffe052; }
.attr-poison { color: #c779ff; }
.attr-ice { color: #9eeeff; }
.attr-curse { color: #d88cff; }
.attr-acid { color: #9bea55; }
.attr-dark { color: #a58acb; }
.attr-light { color: #fff2a8; }
.attr-earth { color: #c89562; }
.attr-wind { color: #7ee8c2; }
.attr-steel { color: #cbd3db; }
.attr-illusion { color: #ff8fd8; }
.attr-slash { color: #ff9b9b; }
.attr-blunt { color: #e0ad78; }

.research-card-details .attr {
  display: inline-block;
  padding: 0 0.08em;
  font-size: 1.15em;
  line-height: 1;
  vertical-align: -0.04em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.78);
}

.research-note-label {
  display: block;
  margin-bottom: 3px;
  color: #e7c772;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.045em;
}

.research-note-label.threat {
  color: #ff8d7b;
}

.research-note-aside {
  color: #aaa58f;
  font-size: 0.92em;
  font-style: normal;
}

.tile-trap {
  color: #ff8a65;
  background: #38241f;
}

.tile-trap.trap-danger-4 {
  color: #ff635f;
  box-shadow: inset 0 0 7px rgba(255, 77, 69, 0.42);
}

.tile-trap.trap-danger-5 {
  color: #fff0b5;
  background: #491b20;
  box-shadow: inset 0 0 8px rgba(255, 44, 62, 0.62), 0 0 5px rgba(255, 44, 62, 0.28);
}

.monster-marker {
  transform: translateY(-1px);
}

.cell.tile-critical-fleeing {
  box-shadow:
    inset 0 0 0 1px rgba(255, 86, 72, 0.76),
    0 0 8px rgba(190, 37, 29, 0.46);
}

.tile-critical-fleeing .monster-marker {
  animation: monster-panic-shiver 0.34s steps(2, end) infinite;
}

.cell.has-monster-scream {
  z-index: 12;
}

.monster-scream {
  position: absolute;
  z-index: 20;
  bottom: 74%;
  left: 50%;
  width: max-content;
  pointer-events: none;
  color: #fff2d0;
  font-size: max(9px, calc(var(--tile) * 0.34));
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000, 0 0 7px rgba(255, 65, 52, 0.94);
  animation: monster-scream-burst 0.9s ease-out both;
}

@keyframes monster-panic-shiver {
  0% { transform: translate(-1px, -1px) rotate(-3deg); }
  50% { transform: translate(1px, 0) rotate(3deg); }
  100% { transform: translate(-1px, -1px) rotate(-3deg); }
}

@keyframes monster-scream-burst {
  0% { opacity: 0; transform: translate(-50%, 5px) scale(0.55); }
  22% { opacity: 1; transform: translate(-50%, -3px) scale(1.18); }
  100% { opacity: 0; transform: translate(-50%, -12px) scale(0.94); }
}

.mini-hp-bar {
  position: absolute;
  right: 2px;
  bottom: 2px;
  left: 2px;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.72);
}

.tile-unique {
  background: #22271f;
  color: #ffd06f;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px #d6ae54, 0 0 7px rgba(214, 174, 84, 0.45);
  animation: unique-pulse 1.4s ease-in-out infinite alternate;
}

.tile-unique.unique-regal,
.monster-info-heading.unique-regal { border-color: #dcae45; }
.tile-unique.unique-feral,
.monster-info-heading.unique-feral { border-color: #df654f; }
.tile-unique.unique-oracle,
.monster-info-heading.unique-oracle { border-color: #65bfdc; }
.tile-unique.unique-trickster,
.monster-info-heading.unique-trickster { border-color: #dc70c4; }
.tile-unique.unique-warrior,
.monster-info-heading.unique-warrior { border-color: #96a5af; }
.tile-unique.unique-silent,
.monster-info-heading.unique-silent { border-color: #625873; }
.tile-unique.unique-zealot,
.monster-info-heading.unique-zealot { border-color: #edc24f; }
.tile-unique.unique-scholar,
.monster-info-heading.unique-scholar { border-color: #6fbd83; }

.tile-unique.unique-feral { animation-duration: 0.58s; }
.tile-unique.unique-silent { animation: unique-silent-drift 2.8s ease-in-out infinite alternate; }
.tile-unique.unique-trickster { animation: unique-trickster-shift 1.1s steps(3, end) infinite; }

@keyframes unique-silent-drift {
  from { opacity: 0.58; filter: blur(0.35px); }
  to { opacity: 0.96; filter: blur(0); }
}

@keyframes unique-trickster-shift {
  0% { transform: translateX(-1px); filter: hue-rotate(0deg); }
  50% { transform: translateX(1px); filter: hue-rotate(35deg); }
  100% { transform: translateY(-1px); filter: hue-rotate(-25deg); }
}

.enemy-fire { color: #ff8a68; }
.enemy-water { color: #78cfff; }
.enemy-thunder { color: #ffe568; }
.enemy-poison, .enemy-curse { color: #d99aff; }
.enemy-ice { color: #baf6ff; }
.enemy-dark, .enemy-illusion { color: #c2a0ff; }
.enemy-light { color: #fff6c2; }
.enemy-earth, .enemy-blunt { color: #e7b47c; }
.enemy-wind { color: #a9efc0; }
.enemy-slash, .enemy-steel { color: #e3e8ed; }
.enemy-acid { color: #b9f66c; }

@keyframes unique-pulse {
  from { filter: brightness(0.9); }
  to { filter: brightness(1.2); }
}

.equipment-sortbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 25, 18, 0.94);
}

.equipment-sortbar label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
}

.equipment-sortbar select {
  min-height: 34px;
  border: 1px solid rgba(214, 174, 84, 0.34);
  border-radius: 6px;
  padding: 4px 28px 4px 8px;
  color: #f1ead5;
  background: #242a20;
}

.monster-info-modal {
  z-index: 80;
}

.monster-info-card {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.monster-info-heading {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(24, 28, 22, 0.94);
}

.monster-info-heading > span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.28);
  font-size: 25px;
  font-weight: 900;
}

.monster-info-heading h2 {
  margin: 0;
}

.monster-info-heading small {
  margin: 0;
  color: var(--muted);
}

.monster-info-grid {
  display: grid;
  gap: 5px;
}

.monster-detail-hp {
  display: grid;
  grid-template-columns: auto minmax(70px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
}

.monster-detail-hp .hp-bar {
  height: 8px;
}

.monster-info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 13px;
}

.monster-info-row span,
.monster-loot-info > span {
  color: var(--muted);
}

.monster-loot-info,
.monster-research-notes,
.unknown-info {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.monster-loot-info p,
.monster-research-notes p {
  margin: 4px 0 0;
}

.crafted-detail {
  margin: 0 0 8px;
  padding: 7px 8px;
  border: 1px solid rgba(214, 174, 84, 0.28);
  border-radius: 6px;
  color: #ffe6a5 !important;
  background: rgba(214, 174, 84, 0.07);
  font-size: 12px;
  line-height: 1.45;
}

.crafted-equipment {
  box-shadow: inset 3px 0 0 rgba(214, 174, 84, 0.58);
}

.shop-wallet {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid rgba(214, 174, 84, 0.45);
  border-radius: 8px;
  background: rgba(80, 61, 24, 0.22);
}

.shop-wallet strong {
  color: #ffe6a5;
  font-size: 18px;
}

.shop-section {
  margin-bottom: 12px;
}

.shop-section h2 {
  margin: 0 0 7px;
  color: #ffe6a5;
  font-size: 15px;
}

.shop-material-list {
  display: grid;
  gap: 5px;
}

.shop-material-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 5px;
  align-items: center;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.shop-material-list article div {
  display: grid;
  gap: 3px;
}

.shop-material-list button {
  padding-inline: 8px;
  font-size: 11px;
}

.guild-wallet {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 11px;
  border: 1px solid rgba(129, 173, 211, 0.5);
  border-radius: 8px;
  background: rgba(42, 74, 96, 0.22);
}

.guild-wallet strong {
  color: #bfe4ff;
  font-size: 19px;
}

.guild-section {
  margin-bottom: 14px;
}

.guild-section > h2 {
  margin: 0 0 4px;
  color: #bfe4ff;
  font-size: 16px;
}

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

.guild-bounty-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
}

.guild-bounty-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(211, 151, 94, 0.22);
  border-radius: 7px;
  background: rgba(98, 58, 28, 0.14);
}

.guild-bounty-row div {
  display: grid;
  gap: 3px;
}

.guild-bounty-row small {
  color: var(--muted);
}

.research-bounties {
  margin: 14px 0;
}

.bounty-card.known {
  border-color: rgba(230, 159, 78, 0.45);
}

.guild-reward {
  position: relative;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.guild-reward.available {
  border-color: rgba(111, 190, 236, 0.52);
  box-shadow: inset 3px 0 0 rgba(111, 190, 236, 0.7);
}

.guild-reward.guild-luxury-reward {
  border-color: rgba(239, 198, 93, 0.62);
  background:
    radial-gradient(circle at 12% 0, rgba(255, 229, 144, 0.14), transparent 42%),
    linear-gradient(145deg, rgba(83, 59, 21, 0.34), rgba(26, 22, 18, 0.94));
  box-shadow: inset 3px 0 0 rgba(255, 211, 92, 0.78), 0 0 16px rgba(191, 139, 32, 0.12);
}

.guild-luxury-label {
  display: inline-flex;
  padding: 3px 8px;
  border: 1px solid rgba(255, 218, 120, 0.58);
  border-radius: 999px;
  color: #ffe9a9;
  background: rgba(144, 96, 16, 0.28);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.guild-cost {
  float: right;
  margin-left: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #d7efff;
  background: rgba(76, 142, 184, 0.24);
  font-size: 12px;
  font-weight: 800;
}

.arena-intro,
.arena-stage {
  padding: 12px;
  border: 1px solid rgba(194, 80, 68, 0.45);
  border-radius: 9px;
  background: radial-gradient(circle at 50% 0, rgba(141, 48, 39, 0.2), rgba(25, 25, 20, 0.96) 58%);
}

.arena-intro h2 {
  margin: 0 0 8px;
  color: #ffc0a8;
}

.arena-record {
  display: flex;
  justify-content: space-between;
  margin: 12px 0;
  padding: 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
}

.arena-round {
  margin-bottom: 6px;
  color: #ff967f;
  font-size: 13px;
  font-weight: 800;
}

.arena-victory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.arena-tactical-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  justify-items: center;
  margin-top: 10px;
}

.arena-map {
  --arena-cell: clamp(20px, min(36px, 7.5vw, calc((100svh - 430px) / 9)), 36px);
  display: grid;
  grid-template-columns: repeat(9, var(--arena-cell));
  grid-template-rows: repeat(9, var(--arena-cell));
  gap: 2px;
  padding: 6px;
  border: 1px solid rgba(194, 80, 68, 0.48);
  border-radius: 12px;
  background: radial-gradient(circle, #30251e, #100e0c 72%);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.58), 0 8px 24px rgba(0, 0, 0, 0.28);
}

.arena-grid-row,
.arena-gridcell {
  display: contents;
}

.arena-cell {
  display: grid;
  place-items: center;
  width: var(--arena-cell);
  height: var(--arena-cell);
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: #c8b8aa;
  background: rgba(94, 70, 52, 0.18);
  font-size: calc(var(--arena-cell) * 0.46);
  line-height: 1;
}

.arena-floor:nth-child(odd) { background: rgba(120, 83, 55, 0.13); }
.arena-pillar { color: #81756b; background: #302d29; box-shadow: inset 0 0 0 1px #4c4741; }
.arena-player { color: #fff0a5; background: #3b493d; text-shadow: 0 0 9px rgba(255, 222, 113, 0.7); }
.arena-foe {
  color: hsl(var(--arena-marker-hue), 94%, 74%);
  background: rgba(94, 70, 52, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-weight: 800;
  -webkit-text-stroke: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.92);
}

.arena-move-pad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 42px);
  gap: 6px;
  padding: 7px;
  border: 1px solid rgba(224, 184, 98, 0.28);
  border-radius: 12px;
  background: rgba(15, 19, 17, 0.8);
}

.arena-move-pad button {
  min-height: 42px;
  padding: 0;
  font-size: 17px;
  touch-action: none;
  user-select: none;
}

.app-shell.arena-mode .arena-stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 4px;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
}

.arena-floor-line {
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin-bottom: 0;
}

.arena-floor-line button {
  min-width: 64px;
  white-space: nowrap;
}

.arena-floor-line > div {
  overflow: hidden;
}

.arena-enemy-name,
.arena-compact-status {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.arena-enemy-name {
  color: #ffd2be;
}

.app-shell.arena-mode .arena-round {
  margin: 0;
  font-size: 11px;
}

.app-shell.arena-mode .arena-tactical-layout {
  grid-template-columns: 1fr;
  align-content: start;
  min-height: 0;
  margin-top: 0;
}

.app-shell.arena-mode .arena-map {
  align-self: start;
}

.app-shell.arena-mode .arena-move-pad {
  position: fixed;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 20;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 44px);
  gap: 7px;
  padding: 8px;
  border-color: rgba(194, 80, 68, 0.48);
  background: linear-gradient(145deg, rgba(47, 28, 23, 0.97), rgba(21, 15, 13, 0.97));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 12px 34px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.app-shell.arena-mode .arena-move-pad button {
  width: 52px;
  min-height: 44px;
}

@media (max-width: 430px) {
  .arena-tactical-layout {
    grid-template-columns: 1fr;
  }

  .arena-move-pad {
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(3, 44px);
  }
}

.arena-victory strong,
.arena-victory p,
.arena-victory button {
  grid-column: 1 / -1;
}

.tile-corpse {
  position: relative;
  overflow: hidden;
  background: #292722;
  box-shadow: inset 0 0 0 1px rgba(184, 172, 144, 0.18);
}

.corpse-icon {
  position: relative;
  width: 68%;
  height: 38%;
  margin-top: 18%;
  border-radius: 48% 55% 42% 50%;
  background: #776f60;
  box-shadow:
    inset -3px -3px 4px rgba(0, 0, 0, 0.35),
    0 2px 3px rgba(0, 0, 0, 0.55);
  transform: rotate(-8deg);
}

.corpse-icon::before {
  content: "";
  position: absolute;
  left: -18%;
  top: 10%;
  width: 36%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #918675;
  box-shadow: inset -2px -2px 3px rgba(0, 0, 0, 0.35);
}

.corpse-icon::after {
  content: "";
  position: absolute;
  right: -16%;
  bottom: -12%;
  width: 48%;
  height: 3px;
  border-radius: 2px;
  background: #5e574b;
  transform: rotate(24deg);
  box-shadow: -9px -1px 0 #5e574b;
}

.tile-unique-corpse {
  z-index: 2;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 216, 111, 0.16) 0 15%, transparent 48%),
    radial-gradient(circle at 26% 76%, rgba(160, 42, 114, 0.34), transparent 48%),
    linear-gradient(145deg, #28152c, #100d1b 68%, #24131f);
  box-shadow:
    inset 0 0 0 1px rgba(255, 218, 125, 0.72),
    inset 0 0 8px rgba(192, 55, 137, 0.42),
    0 0 5px rgba(239, 177, 82, 0.24);
}

.tile-unique-corpse::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 235, 166, 0.38), rgba(213, 80, 151, 0.13) 38%, transparent 72%);
  filter: blur(1px);
  animation: unique-corpse-ember 1.9s ease-in-out infinite alternate;
}

.unique-corpse-aura {
  position: absolute;
  z-index: 1;
  inset: 7%;
  border-radius: 50%;
  background: conic-gradient(
    from 12deg,
    transparent 0 9%,
    rgba(255, 224, 139, 0.92) 11% 15%,
    transparent 18% 40%,
    rgba(211, 77, 164, 0.76) 43% 49%,
    transparent 52% 72%,
    rgba(255, 241, 187, 0.88) 75% 80%,
    transparent 83% 100%
  );
  -webkit-mask: radial-gradient(circle, transparent 0 55%, #000 58% 66%, transparent 69%);
  mask: radial-gradient(circle, transparent 0 55%, #000 58% 66%, transparent 69%);
  filter: drop-shadow(0 0 2px rgba(255, 211, 108, 0.82));
  animation: unique-corpse-aura-spin 4.8s linear infinite;
}

.unique-corpse-aura::before,
.unique-corpse-aura::after {
  content: "";
  position: absolute;
  width: 11%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #fff7ce, #e7ad4f 54%, #a53d94);
  clip-path: polygon(50% 0, 63% 37%, 100% 50%, 63% 63%, 50% 100%, 37% 63%, 0 50%, 37% 37%);
  filter: drop-shadow(0 0 2px rgba(255, 231, 154, 0.96));
}

.unique-corpse-aura::before {
  top: 0;
  left: 44%;
}

.unique-corpse-aura::after {
  right: 3%;
  bottom: 13%;
}

.tile-unique-corpse .corpse-icon {
  z-index: 3;
  width: 72%;
  height: 40%;
  margin-top: 19%;
  border: 1px solid rgba(255, 219, 133, 0.68);
  border-radius: 50% 58% 38% 48%;
  background:
    linear-gradient(116deg, transparent 0 48%, rgba(255, 222, 123, 0.72) 50% 53%, transparent 55%),
    radial-gradient(circle at 38% 30%, #b85b86, #6b294f 46%, #28162d 100%);
  box-shadow:
    inset -3px -3px 4px rgba(18, 4, 24, 0.72),
    inset 2px 1px 2px rgba(255, 189, 169, 0.22),
    0 0 5px rgba(230, 93, 166, 0.58),
    0 2px 3px rgba(0, 0, 0, 0.72);
  transform: rotate(-9deg);
}

.tile-unique-corpse .corpse-icon::before {
  left: -19%;
  top: -2%;
  width: 38%;
  border: 1px solid rgba(255, 221, 139, 0.65);
  border-radius: 52% 48% 45% 40%;
  background:
    radial-gradient(circle at 36% 40%, #ffe8a8 0 5%, transparent 7%),
    radial-gradient(circle at 68% 40%, #ffe8a8 0 5%, transparent 7%),
    linear-gradient(145deg, #c87291, #58213f 72%);
  box-shadow:
    inset -2px -2px 3px rgba(26, 5, 21, 0.64),
    0 0 3px rgba(255, 207, 111, 0.54);
}

.tile-unique-corpse .corpse-icon::after {
  right: -19%;
  bottom: -10%;
  width: 54%;
  height: 4px;
  background: linear-gradient(90deg, #6d2c50, #f2c568);
  box-shadow: -9px -1px 0 rgba(135, 56, 92, 0.92), 0 0 3px rgba(245, 196, 102, 0.62);
}

.unique-corpse-core {
  position: absolute;
  z-index: 5;
  left: 51%;
  top: 31%;
  width: 13%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 249, 211, 0.92);
  background: #ffd76e;
  box-shadow: 0 0 2px #fff5c5, 0 0 6px #dc4eac;
  transform: rotate(45deg);
  animation: unique-corpse-core-pulse 1.25s ease-in-out infinite alternate;
}

.unique-corpse-crest {
  position: absolute;
  z-index: 4;
  left: 10%;
  top: 18%;
  width: 31%;
  height: 23%;
  background: linear-gradient(180deg, #fff1af, #d99631 58%, #774023);
  clip-path: polygon(0 100%, 8% 25%, 34% 58%, 48% 0, 65% 56%, 94% 22%, 100% 100%);
  filter: drop-shadow(0 0 2px rgba(255, 218, 118, 0.86));
  transform: rotate(-11deg);
}

@keyframes unique-corpse-aura-spin {
  to { transform: rotate(360deg); }
}

@keyframes unique-corpse-core-pulse {
  from { opacity: 0.58; transform: rotate(45deg) scale(0.78); }
  to { opacity: 1; transform: rotate(45deg) scale(1.22); }
}

@keyframes unique-corpse-ember {
  from { opacity: 0.38; transform: scale(0.82); }
  to { opacity: 0.92; transform: scale(1.18); }
}

.tile-stairs {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(135, 184, 126, 0.2), transparent 42%),
    #1b241d;
  box-shadow: inset 0 0 0 1px rgba(135, 184, 126, 0.24);
}

.stair-icon {
  display: block;
  width: 94%;
  height: 94%;
  background: url("../assets/images/down-stairs.png") center / contain no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}

.home-section {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}

.home-section > h2 {
  margin: 0;
  color: #ffe6a5;
  font-size: 15px;
}

.equipment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.equipment-card p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.equipment-card .equipment-puzzle-effect {
  padding: 6px 8px;
  border-left: 2px solid rgba(116, 190, 222, 0.62);
  color: #ccecff;
  background: rgba(70, 132, 164, 0.08);
}

.equipment-card .equipment-puzzle-effect.active {
  border-left-color: #79e4a5;
  color: #d5ffe4;
  background: rgba(64, 164, 105, 0.1);
}

.equipment-card .equipment-puzzle-effect.inactive {
  opacity: 0.72;
}

.equipment-set-label {
  display: inline-block;
  width: fit-content;
  padding: 2px 6px;
  border: 1px solid rgba(116, 190, 224, 0.42);
  border-radius: 999px;
  color: #bfeaff;
  font-size: 11px;
}

.equipment-set-board {
  margin: 12px 0;
  padding: 11px;
  border: 1px solid rgba(116, 190, 224, 0.28);
  border-radius: 10px;
  background: rgba(28, 55, 70, 0.16);
}

.equipment-set-board h2,
.equipment-set-board p,
.equipment-set-card h3,
.equipment-set-card ul {
  margin: 0;
}

.equipment-set-grid {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.equipment-set-card {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.3fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.equipment-set-card.active {
  border-color: rgba(91, 201, 132, 0.48);
  box-shadow: inset 3px 0 rgba(91, 201, 132, 0.6);
}

.equipment-set-card li.inactive { color: var(--muted); }
.equipment-set-card li.active { color: #a9f2bd; }

.equipment-actions {
  display: flex;
  gap: 4px;
}

.equipment-actions button {
  min-height: 30px;
  padding-inline: 7px;
  font-size: 11px;
}

.home-profile {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(214, 174, 84, 0.42);
  border-radius: 11px;
  background:
    radial-gradient(circle at 100% 0, rgba(214, 174, 84, 0.12), transparent 42%),
    linear-gradient(145deg, rgba(44, 43, 30, 0.92), rgba(21, 27, 22, 0.96));
  box-shadow: inset 3px 0 rgba(224, 184, 98, 0.44), 0 7px 22px rgba(0, 0, 0, 0.2);
}

.home-profile-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 10px;
}

.adventure-objective {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(205, 89, 102, 0.68);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(72, 24, 37, 0.84), rgba(29, 22, 38, 0.92));
  box-shadow: inset 0 0 18px rgba(126, 35, 70, 0.16);
}

.adventure-objective span { display: block; color: #f1a6ae; font-size: 10px; font-weight: 900; letter-spacing: 0.12em; }
.adventure-objective strong { display: block; margin-top: 5px; color: #fff0c7; font-size: 15px; line-height: 1.4; }
.adventure-objective p { margin: 6px 0 0; color: #d8c9c7; font-size: 11px; line-height: 1.45; }
.adventure-objective.completed { border-color: rgba(111, 195, 124, 0.7); background: linear-gradient(135deg, rgba(25, 65, 43, 0.86), rgba(25, 38, 35, 0.94)); }
.adventure-objective.completed span { color: #91e3a0; }

.home-profile-heading h2,
.inventory-section > h2 {
  margin: 0;
  color: #ffe6a5;
  font-size: 16px;
}

.home-profile-heading p,
.inventory-section > p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.combat-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 6px;
}

.combat-metric {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 58px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.combat-metric span {
  color: #aeb9af;
  font-size: 10px;
}

.combat-metric strong {
  color: #fff2c0;
  font-size: 15px;
}

.inventory-section {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid rgba(137, 158, 142, 0.24);
  border-radius: 10px;
  background: rgba(24, 31, 26, 0.7);
}

.backstory-editor {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 11px;
  border: 1px solid rgba(121, 157, 184, 0.34);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(33, 48, 58, 0.58), rgba(20, 27, 25, 0.82));
  box-shadow: inset 3px 0 rgba(117, 169, 202, 0.3);
}

.backstory-editor h2,
.backstory-editor p {
  margin: 0;
}

.backstory-editor h2 {
  color: #cae7f6;
  font-size: 16px;
}

.backstory-editor p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.backstory-editor textarea {
  width: 100%;
  min-height: 126px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid rgba(148, 186, 207, 0.32);
  border-radius: 8px;
  color: #edf5f2;
  background: rgba(4, 9, 9, 0.42);
  font: inherit;
  font-size: 13px;
  line-height: 1.65;
}

.inventory-card,
.spell-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 9px;
  align-items: center;
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.028);
}

.inventory-card > div,
.spell-card > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.inventory-card p,
.spell-card p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.inventory-card button,
.spell-card button {
  min-height: 32px;
  padding-inline: 9px;
  font-size: 11px;
}

.rank-badge,
.artifact-tier,
.cursed-label,
.risque-label,
.reward-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.risque-label {
  color: #ffd5e8;
  border: 1px solid rgba(240, 125, 176, 0.42);
  background: rgba(145, 48, 93, 0.28);
  box-shadow: 0 0 8px rgba(220, 82, 145, 0.16);
}

.risque-synergy {
  margin: 8px 0 0;
  padding: 7px 8px;
  border: 1px solid rgba(240, 125, 176, 0.32);
  border-radius: 7px;
  color: #ffd5e8;
  background: rgba(145, 48, 93, 0.15);
  font-size: 11px;
  line-height: 1.45;
}

.name-secret-awakened {
  margin: 8px 0 0;
  padding: 8px;
  border: 1px solid rgba(255, 211, 73, 0.56);
  border-radius: 7px;
  color: #fff3a8;
  background: linear-gradient(90deg, rgba(205, 89, 20, 0.22), rgba(232, 190, 49, 0.1));
  box-shadow: 0 0 12px rgba(255, 184, 48, 0.16);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.rank-badge {
  color: #eee2bc;
  border: 1px solid rgba(214, 174, 84, 0.28);
  background: rgba(214, 174, 84, 0.11);
}

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

.spell-card {
  border-color: rgba(147, 132, 255, 0.27);
  background: linear-gradient(135deg, rgba(71, 55, 123, 0.18), rgba(24, 22, 39, 0.4));
  box-shadow: inset 3px 0 rgba(147, 132, 255, 0.32);
}

.spell-card strong {
  color: #ddd5ff;
}

.spell-card.selected {
  border-color: rgba(190, 177, 255, 0.72);
  box-shadow: inset 3px 0 #a99cff, 0 0 12px rgba(130, 111, 228, 0.2);
}

.artifact-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(236, 196, 92, 0.52) !important;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 221, 118, 0.16), transparent 38%),
    linear-gradient(145deg, rgba(74, 58, 27, 0.26), rgba(29, 27, 21, 0.84)) !important;
  box-shadow: inset 3px 0 rgba(255, 211, 86, 0.72), 0 5px 18px rgba(0, 0, 0, 0.2) !important;
}

.artifact-card > strong,
.artifact-card h2 {
  color: #ffe39a;
}

.artifact-tier {
  color: #ffe9a8;
  border: 1px solid rgba(255, 214, 95, 0.38);
  background: rgba(153, 109, 25, 0.28);
}

.cursed-label {
  color: #f2c2ff;
  border: 1px solid rgba(207, 111, 235, 0.4);
  background: rgba(116, 42, 137, 0.3);
  box-shadow: 0 0 8px rgba(169, 73, 198, 0.18);
}

.curse-summary {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  padding: 7px 8px;
  border: 1px solid rgba(192, 98, 218, 0.28);
  border-radius: 7px;
  color: #dfc7e7;
  background: rgba(94, 37, 107, 0.16);
  font-size: 11px;
  line-height: 1.45;
}

.research-dashboard {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
  padding: 11px;
  border: 1px solid rgba(102, 157, 132, 0.34);
  border-radius: 11px;
  background:
    radial-gradient(circle at 0 0, rgba(99, 153, 125, 0.12), transparent 40%),
    rgba(19, 29, 23, 0.88);
  box-shadow: inset 3px 0 rgba(102, 157, 132, 0.38);
}

.research-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 6px;
}

.research-count {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.17);
}

.research-count span {
  color: #a8b7ad;
  font-size: 10px;
}

.research-count strong {
  color: #d9f0df;
  font-size: 16px;
}

.research-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(2, minmax(108px, auto));
  gap: 7px;
  align-items: end;
  margin-bottom: 9px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(20, 27, 22, 0.94);
}

.research-tools > * {
  min-width: 0;
}

.research-tools label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
}

.research-search {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
}

.research-tools select,
.research-search input {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(125, 166, 141, 0.34);
  border-radius: 7px;
  padding: 6px 9px;
  color: #eef3ec;
  background: #202a23;
  font: inherit;
  font-size: 12px;
}

.research-search > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
}

.research-search button {
  min-height: 36px;
  padding-inline: 11px;
  font-size: 11px;
}

.research-search input::placeholder {
  color: #7f8d84;
}

.research-progress-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.44);
}

.research-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #557f62, #9bc680 70%, #e2c66e);
  box-shadow: 0 0 8px rgba(139, 193, 137, 0.35);
  transition: width 0.2s ease;
}

.research-level-dots {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.research-level-dot {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(149, 176, 158, 0.32);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.32);
}

.research-level-dot.filled {
  border-color: rgba(214, 188, 100, 0.72);
  background: #d2b965;
  box-shadow: 0 0 6px rgba(214, 185, 93, 0.48);
}

.research-card summary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  cursor: pointer;
  list-style: none;
}

.research-monster-graphic {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(167, 190, 174, 0.3);
  border-radius: 9px;
  background:
    radial-gradient(circle at 50% 38%, rgba(224, 184, 98, 0.13), transparent 52%),
    rgba(4, 8, 6, 0.48);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.34);
  font-size: 20px;
  font-weight: 900;
  text-shadow: 0 2px 4px #000;
}

.research-monster-graphic.unknown {
  color: #687169;
  border-color: rgba(112, 126, 116, 0.18);
  filter: grayscale(1);
}

.research-monster-graphic.unique {
  border-color: rgba(224, 184, 98, 0.62);
  box-shadow: inset 0 0 11px rgba(214, 174, 84, 0.12), 0 0 8px rgba(214, 174, 84, 0.18);
}

.monster-research-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.monster-research-title strong,
.monster-research-title small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.research-card summary::-webkit-details-marker {
  display: none;
}

.research-card summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(141, 173, 153, 0.28);
  border-radius: 50%;
  color: #c7d8cd;
  background: rgba(255, 255, 255, 0.035);
  font-size: 15px;
  line-height: 1;
}

.research-card-details {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.research-stat-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 9px;
  border: 1px solid rgba(201, 184, 126, 0.18);
  border-radius: 8px;
  background: rgba(10, 14, 11, 0.42);
}

.research-stat-line span {
  color: var(--muted);
}

.research-stat-line strong {
  color: #fff0b3;
}

.research-card[open] {
  display: grid;
  gap: 8px;
}

.research-card[open] summary::after {
  content: "−";
  color: #ffe2a0;
  border-color: rgba(214, 174, 84, 0.38);
}

.research-card[open] summary {
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.reward-tag {
  color: #d9efff;
  border: 1px solid rgba(114, 185, 226, 0.38);
  background: rgba(59, 125, 165, 0.25);
}

.reward-tag.harvest {
  color: #d8ffd0;
  border-color: rgba(126, 205, 104, 0.42);
  background: rgba(66, 130, 52, 0.25);
}

.reward-tag.experience {
  color: #ffe4a8;
  border-color: rgba(224, 178, 76, 0.46);
  background: rgba(143, 98, 31, 0.28);
}

.guild-claims {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  padding: 10px;
  border: 1px solid rgba(112, 184, 226, 0.42);
  border-radius: 10px;
  background:
    radial-gradient(circle at 100% 0, rgba(112, 184, 226, 0.12), transparent 44%),
    rgba(35, 61, 78, 0.22);
  box-shadow: inset 3px 0 rgba(112, 184, 226, 0.48);
}

.guild-claim-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.028);
}

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

.treasure-sell-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.026);
}

.treasure-sell-list article > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.treasure-sell-list button {
  min-height: 32px;
  padding-inline: 8px;
  font-size: 11px;
}

.death-effect {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  color: #e8ddd5;
  background:
    radial-gradient(circle, transparent 0 20%, rgba(45, 0, 0, 0.48) 58%, rgba(0, 0, 0, 0.97) 100%),
    rgba(70, 0, 0, 0.45);
}

.death-review-panel {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 7, 6, 0.9);
  backdrop-filter: blur(10px);
}

.death-review-card {
  width: min(100%, 480px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(154, 70, 59, 0.55);
  border-radius: 14px;
  background: linear-gradient(155deg, #271d1a, #111412);
  box-shadow: inset 3px 0 rgba(154, 51, 40, 0.32), 0 24px 72px rgba(0, 0, 0, 0.62);
}

.death-review-card > span {
  color: #bb8277;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.death-review-card h2,
.death-review-card p {
  margin: 0;
}

.death-review-card h2 {
  color: #dfc8bd;
}

.death-review-log {
  min-height: 132px;
  max-height: min(48dvh, 360px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.28);
}

.death-review-log p {
  margin: 0 0 5px;
  padding: 4px 6px;
  border-left: 2px solid rgba(159, 83, 70, 0.34);
  color: #ddd2c8;
  font-size: 12px;
  line-height: 1.4;
}

.depth-picker-card {
  width: min(100%, 420px);
}

.depth-picker-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: min(56dvh, 440px);
  overflow-y: auto;
}

.depth-picker-list button {
  text-align: center;
}

.level-up-effect {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  text-align: center;
  background: radial-gradient(circle, rgba(226, 190, 88, 0.1), rgba(7, 10, 6, 0.78) 62%, rgba(0, 0, 0, 0.86));
}

.level-up-effect.active {
  visibility: visible;
  pointer-events: auto;
  cursor: pointer;
  animation: level-up-screen var(--level-up-duration, 5s) ease-in-out forwards;
}

.level-up-effect.active::after {
  content: "タップで閉じる";
  margin-top: 18px;
  color: rgba(255, 247, 209, 0.72);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.level-up-effect strong {
  color: #ffe9a0;
  font-family: Georgia, serif;
  font-size: clamp(28px, 8vw, 48px);
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(255, 214, 91, 0.38);
}

.level-up-effect h2 {
  margin: 0;
  color: #fff7d1;
  font-size: 24px;
}

.level-up-growth {
  display: grid;
  gap: 5px;
  width: min(86vw, 360px);
  max-width: 420px;
  margin: 4px 0 0;
  color: #f2e6ba;
  font-size: 14px;
  line-height: 1.6;
}

.level-up-stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto 3.2em;
  gap: 8px;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 5px;
  opacity: 0.34;
  background: rgba(255, 255, 255, 0.035);
  transform: translateY(3px);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.level-up-stat span:first-child { text-align: left; }
.level-up-stat .stat-before { color: #aaa58f; }
.level-up-stat .stat-arrow { color: #827d68; }
.level-up-stat .stat-after { min-width: 3ch; color: #777363; font-weight: 800; }
.level-up-stat .stat-gain {
  color: #777363;
  font-size: 13px;
  opacity: 0;
  text-align: right;
}

.level-up-stat.revealed {
  opacity: 1;
  transform: none;
}

.level-up-stat.will-rise.revealed {
  background: rgba(255, 221, 112, 0.12);
}

.level-up-stat.unchanged.revealed {
  opacity: 0.72;
}

.level-up-stat.unchanged.revealed .stat-after {
  color: #aaa58f;
}

.level-up-stat.unchanged.revealed .stat-gain {
  color: #777363;
  opacity: 1;
}

.level-up-stat.will-rise.revealed .stat-after {
  color: #fff0a8;
  animation: level-stat-ping 0.36s ease-out;
}

.level-up-stat.will-rise.revealed .stat-gain {
  color: #ffdc65;
  opacity: 1;
  text-shadow: 0 0 8px rgba(255, 213, 78, 0.55);
  animation: level-stat-ping 0.36s ease-out;
}

@keyframes level-stat-ping {
  0% { transform: scale(0.72); filter: brightness(2.2); }
  55% { transform: scale(1.24); filter: brightness(1.45); }
  100% { transform: none; filter: none; }
}

@keyframes level-up-screen {
  0% { opacity: 0; transform: translateY(8px) scale(0.97); filter: brightness(1.12); }
  12% { opacity: 1; transform: none; filter: brightness(1); }
  82% { opacity: 1; transform: none; filter: brightness(1); }
  100% { opacity: 0; transform: translateY(-3px); filter: brightness(0.96); }
}

.title-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 28px 28px max(24px, env(safe-area-inset-bottom));
  overflow: hidden;
  color: #eee7d2;
  text-align: center;
  background: #050806;
  isolation: isolate;
}

.title-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, transparent 72%, rgba(3, 5, 4, 0.22) 84%, rgba(3, 5, 4, 0.78) 100%),
    url("../assets/images/chronicle-dungeon-title-v3.jpg") center / auto 100% no-repeat,
    #050806;
  pointer-events: none;
  transition: opacity 1.6s ease, filter 1.6s ease, transform 1.6s ease;
}

.title-screen > * {
  position: relative;
  max-width: calc(100vw - 56px);
}

.title-screen h1 {
  width: calc(100vw - 56px);
  margin: 0;
  color: #f0d693;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(36px, 11vw, 68px);
  line-height: 1.02;
  letter-spacing: 0.03em;
  text-shadow: 0 4px 0 #392612, 0 10px 28px #000;
}

.title-screen > .title-kicker,
.title-screen > h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.title-screen > .title-version {
  position: absolute;
  top: 30.6%;
  left: 50%;
  z-index: 1;
  width: auto;
  max-width: none;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  transform: translate(-50%, -50%);
  border: 0;
  color: #cda665;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(11px, 1.5vh, 22px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.14em;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.88);
}

.title-kicker,
.title-version,
.title-hint {
  margin: 0;
  color: #9e9d8d;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.title-screen button {
  box-sizing: border-box;
  width: min(280px, 78vw);
  margin: 0;
  padding: 13px 20px;
  border-color: #b9913e;
  color: #fff0b3;
  background: linear-gradient(rgba(87, 71, 34, 0.96), rgba(53, 44, 24, 0.96));
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.62);
}

.title-screen .title-hint {
  color: #b7b2a1;
  text-shadow: 0 2px 5px #000;
}

.title-screen > .title-version,
.title-screen > #titleStartButton,
.title-screen > .title-hint {
  transition: opacity 1.1s ease, visibility 0s linear;
}

.title-screen.chronicle-active::before {
  opacity: 0;
  filter: brightness(0.25) saturate(0.4);
  transform: scale(1.025);
}

.title-screen.chronicle-active > .title-version,
.title-screen.chronicle-active > #titleStartButton,
.title-screen.chronicle-active > .title-hint {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.1s ease, visibility 0s linear 1.1s;
}

.title-screen > .title-chronicle {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  padding:
    max(30px, env(safe-area-inset-top))
    clamp(22px, 7vw, 80px)
    max(30px, env(safe-area-inset-bottom));
  visibility: hidden;
  overflow-x: hidden;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 43%, rgba(138, 112, 61, 0.13), transparent 42%),
    radial-gradient(circle at 50% 50%, transparent 34%, rgba(0, 0, 0, 0.76) 100%),
    linear-gradient(180deg, #080907, #0d0c09 52%, #050605);
  transition: opacity 1.6s ease, visibility 0s linear 1.6s;
}

.title-screen.chronicle-active > .title-chronicle {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}

.title-chronicle::before,
.title-chronicle::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.title-chronicle::before {
  inset: clamp(18px, 4vw, 46px);
  border: 1px solid rgba(191, 158, 89, 0.22);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.72);
}

.title-chronicle::after {
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(74vw, 620px);
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, transparent, rgba(219, 187, 116, 0.025) 18%, rgba(219, 187, 116, 0.045) 50%, rgba(219, 187, 116, 0.025) 82%, transparent);
}

.title-chronicle-symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.title-chronicle-relics {
  position: absolute;
  z-index: 1;
  inset: clamp(14px, 2.5vw, 30px);
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 8%, rgba(0, 0, 0, 0.42) 47%, #000 76%);
  mask-image: radial-gradient(ellipse at center, transparent 8%, rgba(0, 0, 0, 0.42) 47%, #000 76%);
}

.title-chronicle-relics::before {
  content: "";
  position: absolute;
  inset: -12%;
  opacity: 0.34;
  background-image:
    radial-gradient(circle, rgba(236, 205, 132, 0.55) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(111, 178, 191, 0.42) 0 0.8px, transparent 1.5px),
    radial-gradient(circle, rgba(225, 170, 88, 0.36) 0 1.2px, transparent 2px);
  background-position: 0 0, 31px 47px, 78px 20px;
  background-size: 109px 97px, 137px 121px, 173px 149px;
  animation: title-chronicle-dust 34s linear infinite;
  animation-play-state: paused;
}

.title-screen.chronicle-active .title-chronicle-relics::before {
  animation-play-state: running;
}

.title-chronicle-relic {
  --relic-opacity: 0.18;
  --relic-rotation: 0deg;
  --relic-drift-x: 20px;
  --relic-duration: 22s;
  --relic-delay: 0s;
  position: absolute;
  display: block;
  width: 70px;
  aspect-ratio: 1;
  color: #bca369;
  opacity: 0;
  filter: drop-shadow(0 0 8px rgba(193, 157, 82, 0.16));
  transform-origin: center;
  animation: title-chronicle-relic-drift var(--relic-duration) ease-in-out infinite;
  animation-delay: var(--relic-delay);
  animation-play-state: paused;
  will-change: opacity, transform;
}

.title-screen.chronicle-active .title-chronicle-relic,
.title-screen.chronicle-active .title-chronicle-relic svg,
.title-screen.chronicle-active .title-chronicle-relic::after {
  animation-play-state: running;
}

.title-chronicle-relic svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: rgba(190, 155, 81, 0.16);
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.title-chronicle-relic.relic-sword svg,
.title-chronicle-relic.relic-axe svg {
  fill: rgba(153, 154, 144, 0.14);
  stroke-width: 1.3;
}

.title-chronicle-relic.relic-shield svg {
  fill: rgba(157, 126, 65, 0.13);
}

.title-chronicle-relic.relic-gem {
  color: #70aeb4;
  filter: drop-shadow(0 0 9px rgba(91, 179, 188, 0.23));
}

.title-chronicle-relic.relic-gem svg {
  fill: rgba(72, 148, 158, 0.18);
}

.title-chronicle-relic.relic-gem::after {
  content: "";
  position: absolute;
  top: 9%;
  left: 47%;
  width: 2px;
  height: 82%;
  border-radius: 50%;
  opacity: 0;
  background: linear-gradient(180deg, transparent, rgba(213, 250, 249, 0.72), transparent);
  transform: rotate(43deg);
  animation: title-chronicle-gem-glint 5.8s ease-in-out infinite;
  animation-delay: var(--relic-delay);
  animation-play-state: paused;
}

.title-chronicle-relic.relic-coin {
  color: #c9a44f;
  filter: drop-shadow(0 0 8px rgba(217, 171, 67, 0.2));
}

.title-chronicle-relic.relic-coin svg {
  fill: rgba(195, 145, 40, 0.16);
  animation: title-chronicle-coin-turn 7s ease-in-out infinite;
  animation-delay: var(--relic-delay);
  animation-play-state: paused;
}

.title-chronicle-relic:nth-child(1) {
  top: 6%;
  left: 2%;
  width: clamp(88px, 13vw, 148px);
  --relic-opacity: 0.18;
  --relic-rotation: -18deg;
  --relic-drift-x: 34px;
  --relic-duration: 25s;
  --relic-delay: -7s;
}

.title-chronicle-relic:nth-child(2) {
  top: 19%;
  left: 16%;
  width: clamp(38px, 5vw, 58px);
  --relic-opacity: 0.16;
  --relic-rotation: 12deg;
  --relic-drift-x: -18px;
  --relic-duration: 19s;
  --relic-delay: -12s;
}

.title-chronicle-relic:nth-child(3) {
  top: 57%;
  left: 5%;
  width: clamp(54px, 8vw, 86px);
  --relic-opacity: 0.23;
  --relic-rotation: -9deg;
  --relic-drift-x: 27px;
  --relic-duration: 21s;
  --relic-delay: -4s;
}

.title-chronicle-relic:nth-child(4) {
  top: 76%;
  left: 18%;
  width: clamp(66px, 10vw, 108px);
  --relic-opacity: 0.15;
  --relic-rotation: 8deg;
  --relic-drift-x: -25px;
  --relic-duration: 28s;
  --relic-delay: -18s;
}

.title-chronicle-relic:nth-child(5) {
  top: 6%;
  right: 10%;
  width: clamp(43px, 6vw, 66px);
  --relic-opacity: 0.19;
  --relic-rotation: -7deg;
  --relic-drift-x: 19px;
  --relic-duration: 20s;
  --relic-delay: -14s;
}

.title-chronicle-relic:nth-child(6) {
  top: 25%;
  right: -1%;
  width: clamp(96px, 14vw, 158px);
  --relic-opacity: 0.16;
  --relic-rotation: 21deg;
  --relic-drift-x: -31px;
  --relic-duration: 27s;
  --relic-delay: -9s;
}

.title-chronicle-relic:nth-child(7) {
  top: 48%;
  right: 17%;
  width: clamp(42px, 6vw, 64px);
  color: #9b78b9;
  --relic-opacity: 0.2;
  --relic-rotation: 14deg;
  --relic-drift-x: 16px;
  --relic-duration: 18s;
  --relic-delay: -5s;
}

.title-chronicle-relic:nth-child(8) {
  top: 69%;
  right: 4%;
  width: clamp(57px, 8vw, 88px);
  --relic-opacity: 0.19;
  --relic-rotation: 9deg;
  --relic-drift-x: -28px;
  --relic-duration: 23s;
  --relic-delay: -16s;
}

.title-chronicle-relic:nth-child(9) {
  top: 81%;
  right: 21%;
  width: clamp(76px, 11vw, 116px);
  --relic-opacity: 0.13;
  --relic-rotation: 27deg;
  --relic-drift-x: 25px;
  --relic-duration: 29s;
  --relic-delay: -20s;
}

.title-chronicle-relic:nth-child(10) {
  top: 7%;
  left: 32%;
  width: clamp(31px, 4vw, 46px);
  color: #708fb7;
  --relic-opacity: 0.16;
  --relic-rotation: -13deg;
  --relic-drift-x: -14px;
  --relic-duration: 17s;
  --relic-delay: -8s;
}

.title-chronicle-relic:nth-child(11) {
  top: 12%;
  right: 29%;
  width: clamp(45px, 6vw, 68px);
  --relic-opacity: 0.1;
  --relic-rotation: -11deg;
  --relic-drift-x: 18px;
  --relic-duration: 24s;
  --relic-delay: -15s;
}

.title-chronicle-relic:nth-child(12) {
  top: 87%;
  left: 35%;
  width: clamp(29px, 4vw, 43px);
  --relic-opacity: 0.15;
  --relic-rotation: 18deg;
  --relic-drift-x: -13px;
  --relic-duration: 16s;
  --relic-delay: -6s;
}

.title-chronicle-relic:nth-child(13) {
  top: 35%;
  left: -2%;
  width: clamp(70px, 10vw, 108px);
  --relic-opacity: 0.12;
  --relic-rotation: -28deg;
  --relic-drift-x: 23px;
  --relic-duration: 26s;
  --relic-delay: -22s;
}

.title-chronicle-relic:nth-child(14) {
  top: 87%;
  right: 36%;
  width: clamp(32px, 4vw, 48px);
  color: #6fa483;
  --relic-opacity: 0.17;
  --relic-rotation: 7deg;
  --relic-drift-x: 14px;
  --relic-duration: 19s;
  --relic-delay: -11s;
}

.title-chronicle-frame {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  width: min(760px, 100%);
  min-height: min(72svh, 610px);
  color: #dfd5bb;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif;
}

.title-chronicle-kicker,
.title-chronicle-return {
  margin: 0;
  color: #917d52;
  font-size: clamp(9px, 1.6vw, 12px);
  letter-spacing: 0.24em;
  text-shadow: 0 2px 10px #000;
}

.title-chronicle-kicker::after {
  content: "";
  display: block;
  width: min(280px, 55vw);
  height: 1px;
  margin: 18px auto 0;
  background: linear-gradient(90deg, transparent, rgba(196, 157, 79, 0.72), transparent);
}

.title-chronicle-verse {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: clamp(250px, 43svh, 390px);
  padding: 22px 0;
}

.title-chronicle-verse.is-cycling {
  animation: title-chronicle-verse-cycle var(--title-chronicle-verse-duration, 12000ms) ease both;
}

.title-chronicle-chapter {
  margin: 0 0 clamp(26px, 5svh, 48px);
  color: #bca067;
  font-size: clamp(12px, 2.2vw, 16px);
  letter-spacing: 0.17em;
  animation: title-chronicle-line 1.4s ease both;
}

.title-chronicle-line {
  display: block;
  margin: 0;
  color: #e3dcc9;
  font-size: clamp(14px, min(3.2vw, 3svh), 24px);
  font-weight: 400;
  line-height: 1.95;
  letter-spacing: 0.07em;
  text-wrap: balance;
  text-shadow: 0 2px 12px #000, 0 0 22px rgba(176, 145, 78, 0.08);
  opacity: 0;
  animation: title-chronicle-line 1.65s ease forwards;
  animation-delay: calc(0.45s + var(--chronicle-line-index, 0) * 0.42s);
}

.title-chronicle-return {
  align-self: end;
  color: #71684f;
  letter-spacing: 0.12em;
}

@keyframes title-chronicle-line {
  from {
    opacity: 0;
    filter: blur(3px);
    transform: translateY(11px);
  }
  to {
    opacity: 1;
    filter: none;
    transform: none;
  }
}

@keyframes title-chronicle-verse-cycle {
  0%,
  7% {
    opacity: 0;
  }
  18%,
  84% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes title-chronicle-relic-drift {
  0% {
    opacity: 0;
    transform: translate3d(0, 38px, 0) rotate(calc(var(--relic-rotation) - 8deg)) scale(0.9);
  }
  17%,
  70% {
    opacity: var(--relic-opacity);
  }
  48% {
    transform: translate3d(calc(var(--relic-drift-x) * 0.55), -7px, 0) rotate(var(--relic-rotation)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--relic-drift-x), -45px, 0) rotate(calc(var(--relic-rotation) + 9deg)) scale(1.06);
  }
}

@keyframes title-chronicle-coin-turn {
  0%,
  100% {
    transform: scaleX(1);
    filter: brightness(0.82);
  }
  48% {
    transform: scaleX(0.38);
    filter: brightness(1.45);
  }
  58% {
    transform: scaleX(0.72);
    filter: brightness(1.08);
  }
}

@keyframes title-chronicle-gem-glint {
  0%,
  58%,
  100% {
    opacity: 0;
    transform: translate(-18px, 12px) rotate(43deg);
  }
  70% {
    opacity: 0.8;
  }
  82% {
    opacity: 0;
    transform: translate(18px, -12px) rotate(43deg);
  }
}

@keyframes title-chronicle-dust {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(48px, -72px, 0);
  }
}

.death-effect.active {
  visibility: visible;
  animation: death-screen 2.8s ease-out forwards;
}

.death-effect strong {
  color: #c9b8af;
  font-family: Georgia, serif;
  font-size: clamp(34px, 10vw, 62px);
  letter-spacing: 0.15em;
  text-shadow: 0 3px 18px #000, 0 0 28px rgba(160, 0, 0, 0.7);
}

.death-effect p {
  margin: 0;
  color: #a99b94;
  font-size: 14px;
}

.death-cry-text {
  max-width: min(82vw, 520px);
  margin: 8px 0 4px;
  color: #ead8ca;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(18px, 5.2vw, 28px);
  font-weight: 700;
  line-height: 1.45;
  text-shadow: 0 2px 8px #000, 0 0 16px rgba(151, 31, 25, 0.45);
}

.death-cry-text::before { content: "「"; }
.death-cry-text::after { content: "」"; }

.death-mark {
  color: #8f1f1f;
  font-family: Georgia, serif;
  font-size: 74px;
  line-height: 1;
  text-shadow: 0 0 24px rgba(220, 0, 0, 0.55);
  animation: death-mark-fall 1.2s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes death-screen {
  0% { opacity: 0; filter: brightness(2.4); }
  12% { opacity: 1; filter: brightness(1.3); }
  70% { opacity: 1; filter: brightness(0.85); }
  100% { opacity: 0; filter: brightness(0.5); }
}

@keyframes death-mark-fall {
  0% { opacity: 0; transform: translateY(-40px) scale(1.7); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.tile-chest {
  background: #352f20;
  color: var(--gold);
}

.controls {
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(3, 50px);
  gap: 5px;
  justify-content: center;
  position: static;
  z-index: 1;
  padding: 6px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(24, 31, 27, 0.42), rgba(12, 17, 14, 0.5));
  box-shadow: none;
  backdrop-filter: blur(4px);
  transform: translateY(-3px);
}

.controls button {
  width: 54px;
  min-height: 50px;
  font-size: 21px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
  border-color: rgba(214, 174, 84, 0.34);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(50, 61, 53, 0.98), rgba(27, 36, 31, 0.98));
}

.controls button.has-action {
  border-color: #d6ae54;
  color: #fff0b3;
  background: #55451f;
  box-shadow: 0 0 10px rgba(214, 174, 84, 0.32);
}

.magic-move-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  gap: 6px;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 6px;
  border: 1px solid rgba(132, 119, 239, 0.48);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(41, 31, 75, 0.96), rgba(20, 17, 42, 0.96));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 8px 22px rgba(0, 0, 0, 0.32);
  transform: translateY(-4px) scale(0.9);
  transform-origin: right center;
}

.magic-move-controls button {
  min-height: 38px;
  padding: 5px;
  border-color: rgba(147, 132, 255, 0.42);
  background: rgba(55, 42, 99, 0.92);
  font-size: 12px;
}

.magic-move-controls button.selected {
  color: #fff;
  border-color: #c4b8ff;
  box-shadow: 0 0 12px rgba(154, 131, 255, 0.45);
}

.dungeon-action-dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: stretch;
  width: 100%;
  margin-top: 7px;
}

.resistance-board {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid rgba(214, 174, 84, 0.35);
  border-radius: 9px;
  background: rgba(214, 174, 84, 0.055);
}

.resistance-board h2 {
  margin: 0 0 5px;
}

.resistance-board p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
}

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

.resistance-total {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  overflow: hidden;
  padding: 5px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 11px;
}

.resistance-total i {
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: linear-gradient(90deg, #8ea960 calc(var(--tier) * 20%), transparent 0);
}

.resistance-total.tier-5 {
  color: #fff1a8;
  background: rgba(214, 174, 84, 0.17);
}

.log-panel {
  min-height: 140px;
  max-height: none;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 4px;
  overflow: hidden;
  padding: 5px 6px;
}

.log-panel-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.log-panel-toolbar > span {
  overflow: hidden;
  color: #91a397;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-panel-toolbar button {
  min-height: 25px;
  padding: 3px 8px;
  border-color: rgba(214, 174, 84, 0.34);
  border-radius: 8px;
  color: #e8ddb9;
  background: rgba(71, 58, 34, 0.62);
  font-size: 10px;
  white-space: nowrap;
}

.log-panel-toolbar button:disabled {
  opacity: 0.46;
}

.log-history-count {
  display: inline-grid;
  min-width: 18px;
  min-height: 18px;
  place-items: center;
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 999px;
  color: #fff1bd;
  background: rgba(214, 174, 84, 0.2);
}

.log-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.log-list::-webkit-scrollbar {
  display: none;
}

.app-shell.dungeon-mode .log-panel,
.app-shell.arena-mode .log-panel {
  min-height: 140px;
  max-height: none;
  padding: 8px 9px;
  overflow: hidden;
  border-color: rgba(105, 136, 116, 0.52);
  background: linear-gradient(180deg, rgba(17, 25, 21, 0.98), rgba(10, 16, 13, 0.98));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025), 0 -8px 28px rgba(0, 0, 0, 0.18);
}

.app-shell.dungeon-mode .log-panel {
  min-height: 105px;
  padding: 6px 8px;
  gap: 3px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025), 0 8px 28px rgba(0, 0, 0, 0.18);
}

.app-shell.dungeon-mode .log-panel-toolbar > span {
  font-size: 8px;
}

.app-shell.dungeon-mode .log-panel-toolbar button {
  min-height: 20px;
  padding: 1px 6px;
  font-size: 9px;
}

.app-shell.dungeon-mode .log-panel p {
  margin-bottom: 1px;
  padding-block: 1px;
  font-size: 11px;
  line-height: 1.15;
}

.app-shell.dungeon-mode .log-list,
.app-shell.arena-mode .log-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.app-shell.dungeon-mode .log-list::-webkit-scrollbar,
.app-shell.arena-mode .log-list::-webkit-scrollbar {
  display: none;
}

.log-panel p {
  margin: 0 0 3px;
  padding: 2px 5px 3px 7px;
  border-left: 2px solid rgba(127, 157, 137, 0.22);
  border-radius: 2px;
  color: #e8e4d5;
  font-size: 12px;
  line-height: 1.25;
}

.log-panel p:first-child {
  color: #fff5cf;
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(224, 184, 98, 0.09), transparent 82%);
}

.log-history-card {
  width: min(100%, 520px);
  max-height: calc(100dvh - 32px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.log-history-heading {
  display: grid;
  gap: 4px;
}

.log-history-heading > span {
  color: #9ab0a1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

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

.log-history-heading p {
  color: var(--muted);
  font-size: 11px;
}

.log-history-list {
  min-height: 0;
  max-height: min(62dvh, 540px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.28);
  scrollbar-color: rgba(214, 174, 84, 0.42) transparent;
}

.log-history-list p {
  margin: 0 0 5px;
  padding: 5px 7px;
  border-left: 2px solid rgba(127, 157, 137, 0.26);
  border-radius: 2px;
  color: #dddacf;
  font-size: 12px;
  line-height: 1.4;
}

.log-history-list p.latest {
  border-left-color: var(--gold);
  color: #fff5cf;
  background: linear-gradient(90deg, rgba(224, 184, 98, 0.09), transparent 82%);
}

.log-history-list p.empty {
  border-left: 0;
  color: var(--muted);
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 7, 6, 0.78);
  backdrop-filter: blur(9px);
}

.modal-card {
  width: min(100%, 480px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(155deg, #202923, #111713);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 22px 64px rgba(0, 0, 0, 0.54);
  display: grid;
  gap: 10px;
}

.setup-card {
  width: min(100%, 560px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

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

.name-entry {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.name-entry input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(214, 174, 84, 0.4);
  border-radius: 7px;
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
  font-size: 16px;
}

.setup-selector {
  display: grid;
  gap: 3px;
  min-height: 82px;
  text-align: left;
}

.setup-selector span,
.setup-selector small {
  color: var(--muted);
  font-size: 11px;
}

.setup-selector strong {
  color: #ffe6a5;
  font-size: 18px;
}

.setup-picker-modal {
  z-index: 70;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.log-history-list:focus-visible,
.cell[role="button"]:focus-visible,
.research-card summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (max-width: 420px) {
  .tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(38px, auto));
  }

  .tabs button {
    min-height: 38px;
    padding-inline: 2px;
    font-size: 11px;
  }

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

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

  .research-tools {
    grid-template-columns: 1fr;
  }

  .guild-claim-row {
    grid-template-columns: 1fr;
  }

  .treasure-sell-list article {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .treasure-sell-list article > div {
    grid-column: 1 / -1;
  }

  .treasure-sell-list button {
    width: 100%;
  }
}

.setup-picker-card {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.setup-picker-list {
  overflow-y: auto;
  max-height: min(62dvh, 520px);
  /* ボタン内の説明文はグリッド行の自動サイズ計算へ寄与しないことがあるため、
     行を内容量で確実に伸ばして説明の見切れを防ぐ。 */
  grid-auto-rows: max-content;
}

.setup-picker-list.race-picker-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.setup-picker-list.race-picker-grid button {
  align-content: start;
  min-width: 0;
  min-height: 76px;
}

.setup-picker-list.race-picker-grid small {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.setup-summary {
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: #efe8d0;
  font-size: 13px;
  line-height: 1.5;
}

.stat-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 13px;
  line-height: 1.4;
}

.list-pager {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 25, 18, 0.96);
  font-size: 12px;
}

.list-pager span {
  color: var(--muted);
}

.danger {
  color: #ffb0a0;
}

.ok {
  color: #cde9a8;
}

@media (min-width: 980px) {
  .app-shell {
    width: min(100vw, 1180px);
    padding: 12px 16px;
    gap: 9px;
  }

  .tabs {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .tabs button {
    min-height: 42px;
    font-size: 12px;
  }

  .view {
    padding: 12px;
  }

  .town-grid,
  .card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell.dungeon-mode {
    --tile: clamp(18px, min(36px, calc((100svh - 480px) / 13)), 36px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: clamp(105px, 15svh, 150px) minmax(0, 1fr);
    gap: 12px;
  }

  .app-shell.dungeon-mode #dungeonView {
    grid-column: 1;
    grid-row: 2;
    padding: 10px;
  }

  .app-shell.dungeon-mode .log-panel {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    max-height: none;
    padding: 12px;
    gap: 8px;
  }

  .app-shell.dungeon-mode .log-panel-toolbar > span {
    font-size: 11px;
  }

  .app-shell.dungeon-mode .log-panel-toolbar button {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 11px;
  }

  .app-shell.dungeon-mode .log-panel p {
    margin-bottom: 5px;
    padding: 5px 7px 6px 9px;
    font-size: 13px;
    line-height: 1.35;
  }

  .dungeon-action-dock {
    max-width: 700px;
    margin: 10px auto 0;
  }

  .magic-move-controls {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 380px) {
  :root {
    --tile: clamp(17px, min(27px, calc((100vw - 42px) / 13), calc((100svh - 342px) / 13)), 27px);
  }

  .controls {
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(3, 46px);
    gap: 4px;
    padding: 5px;
  }

  .controls button {
    width: 48px;
    min-height: 46px;
    font-size: 16px;
  }

  .dungeon-action-dock {
    gap: 5px;
  }

  .magic-move-controls {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 5px;
  }

  .magic-move-controls button {
    min-height: 34px;
    padding: 3px;
    font-size: 11px;
  }

  .resistance-total-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-shell.arena-mode .log-panel {
    min-height: 128px;
    max-height: 160px;
    padding-right: 9px;
  }

  .app-shell.dungeon-mode .log-panel {
    min-height: 105px;
    max-height: 132px;
    padding: 6px 8px;
  }

  .app-shell.arena-mode .status-bar {
    grid-template-columns: repeat(5, minmax(0, 1fr)) 42px;
  }

  .app-shell.arena-mode .character-strip {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .app-shell.dungeon-mode {
    /* 高さ予算390px = ヘッダー+操作パッド+ログ+余白。320pxでは667px級の
       端末で操作パッド下段がログに重なり、下移動が押せなかった。 */
    --tile: clamp(15px, min(29px, calc((100vw - 42px) / 13), calc((100svh - 390px) / 13)), 29px);
    grid-template-columns: minmax(0, 1fr);
  }

  .dungeon-stats-overlay {
    left: 6px;
    width: 66px;
  }

  .app-shell.arena-mode .status-bar > div,
  .app-shell.arena-mode .character-strip > div {
    padding: 3px;
  }

  .app-shell.arena-mode .status-bar strong,
  .app-shell.arena-mode .character-strip strong {
    font-size: 10px;
  }

  .app-shell.arena-mode .status-bar span,
  .app-shell.arena-mode .character-strip span {
    font-size: 8px;
  }

  .app-shell.arena-mode .arena-move-pad {
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(3, 44px);
    gap: 6px;
  }

  .app-shell.arena-mode .arena-move-pad button {
    width: 48px;
  }

  .status-bar {
    grid-template-columns: 1fr 1fr 1fr 54px;
  }

  .character-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .setup-selectors {
    grid-template-columns: 1fr;
  }
}

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

  .level-up-effect.active {
    animation: none !important;
    opacity: 1;
    transform: none;
    filter: none;
  }

  .title-chronicle-verse.is-cycling,
  .title-chronicle-chapter,
  .title-chronicle-line {
    animation: none !important;
    opacity: 1;
    filter: none;
    transform: none;
  }

  .title-chronicle-relics::before,
  .title-chronicle-relic,
  .title-chronicle-relic svg,
  .title-chronicle-relic::after {
    animation: none !important;
  }

  .title-chronicle-relic {
    opacity: 0.09;
    transform: rotate(var(--relic-rotation));
  }

}

.gm-crown {
  display: inline-block;
  margin-right: 3px;
  animation: gm-crown-glow 2.4s ease-in-out infinite;
}

.gm-rainbow-name {
  font-weight: 800;
  animation: deep-rainbow-text 1.8s steps(6, end) infinite;
}

@keyframes gm-crown-glow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(255, 215, 64, 0.55)); }
  50% { filter: drop-shadow(0 0 6px rgba(255, 215, 64, 0.95)); }
}

.clear-trophy {
  display: inline-block;
  margin-right: 3px;
  filter: drop-shadow(0 0 3px rgba(255, 213, 79, 0.7));
}

.clear-gold-name {
  font-weight: 800;
  color: #ffd54f;
  text-shadow: 0 0 6px rgba(255, 213, 79, 0.45);
}

/* ---- エンディング: 白の@とピンクの@、恋の舞台 ---- */
.ending-screen {
  position: fixed; inset: 0; z-index: 400; background: #000;
  opacity: 1; transition: opacity 1.4s ease;
}
.ending-screen.hidden { display: none; }
.ending-screen.is-fading { opacity: 0; }
.ending-stage { position: absolute; inset: 0; overflow: hidden; opacity: 1; transition: opacity 4s ease; }
.ending-stage.is-dimming { opacity: 0; }
.ending-actor {
  position: absolute; left: 0; top: 0; line-height: 1;
  font-family: ui-monospace, "SF Mono", "Courier New", monospace;
  font-size: clamp(34px, 7vmin, 60px);
  transition-property: left, top;
  transition-duration: 900ms, 900ms;
  transition-timing-function: cubic-bezier(0.45, 0.05, 0.35, 1);
  will-change: left, top, transform;
}
.ending-actor-white { color: #f2efe6; text-shadow: 0 0 14px rgba(242, 239, 230, 0.35); }
.ending-actor-pink { color: #ff85b8; text-shadow: 0 0 18px rgba(255, 133, 184, 0.55); }
.ending-actor.is-lean-left { transform: rotate(-13deg); transition: left 900ms, top 900ms, transform 700ms ease; }
.ending-actor.is-lean-right { transform: rotate(13deg); transition: left 900ms, top 900ms, transform 700ms ease; }
.ending-actor.is-fainted { transform: rotate(94deg) translateY(0.6vmin); transition: left 500ms, top 500ms, transform 600ms cubic-bezier(0.4, 0, 0.8, 1); }
.ending-actor.anim-hop { animation: ending-hop 0.55s ease; }
.ending-actor.anim-hop2 { animation: ending-hop 0.45s ease 2; }
.ending-actor.anim-twirl { animation: ending-twirl 1.1s cubic-bezier(0.4, 0.1, 0.3, 1); }
.ending-actor.anim-bigjump { animation: ending-bigjump 1.25s cubic-bezier(0.35, 0.5, 0.35, 1); }
.ending-actor.anim-shy { animation: ending-shy 0.85s ease; }
.ending-actor.anim-skid { animation: ending-skid 0.75s ease-out; }
.ending-actor.anim-springup { animation: ending-springup 0.7s cubic-bezier(0.3, 0.9, 0.4, 1.2); }
.ending-actor.anim-waltz { animation: ending-waltz 1.9s ease-in-out infinite; }
.ending-actor.anim-waltz.is-offbeat { animation-delay: -0.95s; }
@keyframes ending-hop { 40% { transform: translateY(-2.4vmin); } }
@keyframes ending-twirl { to { transform: rotate(360deg); } }
@keyframes ending-bigjump { 45% { transform: translateY(-9vmin) rotate(180deg); } 100% { transform: translateY(0) rotate(360deg); } }
@keyframes ending-shy { 40% { transform: rotate(-15deg) translateX(-1vmin); } }
@keyframes ending-skid { 30% { transform: rotate(20deg) translateX(1vmin); } 65% { transform: rotate(-9deg); } }
@keyframes ending-springup { 0% { transform: rotate(94deg); } 55% { transform: rotate(-14deg) translateY(-2.4vmin); } 100% { transform: none; } }
@keyframes ending-waltz { 0%, 100% { transform: translateY(0) rotate(-9deg); } 50% { transform: translateY(-1.8vmin) rotate(9deg); } }
.ending-spark {
  position: absolute; pointer-events: none; line-height: 1;
  font-size: clamp(18px, 3.2vmin, 28px); color: #ff85b8;
  text-shadow: 0 0 12px rgba(255, 133, 184, 0.6);
  opacity: 0; animation: ending-spark-rise 2.6s ease-out forwards;
}
.ending-spark.is-white { color: #f2efe6; text-shadow: 0 0 12px rgba(242, 239, 230, 0.5); }
.ending-spark.is-big { font-size: clamp(34px, 7vmin, 62px); animation-duration: 3.8s; }
@keyframes ending-spark-rise {
  0% { opacity: 0; transform: translateY(1.2vmin) scale(0.6); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10vmin) scale(1.18); }
}
.ending-gift {
  position: absolute; pointer-events: none; line-height: 1;
  font-size: clamp(22px, 4.4vmin, 38px); color: #ffd75e;
  text-shadow: 0 0 14px rgba(255, 215, 94, 0.55);
  transition: left 900ms ease, top 900ms ease, transform 600ms ease, opacity 600ms ease;
}
.ending-gift.is-dropped { transform: rotate(74deg); }
.ending-gift.is-claimed { opacity: 0; transform: scale(0.5); }
.ending-credit {
  position: absolute; left: 0; width: 100%; top: -12%;
  margin: 0; text-align: center; pointer-events: none;
  color: #e8d9a0; letter-spacing: 0.14em;
  font-size: clamp(16px, 3vmin, 24px);
  text-shadow: 0 0 12px rgba(232, 217, 160, 0.4);
  transition: top 2.6s cubic-bezier(0.2, 0.7, 0.3, 1), transform 1.6s ease;
}
.ending-credit.is-falling {
  transition: top 1.5s cubic-bezier(0.5, 0, 0.9, 0.4), transform 1.5s ease-in;
  transform: rotate(9deg);
}
.ending-skip-hint {
  position: absolute; bottom: 4%; left: 0; width: 100%; margin: 0;
  text-align: center; color: #8a857a; font-size: 12px;
  opacity: 0; transition: opacity 1s ease; pointer-events: none;
}
.ending-skip-hint.is-visible { opacity: 0.85; }

