:root {
  color-scheme: dark;
  font: 16px/1.5 system-ui, sans-serif;
  color: #f5efde;
  background: #101b17;
  --muted: #b9c6bc;
  --gold: #f3ca78;
  --red: #b5454c;
  --edge: #395047;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at top left, #233a2b, transparent 70%); }
main { max-width: 1320px; margin: auto; padding: clamp(16px, 4vw, 48px); }
h2, p { margin: 0; }
h2 { font-family: Georgia, serif; line-height: 1.12; }
h2 { font-size: 1.65rem; }
.hint, #status, #position { color: var(--muted); }
.character-bar { display: grid; grid-template-columns: auto minmax(0, 420px) auto; align-items: center; gap: clamp(8px, 2vw, 20px); margin-bottom: 20px; padding: 10px clamp(10px, 2vw, 22px); border: 1px solid #81623d; border-radius: 12px; background: linear-gradient(145deg, #34291f, #1d211c 72%); box-shadow: inset 0 0 0 3px #191913, inset 0 0 0 4px #59482e, 0 6px 20px #0005; }
.portrait { display: block; width: clamp(40px, 8vw, 64px); aspect-ratio: 1; border-radius: 50%; border: 2px solid #ba8d52; background: #2b251d; box-shadow: 0 0 0 2px #171611, 0 0 0 3px #75573a; }
.vitals { padding: 0 5px; }
.health-frame { position: relative; display: grid; place-items: center; margin-top: 4px; min-height: 30px; isolation: isolate; border: 2px solid #b48c52; border-radius: 5px; background: #2b171a; box-shadow: 0 0 0 2px #201511, 0 0 0 3px #6d5236; }
.health-frame::before, .health-frame::after { position: absolute; content: '◆'; top: 50%; transform: translateY(-50%); color: #e1b771; text-shadow: 0 1px #35251a; font-size: 12px; }
.health-frame::before { left: -7px; } .health-frame::after { right: -7px; }
#health { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; opacity: 0; }
.health-frame { background: linear-gradient(180deg, #b34751, #6d1728) left / var(--health-fill, 100%) 100% no-repeat, #2b171a; }
#player-lp { font-size: .85rem; text-shadow: 0 1px 3px #1b070a; }
.progress-summary { margin-top: 6px; color: var(--gold); font-size: .78rem; }
#xp-progress { display: block; appearance: none; width: 100%; height: 8px; margin-top: 5px; border: 1px solid #a7814f; border-radius: 5px; overflow: hidden; background: #241c17; }
#xp-progress::-webkit-progress-bar { background: #241c17; }
#xp-progress::-webkit-progress-value { background: linear-gradient(#ffdf95, #b88439); }
#xp-progress::-moz-progress-bar { background: linear-gradient(#ffdf95, #b88439); }
.level-notice:not(:empty) { margin-top: 6px; font-weight: 750; font-size: .85rem; color: #ffe39d; }
.story-entries { display: grid; gap: 10px; padding: 0; list-style: none; }
.story-entries li { padding: 9px 12px; border-left: 2px solid #ad8252; background: #f2c2840d; }
.story-entries strong, .story-entries small { display: block; }
.story-entries small { margin-top: 4px; line-height: 1.5; color: #eadac3; }
.world-button { width: auto; margin: 0 0 8px; }
.world-route { padding-inline-start: 1.4em; color: #eadac3; font-size: .9rem; }
.world-route li + li { margin-top: 5px; }
#save-status { margin: 0 0 8px; }
.inventory-button { justify-self: end; width: auto; padding-inline: clamp(8px, 2vw, 18px); border-color: #a7814f; color: #ffdea1; background: linear-gradient(#4d3928, #282019); }
.character-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.eyebrow { text-transform: uppercase; letter-spacing: .17em; color: var(--gold); font-size: .72rem; font-weight: 750; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(245px, .35fr); gap: 16px; align-items: start; }
.card { background: #1c2e26; border: 1px solid var(--edge); border-radius: 18px; padding: clamp(14px, 2.5vw, 23px); }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.map-scroll { overflow-x: auto; border-radius: 12px; }
.world-map { display: block; width: 100%; min-width: 590px; height: auto; background: #b8b27a url('world.svg') center / cover; border-radius: 12px; }
.world-map .map-trail { fill: none; stroke: #836b44; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; opacity: .83; }
.world-map[data-theme="highland"] { background: #b0bec7 url('frostgrat.svg') center / cover; }
.world-map[data-theme="highland"] .map-trail { stroke: #576979; }
.world-map[data-theme="wildwood"] { background: #788d65 url('wildhain.svg') center / cover; }
.world-map[data-theme="wildwood"] .map-trail { stroke: #544d35; }
.world-map[data-theme="marsh"] { background: #718f72 url('frontier-land.svg#marsh') center / cover; }
.world-map[data-theme="ravine"] { background: #9a7766 url('frontier-land.svg#ravine') center / cover; }
.world-map[data-theme="marsh"] .map-trail { stroke: #334c3b; }
.world-map[data-theme="ravine"] .map-trail { stroke: #543625; }
.world-map .tidal-trail { stroke: #265e67; stroke-dasharray: 9 6; }
.world-map.tide-high .tidal-trail { opacity: .3; }
.world-map[data-theme="stars"] { background: #8792ab url('frontier-land.svg#stars') center / cover; }
.world-map[data-theme="stars"] .map-trail { stroke: #343d50; }
#battle-warning { color: #ffe39d; font-size: .9rem; font-weight: 700; }
.field-disc { fill: #304a3d; stroke: #f0dbab; stroke-width: 2; }
.field-hit { fill: transparent; }
.field.enemy:not(.cleared) .field-disc { fill: var(--red); stroke: #ffc0ad; }
.field.endpoint .field-disc { fill: #3d4a35; stroke: var(--gold); }
.field .sword { display: none; }
.field.enemy:not(.cleared) .sword { display: initial; }
.field.visited { opacity: .58; }
.field.targetable, .field.editable { cursor: pointer; }
.field.reachable .field-disc, .field.targetable:hover .field-disc, .field.editable:hover .field-disc, .field.editable:focus-visible .field-disc { stroke: #fff6ae; stroke-width: 5; }
.field.reachable:focus-visible .field-disc { stroke: #fff; stroke-width: 5; }
.field.editable:focus-visible { outline: none; }
#pawn, #destination { pointer-events: none; }
.field text { fill: #fff8e8; font-size: 19px; font-weight: 750; text-anchor: middle; dominant-baseline: central; }
.field .label { fill: #353928; font: bold 17px Georgia, serif; paint-order: stroke; stroke: #ded09d; stroke-width: 2.5px; }
.sword circle { fill: #753039; stroke: #ffceaa; }
.sword path { fill: none; stroke: #fff2cd; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pawn-ring { fill: none; stroke: #ffe298; stroke-width: 3; }
.pawn-shadow { fill: #25221c; opacity: .4; }
#destination { visibility: hidden; }
#destination.danger, #destination.arrived { visibility: visible; }
#destination circle { fill: none; stroke: #a12734; stroke-width: 3; }
#destination.arrived circle { stroke: #fff1ae; }
#destination.danger circle, #destination.arrived circle { animation: landing .8s ease-out 2 both; }
@keyframes landing {
  from { transform: scale(.95); opacity: 1; stroke-width: 5; }
  to { transform: scale(1.45); opacity: .35; stroke-width: 2; }
}
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 0; margin: 14px 0 0; list-style: none; color: var(--muted); font-size: .84rem; }
.legend li { display: flex; gap: 7px; align-items: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #9db19d; background: #304a3d; }
.enemy-dot { background: var(--red); border-color: #ffc0ad; }
.pawn-dot { background: transparent; border: 2px solid var(--gold); }
.reachable-dot { border: 2px solid #fff6ae; }
.place-dot { width: 9px; height: 9px; background: var(--gold); border-color: #4d3323; border-radius: 1px; transform: rotate(45deg); }
.place-marker { fill: var(--gold); stroke: #4d3323; stroke-width: 1.25px; }
.world-map .service-symbol { fill: #ffedbb; stroke: #221e18; stroke-width: 3px; paint-order: stroke; font: bold 16px system-ui; pointer-events: none; }
.world-map .healer-marker-time { fill: #fff1cc; stroke: #241b16; stroke-width: 4px; paint-order: stroke; text-anchor: start; font: bold 15px system-ui; font-variant-numeric: tabular-nums; pointer-events: none; }
#steps { color: var(--gold); font-weight: 750; }
#steps:not(:empty) { margin-bottom: 8px; }
.settings { margin-top: 16px; }
.settings button { width: auto; }
.settings nav:not([hidden]) { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.controls #action { min-block-size: calc(2lh + 22px); margin: 10px 0 16px; }
.deck-area { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
#deck-count { color: var(--muted); font-size: .85rem; }
.deck-stack { padding: 0 5px 5px 0; }
#deck-top, .card-back { display: grid; place-items: center; border: 1px solid #b38b53; border-radius: 8px; color: #f3ca78; background: radial-gradient(circle, #734535, #39252c 68%); box-shadow: inset 0 0 0 3px #39252c, inset 0 0 0 4px #986d47; }
#deck-top { width: 50px; height: 64px; font-size: 1.5rem; box-shadow: inset 0 0 0 3px #39252c, inset 0 0 0 4px #986d47, 2px 2px #735139, 4px 4px #aa8051; }
.deck-stack.empty #deck-top { opacity: .3; box-shadow: none; }
.card-slot { margin: 0 0 18px; perspective: 850px; }
.card-flight { position: relative; transform-style: preserve-3d; }
.card-back { position: absolute; inset: 0; transform: rotateY(180deg); backface-visibility: hidden; font-size: 4.5rem; }
.enemy-card { border: 1px solid #b38b53; border-radius: 10px; overflow: hidden; background: linear-gradient(145deg, #502e32, #2e2329); backface-visibility: hidden; }
.enemy-art { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; background: #281f24; }
.enemy-details { padding: 12px; border-top: 1px solid #b38b53; }
.enemy-card h3 { margin: 3px 0 8px; font: bold 1.35rem Georgia, serif; }
.enemy-lore { color: #ecdbca; font: italic .92rem/1.35 Georgia, serif; }
.enemy-stats { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid #9b6662; font-size: .8rem; }
.enemy-stats div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 6px; }
.enemy-stats dd { margin: 0; color: #f5d6a5; font-weight: 700; }
.dice { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0 10px; min-height: 62px; }
.die { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 12px; background: linear-gradient(135deg, #fff5d6, #d8b779); color: #49351f; font-size: 1.6rem; font-weight: 800; box-shadow: inset 0 0 0 2px #fae4ac, 0 4px 0 #937146; }
.die.d20 { width: 64px; height: 62px; border-radius: 0; clip-path: polygon(50% 0, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%); background: conic-gradient(from -30deg, #f9e2a3, #d4a555, #fff0c1, #b58743, #f9e2a3); box-shadow: none; }
.die-face { display: grid; grid: repeat(3, 1fr) / repeat(3, 1fr); place-items: center; width: 40px; height: 40px; }
.die-face.die-number { grid: none; }
.pip { display: block; width: 7px; height: 7px; border-radius: 50%; background: #49351f; }
.result { font-weight: 750; }
#status { margin: 5px 0 16px; }
button { width: 100%; background: var(--gold); color: #241d11; border: 1px solid transparent; padding: 10px 12px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 750; }
button:hover:not(:disabled, [aria-disabled="true"]) { filter: brightness(1.12); }
button:focus-visible { outline: 2px solid #fff8e8; outline-offset: 3px; }
button:disabled, button[aria-disabled="true"] { opacity: .65; cursor: default; }
.secondary { margin-top: 8px; background: transparent; border-color: #73877b; color: #f5efde; }
.hint { margin-top: 15px; font-size: .85rem; }

.inventory { width: min(650px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: clamp(12px, 4vw, 24px); color: #f5efde; background: linear-gradient(145deg, #352b22, #201c19); border: 2px solid #a87a47; border-radius: 12px; box-shadow: inset 0 0 0 4px #201a15, 0 14px 45px #000a; }
.inventory::backdrop { background: #100d0bd6; }
.inventory-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.inventory-heading button { margin: 0; }
.rest-dialog { width: min(540px, calc(100% - 24px)); }
.rest-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 8px; }
.rest-choices section { display: grid; align-content: start; gap: 5px; padding: 10px; border: 1px solid #695343; border-radius: 6px; background: #211a16; }
.rest-choices button { margin: 0; }
.rest-choices p { font-size: .86rem; }
.rest-cooldown, #rest-feedback { color: var(--gold); font-variant-numeric: tabular-nums; }
#rest-feedback:not(:empty) { margin-top: 10px; }
.equipment { display: grid; grid-template-columns: clamp(60px, 16%, 88px) minmax(0, 1fr) clamp(60px, 16%, 88px); align-items: center; gap: clamp(6px, 2vw, 12px); padding: 12px; border: 1px solid #694e39; border-radius: 10px; background: radial-gradient(ellipse at 50% 42%, #624b37, #261f1c 67%, #1c1715); }
.outfit-figure { position: relative; isolation: isolate; }
#inventory-hero { height: clamp(170px, 35vh, 260px); }
.outfit-figure > :is(img, svg) { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.equipment-slots { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.equipment-slots li { display: grid; justify-items: center; gap: 2px; min-width: 0; padding: 3px; border: 1px solid transparent; border-radius: 7px; text-align: center; overflow-wrap: anywhere; hyphens: auto; font-size: .72rem; color: #e0cdb0; }
.ring-slots { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); justify-self: center; width: min(100%, 300px); padding-top: 6px; border-top: 1px solid #694e39; }
.equipment-slots li.drop-ready { border-color: #b59754; background: #63503960; }
.equipment-slots li.drop-over { border-color: #ffde89; box-shadow: 0 0 12px #f8c76585; background: #7c653e; }
.journey-list small { color: #d2c3ae; }
.inventory h3 { margin: 12px 0 3px; font: bold 1.1rem Georgia, serif; }
.inventory-help { font-size: .8rem; color: #d1bda2; }
.bag-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(5px, 1.3vw, 10px); margin: 8px 0 0; padding: 0; list-style: none; }
.bag-grid { justify-content: start; max-width: 440px; }
.shop-grid:not([hidden]) { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; max-width: 440px; margin: 8px 0 0; padding: 0; list-style: none; }
.shop-grid li { display: grid; gap: 4px; min-width: 0; }
.shop-grid .secondary { min-height: 38px; margin: 0; padding: 3px; font-size: .75rem; }
.icon-tile, .icon-tooltip, .icon-details { --tile-color: #b8ada1; --tile-glow: #4b3d36; }
.useful { --tile-color: #8ed18b; --tile-glow: #385538; }
.rare { --tile-color: #8dbbff; --tile-glow: #343f77; }
.epic { --tile-color: #dfabff; --tile-glow: #59376d; }
:is(.skill-combat, .skill-counterstep, .skill-fateTurn) { --tile-color: #f3a783; --tile-glow: #693c32; }
:is(.skill-tracks, .skill-herbal) { --tile-color: #a5ddd0; --tile-glow: #30665b; }
.skill-ford { --tile-color: #a9d5a1; --tile-glow: #315346; }
:is(.skill-healing, .skill-firstAid, .skill-fieldKit) { --tile-color: #f4ada5; --tile-glow: #713e42; }
:is(.skill-luck, .skill-trader) { --tile-color: #f1ce83; --tile-glow: #66512f; }
.icon-tile { display: grid; place-items: center; width: 100%; aspect-ratio: 1; margin: 0; padding: 5px; border: 1px solid var(--tile-color); border-radius: 6px; color: var(--tile-color); background: radial-gradient(ellipse at 45% 38%, var(--tile-glow), #181518 80%); box-shadow: inset 0 0 0 2px #141216, 0 2px 4px #0008; }
.equipment-slots .icon-tile { width: min(100%, 52px); }
.icon-tile[draggable="true"] { cursor: grab; }
.icon-tile.dragging { opacity: .55; }
.icon-tile[aria-pressed="true"] { outline: 2px solid #ffe6a1; outline-offset: 2px; }
.icon-tile.empty-tile { border-color: #64503d; color: #a18767; background: #191614; }
.empty-tile .item-art { opacity: .26; }
.item-art { display: block; width: 100%; height: auto; pointer-events: none; }
.skill-locked .item-art { opacity: .45; filter: saturate(.55); }
.skill-learned { box-shadow: inset 0 0 0 2px #131915, inset 0 0 13px #e4d29245, 0 0 6px #cdba6455; }
.icon-details:not([hidden]) { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 2px 9px; margin-top: 9px; padding: 8px 10px; border: 1px solid #695343; border-radius: 7px; background: #211a16; }
.icon-details > .item-art { grid-row: 1 / 3; }
.icon-details strong, .icon-tooltip strong { color: var(--tile-color); }
.icon-details small { color: #e0d1bd; }
.icon-details .journey-actions { grid-column: 2; }
.icon-tooltip { position: fixed; z-index: 10; width: max-content; max-width: min(270px, calc(100vw - 16px)); padding: 9px 11px; border: 1px solid var(--tile-color); border-radius: 7px; color: #fff3de; background: #14121bf5; box-shadow: 0 5px 20px #000a; pointer-events: none; overflow-wrap: anywhere; font-size: .84rem; }
.icon-tooltip > :is(strong, small) { display: block; }
.icon-tooltip small { color: #d9bd90; }
.icon-tooltip p { margin-top: 5px; }
.item-attributes { display: grid; gap: 3px; margin: 5px 0; }
.item-attributes > div { display: grid; grid-template-columns: 65px minmax(0, 1fr); gap: 6px; }
.item-attributes dt { font-weight: 700; color: var(--gold); }
.item-attributes dd { margin: 0; }
.icon-details > .item-attributes { grid-column: 2; }
.screen-reader-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.with-icon { display: inline-flex; align-items: center; gap: 5px; }
.with-icon .item-art { width: 21px; flex: 0 0 21px; }
.journey-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 6px; list-style: none; margin: 8px 0 0; padding: 0; }
.journey-list li { display: grid; gap: 3px; align-content: start; padding: 8px; background: #211a16; border: 1px solid #695343; border-radius: 6px; }
.journey-list li.item-preview-entry { grid-template-columns: 48px minmax(0, 1fr); gap: 8px; align-items: start; }
.item-preview-entry > div { display: grid; gap: 3px; }
.journey-actions:not(:empty):not([hidden]) { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.journey-actions button { width: auto; margin: 0; padding: 5px 8px; font-size: .78rem; overflow-wrap: anywhere; }
.journey-actions button[aria-pressed="true"] { background: var(--gold); color: #241d11; }
#inventory-notice { position: sticky; bottom: 0; margin-top: 8px; color: var(--gold); background: #211a16; }
#inventory-notice:not(:empty) { padding: 6px; border-radius: 5px; }
#open-place:not([hidden]) { margin: 0 0 8px; }
#scout-result { margin: 4px 0 10px; color: var(--gold); }

.battle { width: min(940px, calc(100% - 24px)); max-height: calc(100% - 24px); inset-block: 12px auto; margin-block: 0; scrollbar-gutter: stable; padding: 0; border: 0; background: transparent; color: #f5efde; }
.battle::backdrop { background: #100d12dc; }
#battle-content { display: grid; grid-template: "arena arena" "player enemy" / minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 10px; }
.battle-panel { grid-area: arena; min-width: 0; padding: clamp(12px, 3vw, 26px); background: radial-gradient(ellipse at 50% 18%, #44322a, #221e22 68%); border: 2px solid #ad8454; border-radius: 14px; box-shadow: inset 0 0 0 4px #261f1e, 0 18px 55px #000a; }
#battle-player-overview { grid-area: player; }
#battle-enemy-overview { grid-area: enemy; }
.battle-heading { text-align: center; margin-bottom: 14px; }
.battle-heading h2 { margin-top: 4px; }
.arena { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1fr); align-items: start; gap: clamp(8px, 2vw, 20px); }
.fighter { min-width: 0; text-align: center; }
.fighter h3 { margin: 0 0 6px; font: bold clamp(.94rem, 2.5vw, 1.35rem) Georgia, serif; overflow-wrap: anywhere; }
.arena-health { position: relative; padding: 2px 4px; margin-bottom: 8px; border: 1px solid #a87e53; border-radius: 5px; background: linear-gradient(#ae4b53, #741e34) left / var(--health-fill, 100%) 100% no-repeat, #27171f; font-size: .8rem; text-shadow: 0 1px 2px #000; }
.arena-health meter { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.fighter-stage { position: relative; display: grid; place-items: center; aspect-ratio: 5 / 4; margin-bottom: 8px; border: 1px solid #7d6048; border-radius: 8px; background: radial-gradient(ellipse at bottom, #7c6550, #343138 74%); }
.fighter-stage img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; position: absolute; object-fit: contain; }
.fighter-stage .outfit-figure { position: absolute; inset: 0; }
.perk-icons:not([hidden]) { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.perk-icons .icon-tile { width: 35px; }
.enemy-stage img { object-fit: cover; border-radius: 7px; }
.impact-stack { position: absolute; z-index: 1; top: 21%; inset-inline: 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; }
.impact { width: max-content; max-width: 100%; padding: 2px 6px; border-radius: 6px; background: #1a1319d9; color: #fff1db; font-weight: 850; line-height: 1.15; text-align: center; text-shadow: 0 1px 3px #000; }
.impact-loss { color: #ff939c; font-weight: 850; }
.impact-heal { color: #a9efa9; font-weight: 850; }
.impact-accent { color: #ffda82; font-weight: 800; }
.impact-block { color: #d6d7df; }
.impact :is(.impact-loss, .impact-heal, .impact-state) { font-size: clamp(.95rem, 3vw, 1.5rem); }
.impact .impact-accent { margin-inline-end: .3em; font-size: .75rem; }
.impact .impact-block { display: block; font-size: .75rem; }
.abilities { display: grid; gap: 5px; margin-top: 5px; font-size: .78rem; }
.abilities button { margin: 0; padding: 7px 4px; }
.ability-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.ability-bar button { margin: 0; padding: 5px 9px; font-size: .78rem; background: #2b241d; color: #a5988a; border: 1px solid #4a3f33; cursor: default; }
.ability-bar button.ability-ready { background: linear-gradient(#7a5a1f, #5d431a); color: #ffe9b0; border-color: #c99f4d; font-weight: 750; cursor: pointer; animation: ability-pulse 1.1s ease-in-out infinite; }
@keyframes ability-pulse { 50% { filter: brightness(1.3); } }
.enemy-ability { padding: 5px; border: 1px solid #695343; border-radius: 5px; background: #402b32; color: #ffdbaf; }
.battle-center { align-self: center; text-align: center; padding: 12px 5px; background: #19141b80; border-radius: 8px; }
.battle-center .dice { justify-content: center; margin: 8px 0; }
#battle-status { margin-top: 6px; color: #ded1c1; font-size: .85rem; }
#battle-confirm { margin-top: 12px; }
.battle-overview { min-width: 0; border: 1px solid #8a6b4b; border-radius: 8px; background: #221b21; font-size: .85rem; }
.battle-overview summary { padding: 7px 10px; color: var(--gold); font-weight: 700; cursor: pointer; }
.battle-overview summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 8px; }
.battle-overview-body { display: grid; gap: 6px; padding: 0 10px 10px; }
.battle-overview-body p:empty { display: none; }
.battle-overview table { width: 100%; border-collapse: collapse; text-align: left; }
.battle-overview caption { text-align: left; color: #ded1c1; margin-bottom: 3px; }
.battle-overview :is(th, td) { padding: 3px 4px; border-bottom: 1px solid #695343; }
.battle-overview :is(th, td):first-child { white-space: nowrap; }
.battle-overview :is(th, td):last-child { text-align: right; }
.battle-log { margin-top: 14px; padding: 9px 12px; border: 1px solid #695343; border-radius: 8px; background: #19141b80; }
.battle-log h3, .loot-card h3 { margin: 0 0 4px; font: bold 1rem Georgia, serif; color: var(--gold); }
.coin-amount { display: inline-flex; align-items: center; gap: .25em; color: var(--gold); white-space: nowrap; vertical-align: middle; }
.coin-amount .item-art { width: 1.3em; height: 1.3em; }
.loot-overlay:not([hidden]) { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 12px; background: #100c14ea; }
.loot-overlay [hidden] { display: none; }
.loot-card { width: min(100%, 500px); max-height: 100%; overflow: auto; padding: 18px; text-align: center; border: 1px solid #9b7450; border-radius: 12px; background: radial-gradient(ellipse at top, #3e3028, #1c171e 75%); box-shadow: 0 12px 50px #0009; }
.loot-bag { position: relative; display: grid; justify-items: center; gap: 8px; margin: 12px auto 0; background: #332521; border-color: #d9ad62; color: #ffeac1; }
.loot-bag-art { position: relative; display: block; }
.loot-bag-art .item-art { width: 72px; height: 72px; filter: drop-shadow(0 0 12px #dfaa5380); }
.loot-bag-art::before, .loot-bag-art::after { content: '✦'; position: absolute; color: #ffe6a1; text-shadow: 0 0 8px #f3c266; animation: loot-sparkle 1.75s ease-in-out infinite alternate; }
.loot-bag-art::before { top: 6px; left: -2px; }
.loot-bag-art::after { bottom: 5px; right: -2px; animation-delay: .6s; }
@keyframes loot-sparkle { from { opacity: .35; transform: translateY(2px) scale(.75); } to { opacity: 1; transform: translateY(-4px) scale(1.15); } }
#reward-dice, #reward-actions { justify-content: center; }
#reward-dice .die-face { width: 100%; }
#reward-die-panel:not([hidden]) { margin: 10px 0; animation: loot-die-reveal .45s ease-out; }
@keyframes loot-die-reveal { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }
#reward-item:not(:empty) { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0; }
#reward-item .icon-tile { width: 52px; }
#reward-item .coin-amount { font-weight: 700; font-size: 1.2rem; }
#reward-item .coin-amount .item-art { width: 32px; height: 32px; }
@media (prefers-reduced-motion: reduce) {
  .loot-bag-art::before, .loot-bag-art::after, #reward-die-panel { animation: none; }
}
.skill-tree { width: min(860px, calc(100% - 24px)); background: radial-gradient(ellipse at top, #48392d, #211b19 68%); }
.tree-summary { color: var(--gold); font-weight: 650; margin-bottom: 7px; }
.tree-legend { color: #d6c5ac; font-size: .8rem; }
:is(.skill-path-picker, .inventory-view-picker) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-block: 10px; }
.inventory-view-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
:is(.skill-path-picker, .inventory-view-picker) button { min-width: 0; min-height: 40px; margin: 0; padding: 6px 4px; font-size: .84rem; }
:is(.skill-path-picker, .inventory-view-picker) button[aria-pressed="true"] { background: #503b2a; border-color: var(--gold); color: #ffe6a1; }
.inventory-stats { display: grid; gap: 4px; margin: 10px 0 16px; }
.inventory-stats > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 6px 8px; border-radius: 5px; background: #19141b80; }
.inventory-stats dd { margin: 0; color: var(--gold); font-variant-numeric: tabular-nums; text-align: right; }
.stat-help { width: auto; padding: 0; border: 0; border-radius: 2px; background: transparent; color: inherit; font-weight: inherit; text-decoration: underline dotted; text-underline-offset: .2em; }
.skill-tree-paths { margin-top: 12px; }
.tree-path { min-width: 0; padding: clamp(8px, 1.5vw, 12px); border: 1px solid var(--tile-glow); border-radius: 8px; background: linear-gradient(var(--tile-glow), #1f1919 140px); }
.tree-path h3 { margin: 0 0 8px; color: var(--tile-color); }
.tree-path h4 { margin: 10px 0 5px; color: #ecd5b5; font: bold .88rem Georgia, serif; }
.tree-row { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.tree-node { width: min(100%, 4.5rem); }
.talent-card { position: relative; box-sizing: border-box; padding: 0; }
.talent-card.skill-locked { --tile-color: #b2a9a1; --tile-glow: #433f41; }
.talent-card .item-art { width: 52%; }
.talent-card:is(:hover, :focus-visible),
.talent-card[aria-expanded="true"] { border-color: #ffe6a1; }
.talent-rank, .talent-preview { position: absolute; color: #fff3de; font-size: .65rem; line-height: 1; }
.talent-rank { inset: auto 4px 4px auto; padding: 2px 4px; border-radius: 4px; background: #151115; font-variant-numeric: tabular-nums; font-weight: bold; }
.talent-preview { inset: 4px 0 auto; color: #ddcbb5; }
.talent-state { color: #d7d2cc; font-size: .73rem; }
.talent-details:not([hidden]) { margin-top: 8px; padding: 8px 10px; border: 1px solid #78604d; border-radius: 6px; background: #211a16; font-size: .85rem; }
.talent-details .journey-actions button { min-height: 38px; }
@media (max-width: 400px) {
  .skill-path-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 530px) {
  .character-bar { grid-template-columns: auto minmax(0, 1fr); }
  .character-actions { grid-column: 1 / -1; }
}
#battle-log { block-size: 7lh; overflow: auto; font-size: .85rem; line-height: 1.4; color: #ded1c1; }
#battle-log:empty::before { content: 'Noch keine Aktion.'; }
#battle-log h4 { margin: 0; color: #f5efde; }
#battle-log ul { margin: 0; padding-inline-start: 19px; }
.battle-hit-log summary { cursor: pointer; }
.battle-hit-log summary > span + span { display: inline-block; margin-inline-end: .45em; }
.battle-hit-log summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
#battle-log .battle-hit-log ul { margin: 3px 0 0; color: #ded1c1; }

.rules-link { display: inline-block; margin-top: 12px; color: var(--gold); text-underline-offset: 3px; }
.rules-link[aria-disabled="true"] { opacity: .55; cursor: default; }
.rules-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.rules-heading h1 { margin: 5px 0 0; font: bold clamp(1.8rem, 5vw, 2.6rem) Georgia, serif; }
.rules-intro { margin: 10px 0 18px; color: var(--muted); }
.rules-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rule-panel:first-child { grid-column: 1 / -1; }
.rule-panel > p { margin: 8px 0 12px; color: var(--muted); }
.rules-table-wrap { overflow-x: auto; margin-bottom: 10px; }
.rules-table { border-collapse: collapse; width: 100%; }
.rules-table th, .rules-table td { padding: 5px; text-align: left; border-bottom: 1px solid var(--edge); }
.rule-panel input { width: 4.2rem; padding: 5px; color: inherit; font: inherit; background: #151f1b; border: 1px solid #73877b; border-radius: 4px; }
.rule-panel input[readonly] { color: var(--muted); border-color: var(--edge); }
.rule-panel output { display: inline-block; margin-left: 6px; color: var(--gold); }
.escape-row label { display: inline-flex; align-items: center; gap: 8px; }
.escape-row + .escape-row { margin-top: 6px; }
.rules-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rules-actions button { width: auto; margin: 0; }
.rules-actions button:disabled { cursor: default; opacity: .55; }
.editor-select { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.editor-select select, .enemy-fields input, .enemy-fields textarea, .enemy-fields select { min-width: 0; padding: 7px 9px; color: inherit; font: inherit; border: 1px solid #73877b; border-radius: 5px; background: #151f1b; }
.catalog-links { display: flex; gap: 14px; margin: 0 0 16px; }
.catalog-links a { margin: 0; }
.catalog-links [aria-current="page"] { font-weight: 750; }
#catalog-view .editor-select { display: grid; max-width: 540px; }
.catalog-form { display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: start; gap: 14px; max-width: 830px; }
.catalog-form .enemy-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.catalog-form .enemy-fields label.wide, .catalog-actions { grid-column: 1 / -1; }
.catalog-context { color: var(--gold); font-size: .9rem; }
@media (max-width: 480px) {
  .catalog-form, .catalog-form .enemy-fields { grid-template-columns: minmax(0, 1fr); }
  #catalog-icon { width: 56px; }
}
.enemy-selects { display: flex; flex-wrap: wrap; gap: 0 18px; }
.enemy-form { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 16px; align-items: start; }
.enemy-form img { max-width: 240px; border: 1px solid #98774d; border-radius: 8px; }
.enemy-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 12px; }
.enemy-fields label { display: grid; align-content: start; gap: 4px; }
.enemy-fields label:nth-child(2) { grid-column: span 2; }
.enemy-fields .wide { grid-column: 1 / -1; }
#rules-message { margin: 12px 0; color: var(--gold); }
#rules-message.rules-error { color: #ffbcae; }

@media (max-width: 680px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .arena { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .battle-center { grid-area: 2 / 1 / auto / span 2; }
  .rules-grid { grid-template-columns: 1fr; }
  .rules-table { font-size: .84rem; }
  .rules-table input { width: 3.25rem; }
  .enemy-form { grid-template-columns: 1fr; }
  .enemy-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .enemy-fields label:nth-child(2) { grid-column: auto; }
}

@media (max-width: 480px) {
  #battle-content { grid-template: "arena" "player" "enemy" / minmax(0, 1fr); }
}

@media (min-width: 1120px) {
  .battle { width: min(1460px, calc(100% - 24px)); }
  #battle-content { grid-template: "player arena enemy" / clamp(205px, 17vw, 245px) minmax(0, 1fr) clamp(205px, 17vw, 245px); gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  #destination.danger circle, #destination.arrived circle { animation: none; }
}
.card-effect-editor {
  display: grid;
  gap: 0.65rem;
}

.card-effect-params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 0.65rem;
}

.card-effect-params input[type="checkbox"] {
  justify-self: start;
  width: auto;
}
