:root {
  color-scheme: dark;
  --bg: #101d1b;
  --panel: #192824;
  --panel2: #1e302a;
  --line: #8d947432;
  --ink: #e1dfcd;
  --muted: #9da997;
  --gold: #d1b77a;
  --green: #a7bb82;
  --danger: #e3957d;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
button,
input,
select {
  font: inherit;
}
button {
  color: inherit;
  background: #273b30;
  border: 1px solid #a9b68b40;
  padding: 10px 15px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s;
}
button:hover:not(:disabled) {
  background: #354d3b;
  border-color: #c4ca9b;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #f1d49a;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button.primary {
  background: var(--gold);
  color: #1f3027;
  border-color: var(--gold);
  font-weight: bold;
}
button.primary:hover:not(:disabled) {
  background: #e4cd96;
}
button.subtle {
  background: transparent;
  border-color: var(--line);
}
button.small {
  padding: 6px 10px;
  font-size: 12px;
}
.danger {
  color: var(--danger);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-weight: normal;
}
p {
  line-height: 1.55;
}
small,
.label,
.eyebrow,
.meta,
nav,
button,
.stats,
.chip,
input,
select {
  font-family: system-ui, sans-serif;
}
.eyebrow,
.label {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 10px;
  color: var(--muted);
}
.eyebrow {
  color: var(--gold);
  letter-spacing: 3px;
}
.muted {
  color: var(--muted);
}
.gold {
  color: var(--gold);
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.between {
  justify-content: space-between;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.divider {
  border-top: 1px solid var(--line);
  margin: 20px 0;
}
.badge {
  border: 1px solid var(--line);
  padding: 4px 7px;
  color: var(--muted);
  font:
    10px system-ui,
    sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.chip {
  padding: 4px 8px;
  background: #a1b28210;
  border: 1px solid var(--line);
  font-size: 11px;
}
.topbar {
  height: 77px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 30px;
  background: #15221f;
}
.brand {
  min-width: 225px;
}
.brand h1 {
  font-size: 29px;
  letter-spacing: 2px;
}
.brand .eyebrow {
  font-size: 8px;
  letter-spacing: 2.4px;
  margin-top: 3px;
}
.brandmark {
  font-size: 30px;
  color: var(--gold);
  margin-right: 11px;
}
.topbar nav {
  display: flex;
  height: 100%;
  gap: 4px;
  align-items: stretch;
  flex: 1;
}
.topbar nav button {
  background: transparent;
  border: 0;
  font-size: 12px;
  padding: 0 14px;
  color: var(--muted);
  position: relative;
}
.topbar nav button.active {
  color: var(--gold);
}
.topbar nav button.active:after {
  content: '';
  height: 2px;
  background: var(--gold);
  position: absolute;
  bottom: 0;
  left: 14px;
  right: 14px;
}
.top-stats {
  font: 12px system-ui;
  white-space: nowrap;
}
.top-stats strong {
  color: var(--gold);
  font-size: 16px;
}
.layout {
  display: grid;
  grid-template-columns: 222px minmax(400px, 1fr) 230px;
  min-height: calc(100vh - 116px);
}
.sidebar {
  padding: 25px 21px;
  border-right: 1px solid var(--line);
  background: linear-gradient(120deg, #1b2c25, #14231f);
}
.sidebar.right {
  border-left: 1px solid var(--line);
  border-right: 0;
  background: #16251f;
}
.portrait {
  width: 58px;
  height: 66px;
  border: 1px solid #9fad8055;
  background: radial-gradient(#526548, #263b30);
  image-rendering: pixelated;
}
.traveler h3 {
  font-size: 18px;
  margin-bottom: 5px;
}
.traveler small {
  font-size: 10px;
  color: var(--muted);
}
.healthbar {
  height: 4px;
  background: #38473a;
  margin: 14px 0 7px;
}
.healthbar i {
  display: block;
  height: 100%;
  background: #a2bb79;
  transition: width 0.3s;
}
.statline {
  font: 10px system-ui;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}
.slot {
  width: 100%;
  padding: 12px 9px;
  text-align: left;
  margin-top: 9px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: #26382c77;
  border: 1px solid #a6b98a30;
}
.slot .symbol {
  font-size: 26px;
}
.slot strong {
  display: block;
  font-size: 11px;
  font-weight: 500;
}
.slot small {
  display: block;
  font-size: 9px;
  margin-top: 4px;
  color: var(--muted);
}
.slot.locked {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
}
.quest-icon {
  font-size: 23px;
  color: var(--gold);
}
.quest h3 {
  font-size: 19px;
  line-height: 1.3;
  margin: 12px 0 8px;
}
.quest p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.quest-steps {
  list-style: none;
  margin: 14px 0;
  padding: 0;
  font: 10px system-ui;
}
.quest-steps li {
  margin: 11px 0;
  color: var(--muted);
  display: flex;
  gap: 8px;
  line-height: 1.5;
}
.quest-steps .done {
  color: var(--green);
}
.deck-identity {
  font-size: 14px;
  line-height: 1.5;
  margin: 9px 0;
}
.main {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #142b29;
}
.region-heading {
  padding: 25px 28px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #88977320;
  background: #192e28;
}
.region-heading h2 {
  font-size: 31px;
  margin: 5px 0;
}
.region-heading small {
  font-size: 10px;
  color: var(--muted);
}
.weather {
  text-align: right;
  font-size: 11px;
  color: #b5bda3;
  line-height: 1.7;
}
.world-wrap {
  position: relative;
  flex: 1;
  min-height: 440px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #13292c;
}
.world-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  cursor: crosshair;
}
.map-caption {
  position: absolute;
  left: 25px;
  bottom: 24px;
  pointer-events: none;
}
.map-caption .eyebrow {
  font-size: 8px;
  color: #9daf9b;
}
.map-caption p {
  font-size: 18px;
  color: #b9c7ac;
  font-style: italic;
  margin-top: 6px;
}
.world-controls {
  border-top: 1px solid var(--line);
  padding: 15px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #1b2e26;
}
.world-controls p {
  font-size: 11px;
  color: var(--muted);
}
kbd {
  font: 10px system-ui;
  background: #344438;
  border: 1px solid #8e9d7155;
  border-radius: 2px;
  padding: 3px 5px;
  color: #d5dcc5;
}
.location-card {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.location-card button {
  text-align: left;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  display: flex;
  gap: 11px;
  align-items: center;
}
.location-card .icon {
  width: 32px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #c2bb89;
  background: #2c3f31;
  font-size: 21px;
  border: 1px solid #afba8b25;
}
.location-card strong {
  font: 11px system-ui;
  display: block;
  margin-bottom: 5px;
}
.location-card small {
  font-size: 9px;
  color: var(--muted);
}
.right h3 {
  font-size: 18px;
  margin: 12px 0 7px;
}
.right p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.note {
  border-left: 2px solid #bbaa7055;
  padding: 2px 0 2px 12px;
  font-style: italic;
  font-size: 12px !important;
}
.right .mini-card {
  margin: 16px auto 0;
  width: 140px;
  transform: rotate(3deg);
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 25px;
  border-top: 1px solid var(--line);
  font: 9px system-ui;
  letter-spacing: 1px;
  color: #83937f;
  background: #12211d;
}
.saved-dot {
  color: #a8bf8e;
}
.card {
  --element: #adbf8c;
  background: #e1d9bc;
  color: #24342d;
  border: 3px solid var(--element);
  box-shadow: 0 4px 8px #06100c66;
  position: relative;
  text-align: left;
  overflow: hidden;
  border-radius: 5px;
  min-width: 0;
}
.card .card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 7px 6px;
  gap: 5px;
  border-bottom: 1px solid #283b3030;
  background: #ded9bf;
}
.card h3 {
  font-size: 12px;
  font-weight: bold;
  line-height: 1.2;
}
.cost {
  background: #23372e;
  color: #f2e6bc;
  border: 1px solid #8d9f77;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font: bold 15px Georgia;
}
.card img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
  image-rendering: pixelated;
  background: #465d49;
}
.card-type {
  padding: 5px 7px;
  font: 8px system-ui;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--element);
  color: #24322e;
}
.card-text {
  padding: 8px 7px;
  min-height: 57px;
  font-size: 11px;
  line-height: 1.4;
}
.card-bottom {
  padding: 5px 7px;
  border-top: 1px solid #283b3030;
  display: flex;
  justify-content: space-between;
  font: bold 12px Georgia;
}
.card-wrap {
  position: relative;
}
.card-wrap > button {
  width: 100%;
  font-size: 10px;
  margin-top: 6px;
  padding: 7px;
}
.card-wrap.selected .card {
  outline: 3px solid #fff1a3;
  transform: translateY(-5px);
}
.card-wrap.playable .card {
  box-shadow:
    0 0 0 1px #e1cf82,
    0 0 18px #cfbe6840;
  cursor: pointer;
}
.card-wrap.dim .card {
  filter: brightness(0.75);
}
.card-wrap .card {
  transition: transform 0.15s;
}
.card-wrap .card:hover {
  transform: translateY(-4px);
}
.mini-card .card img {
  height: 75px;
}
.mini-card .card-text {
  min-height: 35px;
  font-size: 10px;
}
.mini-card .card h3 {
  font-size: 10px;
}
.mini-card .card .cost {
  width: 19px;
  height: 19px;
  font-size: 12px;
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #081611d9;
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.dialog {
  width: min(1100px, 100%);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid #a7b38a66;
  background: #1c2d25;
  box-shadow: 0 20px 90px #0008;
  padding: 30px;
  position: relative;
}
.dialog.narrow {
  width: min(650px, 100%);
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 23px;
}
.dialog-header h2 {
  font-size: 30px;
  margin: 7px 0 10px;
}
.dialog-header p {
  color: var(--muted);
  font-size: 13px;
  max-width: 700px;
}
.close {
  font-size: 20px;
  padding: 5px 12px;
}
.onboarding {
  width: min(1060px, 100%);
  background: radial-gradient(ellipse at top, #344732, #192b24 70%);
  padding: 40px;
}
.onboarding .intro {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 26px;
}
.intro h2 {
  font-size: 43px;
  margin: 12px 0;
}
.intro p {
  color: #b4bda5;
  font-size: 14px;
  line-height: 1.7;
}
.elements {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.element-choice {
  border: 1px solid #b2bc8c38;
  background: #13261e;
  padding: 17px 8px;
  text-align: center;
  min-width: 0;
}
.element-choice .rune {
  font: 38px Georgia;
  display: block;
  margin: 5px 0 13px;
}
.element-choice h3 {
  font: 18px Georgia;
  margin: 5px 0 8px;
}
.element-choice p {
  font-size: 9px;
  color: #b7bea7;
  line-height: 1.5;
  min-height: 30px;
}
.element-choice small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-top: 17px;
}
.element-choice.selected {
  background: #3c4b34;
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 30px #cbb37812;
}
.intro-bottom {
  margin-top: 28px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.intro-bottom p {
  font: 11px system-ui;
  color: var(--muted);
  max-width: 300px;
  text-align: left;
}
.intro-bottom button {
  padding: 14px 25px;
}
.section-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.section-tabs button {
  padding: 7px 11px;
  font-size: 11px;
}
.section-tabs .selected {
  border-color: var(--gold);
  color: var(--gold);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 15px;
}
.deck-editor {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 25px;
}
.deck-list {
  background: #13241e;
  padding: 16px;
  align-self: start;
  position: sticky;
  top: 0;
}
.deck-list h3 {
  font-size: 20px;
}
.deck-list input {
  width: 100%;
  background: #21362a;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px;
  margin: 10px 0;
  font-size: 12px;
}
.deck-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.deck-row button {
  padding: 3px 7px;
}
.deck-list .validation {
  font: 11px system-ui;
  line-height: 1.5;
  margin: 12px 0;
  max-height: 130px;
  overflow: auto;
}
.deck-actions {
  display: flex;
  gap: 5px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.deck-actions button {
  font-size: 10px;
  padding: 8px;
}
.deck-list select {
  width: 100%;
  margin-top: 10px;
  font-size: 11px;
  background: #20382a;
  color: var(--ink);
  padding: 7px;
  border: 1px solid var(--line);
}
.owned {
  font: 10px system-ui;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
.empty {
  padding: 30px;
  color: var(--muted);
  text-align: center;
}
.implement-grid,
.cosmetic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.equipment-card {
  background: #15261f;
  padding: 20px;
  border: 1px solid var(--line);
}
.equipment-card .symbol {
  font-size: 35px;
}
.equipment-card h3 {
  font-size: 19px;
  margin: 12px 0;
}
.equipment-card p {
  font-size: 12px;
  color: var(--muted);
  min-height: 65px;
  margin-bottom: 15px;
}
.equipment-card button {
  width: 100%;
  font-size: 11px;
}
.rewards {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 24px 0;
}
.rewards .card-wrap {
  width: 160px;
}
.reward-gold {
  text-align: center;
  font-size: 34px;
  color: var(--gold);
  margin-top: 20px;
}
.battle {
  background: radial-gradient(ellipse at center, #344537, #192923);
  min-height: calc(100vh - 116px);
  padding: 22px 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.battle-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.duelist {
  display: flex;
  align-items: center;
  gap: 14px;
}
.duelist h2 {
  font-size: 23px;
}
.duelist .life {
  width: 56px;
  height: 56px;
  border: 1px solid #adbd9055;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 27px;
  color: #d6dfae;
  background: #22382c;
}
.duelist small {
  font-size: 11px;
  color: var(--muted);
}
.battle-stats {
  display: flex;
  gap: 10px;
  font: 11px system-ui;
  color: var(--muted);
}
.phase-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #10261d;
  border-top: 1px solid #c6b67c66;
  border-bottom: 1px solid #c6b67c66;
}
.phase-banner h3 {
  color: var(--gold);
  font-size: 20px;
}
.phase-banner p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.board {
  display: flex;
  justify-content: center;
  gap: 12px;
  min-height: 158px;
  padding: 10px;
  position: relative;
  border: 1px solid #aeb99025;
  background: #19291e55;
}
.unit {
  width: 139px;
  border: 2px solid var(--element);
  padding: 0;
  background: #1b2c24;
  position: relative;
  transition: transform 0.2s;
}
.unit:hover {
  transform: translateY(-3px);
}
.unit img {
  width: 100%;
  height: 70px;
  object-fit: cover;
  image-rendering: pixelated;
  display: block;
}
.unit-name {
  font: 11px Georgia;
  padding: 6px 5px;
  color: #ece3c9;
}
.unit-stats {
  display: flex;
  justify-content: space-between;
  padding: 5px 9px;
  background: #10251e;
  font: bold 14px Georgia;
}
.unit-label {
  font: 9px system-ui;
  padding: 4px;
  color: var(--muted);
}
.unit.selected {
  border-color: #fff0ab;
  box-shadow: 0 0 18px #e3ce7766;
  transform: translateY(-6px);
}
.unit.targetable {
  outline: 2px dashed #f3dca2;
  cursor: crosshair;
}
.unit.attacking:before {
  content: 'ATTACKING';
  font: 8px system-ui;
  letter-spacing: 1px;
  color: #1b2e23;
  background: #d7bc7c;
  position: absolute;
  top: -13px;
  left: 15px;
  right: 15px;
  padding: 3px;
}
.unit .block-label {
  font: 8px system-ui;
  background: #adbc7d;
  color: #1b2e23;
  padding: 4px;
}
.hand {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.hand .card-wrap {
  width: 150px;
}
.hand .card img {
  height: 80px;
}
.hand .card-text {
  min-height: 50px;
  font-size: 10px;
}
.hand .card h3 {
  font-size: 11px;
}
.battle-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.mana {
  display: flex;
  gap: 4px;
  margin-top: 7px;
}
.mana i {
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  background: #5c7c8566;
  border: 1px solid #93b3ae66;
}
.mana i.full {
  background: #a2c2b5;
  box-shadow: 0 0 8px #83b7a333;
}
.combat-log {
  font: 11px system-ui;
  color: var(--muted);
  max-width: 650px;
  height: 35px;
  overflow: auto;
  text-align: right;
}
.battle-log-list {
  font: 12px system-ui;
  line-height: 1.8;
  color: var(--muted);
}
.cosmetic-preview {
  height: 145px;
  background: radial-gradient(#436042, #1c3025);
  display: grid;
  place-items: center;
  margin-bottom: 15px;
  border: 1px solid var(--line);
  overflow: hidden;
}
.cosmetic-preview .back {
  height: 115px;
  width: 80px;
  border: 4px double var(--cosmetic);
  background: repeating-linear-gradient(45deg, #14281f, #14281f 7px, #253e2d 8px, #253e2d 10px);
  box-shadow: 0 8px 15px #0005;
  display: grid;
  place-items: center;
  color: var(--cosmetic);
  font-size: 42px;
  transform: rotate(-8deg);
}
.cosmetic-preview canvas {
  image-rendering: pixelated;
}
.cosmetic-preview .preview-frame {
  width: 100px;
  height: 120px;
  border: 5px double var(--cosmetic);
  display: grid;
  place-items: center;
  color: var(--cosmetic);
  font-size: 40px;
  background: #324a38;
}
.journal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.journal-item {
  border: 1px solid var(--line);
  background: #15271e;
  padding: 22px;
}
.journal-item h3 {
  font-size: 22px;
  margin: 8px 0 12px;
}
.journal-item p {
  font-size: 13px;
  color: var(--muted);
}
.journal-item .reward {
  font: 11px system-ui;
  color: var(--gold);
  margin-top: 20px;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
}
.help-grid h3 {
  font-size: 20px;
  margin: 10px 0;
}
.help-grid p,
.help-grid li {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.help-grid ul {
  padding-left: 17px;
}
#toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  bottom: 45px;
  background: #d7c38f;
  color: #203228;
  box-shadow: 0 7px 30px #0006;
  padding: 14px 22px;
  z-index: 100;
  max-width: 600px;
  font: 12px system-ui;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.save-error {
  background: #6e342d;
  color: #f9dcb9;
  padding: 8px 15px;
  font: 12px system-ui;
}
.banner {
  padding: 12px 16px;
  border: 1px solid #c4ad7766;
  background: #bfa56610;
  color: #ded2a2;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 18px;
}
.cosmetic-ember .card {
  border-style: double;
  border-width: 5px;
  border-color: #e49a61;
}
.loading {
  animation: pulse 2s infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}
@media (min-width: 1600px) {
  .layout {
    grid-template-columns: 250px minmax(400px, 1fr) 260px;
  }
  .sidebar {
    padding: 30px;
  }
  .world-wrap canvas {
    max-height: calc(100vh - 290px);
    object-fit: contain;
  }
  .hand .card-wrap {
    width: 168px;
  }
}
@media (max-width: 1150px) {
  .layout {
    grid-template-columns: 190px minmax(300px, 1fr);
  }
  .sidebar.right {
    display: none;
  }
  .topbar {
    padding: 0 18px;
    gap: 12px;
  }
  .topbar nav button {
    padding: 0 8px;
    font-size: 11px;
  }
  .brand {
    min-width: 200px;
  }
  .top-stats .badge {
    display: none;
  }
  .sidebar {
    padding: 22px 15px;
  }
  .elements {
    grid-template-columns: repeat(3, 1fr);
  }
  .element-choice {
    padding: 10px;
  }
  .element-choice .rune {
    margin: 0;
  }
  .element-choice small {
    margin-top: 8px;
  }
  .element-choice p {
    min-height: 0;
  }
  .onboarding {
    padding: 25px;
  }
  .intro h2 {
    font-size: 34px;
  }
  .intro {
    margin-bottom: 18px !important;
  }
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  }
}
@media (max-width: 760px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 12px 14px 0;
    gap: 8px;
  }
  .brand {
    flex: 1;
  }
  .brand h1 {
    font-size: 23px;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    height: 45px;
    overflow: auto;
  }
  .topbar nav button {
    white-space: nowrap;
    flex: 1;
  }
  .top-stats {
    font-size: 10px;
  }
  .layout {
    display: flex;
    flex-direction: column;
  }
  .sidebar.left {
    display: none;
  }
  .region-heading {
    padding: 18px;
  }
  .region-heading h2 {
    font-size: 26px;
  }
  .world-wrap {
    min-height: 340px;
  }
  .world-wrap canvas {
    min-width: 650px;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
  }
  .world-controls {
    padding: 12px;
    flex-wrap: wrap;
  }
  .world-controls p {
    font-size: 9px;
  }
  .map-caption {
    display: none;
  }
  .overlay {
    padding: 10px;
  }
  .dialog {
    padding: 20px;
    max-height: 95vh;
  }
  .dialog-header h2 {
    font-size: 26px;
  }
  .elements {
    gap: 7px;
  }
  .element-choice h3 {
    font-size: 15px;
  }
  .element-choice p {
    font-size: 8px;
  }
  .element-choice small {
    font-size: 8px;
  }
  .intro h2 {
    font-size: 27px;
  }
  .intro p {
    font-size: 12px;
  }
  .intro-bottom {
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
  }
  .intro-bottom p {
    text-align: center;
  }
  .deck-editor {
    grid-template-columns: 1fr;
  }
  .deck-list {
    position: static;
  }
  .deck-rows {
    max-height: 150px;
    overflow: auto;
  }
  .implement-grid,
  .cosmetic-grid,
  .journal-grid,
  .help-grid {
    grid-template-columns: 1fr 1fr;
  }
  .equipment-card {
    padding: 14px;
  }
  .equipment-card h3 {
    font-size: 16px;
  }
  .equipment-card p {
    font-size: 11px;
    min-height: 0;
  }
  .battle {
    padding: 15px 8px;
  }
  .battle-top {
    gap: 8px;
  }
  .battle-stats {
    font-size: 9px;
    gap: 7px;
  }
  .duelist h2 {
    font-size: 19px;
  }
  .duelist .life {
    width: 43px;
    height: 43px;
    font-size: 23px;
  }
  .board {
    gap: 5px;
    min-height: 150px;
    padding: 6px;
  }
  .unit {
    width: calc(100% / 6);
    min-width: 45px;
  }
  .unit img {
    height: 50px;
  }
  .unit-name {
    font-size: 9px;
  }
  .unit-stats {
    padding: 4px;
    font-size: 12px;
  }
  .unit-label {
    font-size: 7px;
  }
  .hand {
    gap: 7px;
  }
  .hand .card-wrap {
    width: 125px;
  }
  .hand .card img {
    height: 65px;
  }
  .phase-banner {
    padding: 10px;
  }
  .phase-banner h3 {
    font-size: 17px;
  }
  .phase-banner p {
    font-size: 10px;
  }
  .phase-banner button {
    padding: 10px;
    font-size: 10px;
  }
  .combat-log {
    display: none;
  }
  footer {
    font-size: 8px;
    line-height: 1.6;
    padding: 10px;
  }
  .weather {
    font-size: 9px;
  }
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dialog.narrow {
    width: 100%;
  }
}

/* The adventure stays within the viewport; long journals and sidebars scroll independently. */
@media (min-width: 761px) {
  .layout {
    height: calc(100vh - 116px);
    min-height: 0;
  }
  .sidebar {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #586b4b transparent;
  }
  .world-wrap {
    min-height: 0;
    justify-content: center;
  }
  .world-wrap canvas {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1000/620;
  }
  .region-heading {
    flex-shrink: 0;
  }
  .world-controls {
    flex-shrink: 0;
  }
  .main {
    min-height: 0;
  }
  .map-caption {
    left: 20px;
    bottom: 14px;
  }
  .map-caption p {
    font-size: 14px;
  }
  .sidebar.right .mini-card {
    width: 130px;
  }
  .sidebar.right .divider {
    margin: 16px 0;
  }
}
@media (min-width: 1151px) and (max-width: 1350px) {
  .layout {
    grid-template-columns: 200px minmax(400px, 1fr) 200px;
  }
  .sidebar {
    padding: 20px 17px;
  }
  .region-heading {
    padding: 20px;
  }
  .world-controls {
    padding: 12px 16px;
  }
}
.enemy-hand {
  display: flex;
  gap: 3px;
  margin-left: 15px;
}
.card-back {
  width: 23px;
  height: 34px;
  border: 2px double #a7b88c;
  background: repeating-linear-gradient(45deg, #14281f, #14281f 4px, #344a37 5px, #344a37 6px);
  display: grid;
  place-items: center;
  color: #c8d3a5;
  font-size: 12px;
}
.card-back.fern {
  border-color: #8caa72;
  color: #8caa72;
}
.impact {
  position: fixed;
  z-index: 45;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 18px 35px;
  color: #f6dfa7;
  background: #15291ee8;
  border: 1px solid #cdb270;
  font-size: 25px;
  pointer-events: none;
  animation: impact 0.8s both;
}
.unit {
  animation: arrive 0.25s ease-out;
}
@keyframes arrive {
  from {
    opacity: 0.5;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes impact {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@media (min-width: 761px) and (max-height: 820px) {
  .in-battle .topbar {
    height: 60px;
  }
  .battle {
    padding: 12px 20px;
    gap: 8px;
    min-height: calc(100vh - 95px);
  }
  .battle .duelist .life {
    height: 42px;
    width: 42px;
    font-size: 23px;
  }
  .battle .duelist h2 {
    font-size: 20px;
  }
  .battle .board {
    min-height: 106px;
    padding: 5px;
  }
  .battle .unit img {
    height: 40px;
  }
  .battle .unit-name {
    padding: 4px;
    font-size: 10px;
  }
  .battle .unit-stats {
    padding: 3px 8px;
    font-size: 12px;
  }
  .battle .unit-label {
    padding: 3px;
    font-size: 8px;
  }
  .battle .phase-banner {
    padding: 9px 12px;
  }
  .battle .phase-banner h3 {
    font-size: 18px;
  }
  .battle .phase-banner p {
    font-size: 10px;
  }
  .battle .hand .card img {
    height: 50px;
  }
  .battle .hand .card-text {
    font-size: 10px;
    min-height: 41px;
    padding: 5px 6px;
  }
  .battle .hand .card-top {
    padding: 5px;
  }
  .battle .hand .card-bottom {
    padding: 4px 6px;
    font-size: 11px;
  }
  .battle .hand .card-type {
    padding: 4px 6px;
  }
  .battle .hand .card .cost {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }
  .battle .hand {
    gap: 8px;
  }
  .battle .hand .card-wrap {
    width: 140px;
  }
}
.mobile-status {
  display: none;
}
@media (max-width: 760px) {
  .topbar .brand {
    min-width: 0;
  }
  .topbar .brand .eyebrow {
    font-size: 6px;
    letter-spacing: 1.2px;
  }
  .topbar .top-stats {
    gap: 5px;
  }
  .topbar .top-stats .small {
    padding: 5px;
    font-size: 9px;
  }
  .topbar nav {
    flex: 0 0 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: auto;
    overflow: visible;
  }
  .topbar nav button {
    padding: 10px 4px;
    font-size: 10px;
  }
  .mobile-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    font:
      11px system-ui,
      sans-serif;
    color: var(--muted);
  }
  .mobile-status button {
    padding: 4px 8px;
    font-size: 13px;
  }
}

/* Deliberate card play: inspect, target, commit. */
.hand .card-wrap {
  position: relative;
  z-index: 1;
}
.hand .card-wrap:hover,
.hand .card-wrap:focus-within {
  z-index: 12;
}
.hand .card-wrap.selected {
  z-index: 10;
}
.hand .card {
  transform-origin: center bottom;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
  cursor: pointer;
}
.hand .card-wrap:hover .card,
.hand .card:focus-visible {
  transform: translateY(-16px) scale(1.12);
  filter: brightness(1.12);
  box-shadow:
    0 16px 28px #000b,
    0 0 0 2px #ede0b5;
}
.hand .card-wrap.selected .card {
  transform: translateY(-12px) scale(1.045);
  outline: 2px solid #ffe7a5;
  animation: selected-glow 2s ease-in-out infinite;
}
.hand .card-wrap.selected:hover .card,
.hand .card-wrap.selected .card:focus-visible {
  transform: translateY(-20px) scale(1.12);
}
.hand .card-wrap.selected:after {
  content: 'SELECTED';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  font: 700 8px system-ui;
  letter-spacing: 1.3px;
  color: #183026;
  background: #ffe7a5;
  pointer-events: none;
}
.card .cost {
  background: linear-gradient(135deg, #c5f0ff, #468fb4);
  color: #102e42;
  border: 2px solid #c8ecff;
  box-shadow: 0 1px 7px #0008;
  border-radius: 8px 3px;
}
@keyframes selected-glow {
  0%,
  100% {
    box-shadow:
      0 0 8px #ffdc7a66,
      0 0 22px #ffdc7a25;
  }
  50% {
    box-shadow:
      0 0 15px #ffdc7aaa,
      0 0 36px #ffdc7a55;
  }
}
.unit {
  animation: none;
}
.unit.can-attack {
  box-shadow:
    0 0 0 1px #abd68e66,
    0 0 12px #abd68e22;
}
.unit.can-attack .unit-label {
  color: #d7efb0;
}
.unit.selected {
  animation: selected-glow 2s ease-in-out infinite;
}
.unit.attack-selected {
  border-color: #ff8580;
  outline: 2px solid #ff858077;
  animation: attack-glow 1.8s ease-in-out infinite;
}
.unit.attack-selected .unit-label {
  color: #ffd2c5;
  background: #63312c;
}
.unit.targetable,
.enemy-hero.targetable {
  outline: 2px solid #fce3a0;
  box-shadow: 0 0 18px #fce3a04a;
  cursor: crosshair;
}
.unit.targetable:hover {
  outline-color: #fff6d2;
  transform: translateY(-7px) scale(1.04);
}
.unit.attacking:before {
  color: #fff0e1;
  background: #9c4740;
}
.unit.just-summoned {
  animation: summon-arrival 0.6s ease-out;
}
@keyframes summon-arrival {
  from {
    transform: translateY(20px) scale(0.82);
    filter: brightness(2);
    opacity: 0.4;
  }
  to {
    transform: none;
    filter: none;
    opacity: 1;
  }
}
.enemy-hero {
  display: flex;
  position: relative;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 10px 16px;
  min-width: 370px;
  border: 1px solid #b69a6266;
  background: linear-gradient(115deg, #1e3127, #1a2924);
  border-radius: 8px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.enemy-hero .life {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 47px;
  height: 47px;
  flex-shrink: 0;
  background: #64332e;
  border-color: #c2866f;
  font-size: 26px;
}
.enemy-hero .life small {
  font-size: 10px;
  line-height: 1;
  color: #e6b9a0;
}
.hero-sigil {
  font-size: 31px;
  color: #bfab78;
}
.hero-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hero-info strong {
  font: 24px Georgia;
  color: #e9ddbf;
}
.hero-info small {
  font: 10px system-ui;
  color: var(--muted);
}
.hero-info .eyebrow {
  font-size: 8px;
}
.hero-target-label {
  font: 700 8px system-ui;
  letter-spacing: 0.7px;
  color: #c7b287;
  padding-left: 20px;
  max-width: 125px;
}
.enemy-hero.attack-target {
  border: 2px solid #ff7770;
  outline: 2px solid #ff777030;
  animation: attack-glow 1.8s ease-in-out infinite;
}
.enemy-hero.attack-target:hover {
  background: linear-gradient(115deg, #69352e, #322c25);
}
.enemy-hero.attack-target .hero-target-label {
  color: #ffd1b8;
  font-size: 11px;
}
.attack-banner {
  border-color: #e47e67;
  background: linear-gradient(90deg, #4a3027, #192d23);
}
.attack-banner h3 {
  color: #ffb49b;
}
.attack-button {
  background: #ba5348 !important;
  color: #fff2da !important;
  border-color: #f99780 !important;
}
@keyframes attack-glow {
  0%,
  100% {
    box-shadow: 0 0 10px #ff5b5144;
  }
  50% {
    box-shadow: 0 0 25px #ff5b5177;
  }
}
.own-board.summon-target {
  border: 2px dashed #e1d89b;
  background: radial-gradient(ellipse, #738d4930, #19291e55);
  cursor: pointer;
}
.summon-prompt {
  position: absolute;
  bottom: 2px;
  right: 8px;
  color: #e9deac;
  font: 10px system-ui;
  pointer-events: none;
}
#targeting-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: visible;
  z-index: 40;
  pointer-events: none;
  display: none;
  filter: drop-shadow(0 3px 4px #000a);
}
#targeting-overlay.visible {
  display: block;
}
.aim-line {
  fill: none;
  stroke: #ff6868;
  stroke-width: 7;
  stroke-linecap: round;
}
.aim-shadow {
  fill: none;
  stroke: #5a171de0;
  stroke-width: 12;
  stroke-linecap: round;
}
.mana-panel {
  min-width: 260px;
  padding: 8px 12px;
  border: 1px solid #75b9d44d;
  background: linear-gradient(120deg, #173542, #132b2c);
  border-radius: 7px;
}
.mana-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mana-title {
  font: 700 10px system-ui;
  letter-spacing: 1.8px;
  color: #b4e3ff;
}
.mana-heading strong {
  font: 700 22px Georgia;
  color: #e1f6ff;
  line-height: 1;
}
.mana-heading strong span {
  font-size: 14px;
  color: #8bafc0;
}
.mana-preview {
  font: 10px system-ui;
  color: #f1d6a4;
  margin-left: auto;
}
.mana-crystals {
  display: flex;
  gap: 5px;
  margin: 5px 0;
}
.mana-crystal {
  width: 23px;
  height: 27px;
  position: relative;
  display: block;
}
.mana-crystal svg {
  width: 100%;
  height: 100%;
  fill: #63c7ef;
  stroke: #b4ecff;
  stroke-width: 1.2px;
}
.mana-crystal .facet {
  fill: #b3eaff55;
  stroke: #ddf7ff66;
  stroke-width: 0.65px;
}
.mana-crystal.available {
  filter: drop-shadow(0 0 4px #6ccaff66);
}
.mana-crystal.spent svg {
  fill: #233b47;
  stroke: #577382;
}
.mana-crystal.spent .facet {
  fill: transparent;
}
.mana-crystal.next svg {
  fill: #18404b;
  stroke: #71c7dc;
  stroke-dasharray: 3 2;
}
.mana-crystal.locked svg {
  fill: #172b32;
  stroke: #3a515a;
}
.mana-crystal.locked .facet,
.mana-crystal.next .facet {
  fill: transparent;
  stroke: transparent;
}
.mana-crystal b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #bceaff;
  font: 18px system-ui;
}
.mana-crystal.locked b {
  color: #59717c;
}
.mana-crystal.will-spend {
  filter: drop-shadow(0 0 5px #ffcb7580);
}
.mana-crystal.will-spend svg {
  fill: #e3bd70;
  stroke: #ffe8af;
}
.mana-panel > small {
  display: block;
  color: #a6c9d4;
  font: 9px system-ui;
}
.new-crystal {
  animation: crystal-grow 0.8s ease-out;
}
@keyframes crystal-grow {
  from {
    transform: scale(0.45);
    filter: brightness(3);
  }
  60% {
    transform: scale(1.25);
  }
  to {
    transform: scale(1);
  }
}
.combat-log {
  max-width: 330px;
  height: 60px;
  font-size: 10px;
  line-height: 1.5;
}
.combat-log strong {
  font-weight: 500;
  color: #ead4a4;
}
.combat-number {
  position: fixed;
  z-index: 45;
  pointer-events: none;
  font: 800 38px Georgia;
  color: #ff9a83;
  text-shadow:
    0 2px 2px #280b0b,
    0 0 10px #280b0b;
  animation: combat-float 1.2s ease-out forwards;
}
.combat-number.healing {
  color: #b4f5a6;
}
@keyframes combat-float {
  from {
    opacity: 1;
    transform: translate(-50%, -30%) scale(1.3);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -150%) scale(0.9);
  }
}
@media (min-width: 761px) and (max-height: 820px) {
  .enemy-hero {
    padding: 6px 12px;
  }
  .hero-info strong {
    font-size: 20px;
  }
  .mana-panel {
    padding: 5px 10px;
  }
  .mana-crystal {
    width: 20px;
    height: 23px;
  }
  .mana-heading strong {
    font-size: 19px;
  }
  .battle-bottom .duelist h2 {
    font-size: 18px;
  }
  .battle-bottom .duelist > div > small {
    font-size: 9px;
  }
  .phase-banner p {
    max-width: 700px;
  }
}
@media (max-width: 760px) {
  .battle-top {
    flex-wrap: wrap;
  }
  .enemy-hero {
    min-width: 0;
    width: 100%;
    gap: 8px;
    padding: 8px;
  }
  .hero-info strong {
    font-size: 20px;
  }
  .hero-sigil {
    display: none;
  }
  .hero-target-label {
    padding-left: 3px;
    font-size: 7px;
    max-width: 85px;
  }
  .battle-bottom {
    flex-wrap: wrap;
  }
  .mana-panel {
    min-width: 250px;
    flex: 1;
  }
  .combat-log {
    max-width: 100%;
    width: 100%;
    height: 40px;
    text-align: left;
  }
  .hand .card-wrap:hover .card,
  .hand .card:focus-visible {
    transform: translateY(-10px) scale(1.06);
  }
  .board {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hand .card,
  .unit,
  .enemy-hero,
  .mana-crystal,
  .combat-number {
    animation: none !important;
    transition: none !important;
  }
}
.unit:hover {
  transform: translateY(-5px) scale(1.035);
  z-index: 3;
}
@media (min-width: 761px) and (max-height: 820px) {
  .battle {
    gap: 6px;
    padding: 8px 20px;
  }
  .battle .board {
    min-height: 96px;
    padding: 4px;
  }
  .battle .unit img {
    height: 34px;
  }
  .battle .unit-name {
    padding: 3px 4px;
  }
  .battle .unit-label {
    padding: 2px;
  }
  .battle .phase-banner {
    padding: 7px 12px;
  }
  .battle .hand .card img {
    height: 46px;
  }
  .battle .hand .card-text {
    min-height: 37px;
  }
  .battle .hand .card-type {
    padding: 3px 6px;
  }
  .battle .hand .card-bottom {
    padding: 3px 6px;
  }
  .mana-panel {
    padding: 5px 10px;
  }
  .mana-crystals {
    margin: 3px 0;
  }
  .mana-heading strong {
    font-size: 17px;
  }
  .mana-crystal {
    height: 21px;
  }
  .battle > p.muted {
    line-height: 1.1;
    font-size: 10px !important;
  }
}
@media (max-width: 760px) {
  .battle .unit {
    width: 100px;
    flex: 0 0 100px;
  }
  .battle .phase-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .battle .phase-banner > .row {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .battle .phase-banner button {
    white-space: nowrap;
  }
}
/* A compact, read-only record of public combat history. */
.graveyard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 20px;
}
.graveyard-summary {
  color: #c8b9a8;
  font-size: 13px;
  line-height: 1.5;
  margin: 10px 0 16px;
}
.graveyard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.graveyard-entry {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #24212b;
  border: 1px solid #51434d;
  border-left: 3px solid var(--element);
  border-radius: 5px;
}
.graveyard-entry img {
  object-fit: cover;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.graveyard-entry strong {
  font-size: 15px;
}
.graveyard-entry small {
  display: block;
  font: 11px/1.5 system-ui;
  margin: 4px 0;
  color: #bdb3ac;
}
.graveyard-entry p {
  font: 12px/1.5 system-ui;
  margin: 0;
  color: #ddd0c0;
}
.graveyard-entry.revive-candidate {
  background: #34283e;
  border-color: #b490ca;
}
.revive-tag {
  display: block;
  color: #dfb8f0;
  font: 10px/1.5 system-ui;
  margin-top: 8px;
  letter-spacing: 0.5px;
}
@media (max-width: 680px) {
  .graveyard-grid {
    grid-template-columns: 1fr;
  }
}
