@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=DM+Sans:wght@400;500;700&display=swap');

:root {
  color-scheme: dark;
  --gold: #e8be65;
  --gold-light: #ffe9a8;
  --ink: #e9e6d7;
  --panel: rgba(13, 22, 24, .91);
  --line: rgba(233, 199, 112, .32);
  --green: #83c490;
  font-family: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #071014;
}

button, kbd { font: inherit; }
button { color: inherit; }

#game-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #0a1718;
  isolation: isolate;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background:
    linear-gradient(180deg, rgba(2, 8, 10, .34), transparent 14%, transparent 82%, rgba(2, 6, 8, .48)),
    radial-gradient(ellipse at center, transparent 46%, rgba(0, 5, 7, .5) 120%);
}

.hidden { display: none !important; }

.hud {
  position: absolute;
  z-index: 10;
  top: max(18px, env(safe-area-inset-top));
  left: 22px;
  right: 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  pointer-events: none;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .4));
}

.realm-card, .time-card, .resources, .panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(19, 34, 35, .92), rgba(9, 20, 22, .91));
  box-shadow: inset 0 1px rgba(255,255,255,.06), 0 10px 25px rgba(0,0,0,.22);
  backdrop-filter: blur(9px);
}

.realm-card {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 15px 8px 9px;
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 50%, calc(100% - 13px) 100%, 0 100%);
}

.crest {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #2c2312;
  background: radial-gradient(circle at 35% 30%, #fff3bd, var(--gold) 56%, #8c6428);
  border: 2px solid #f8dea0;
  border-radius: 50%;
  font-size: 23px;
}

.eyebrow, .time-card small, .panel-title, .speaker-row small, .council header small {
  letter-spacing: .18em;
  font-size: 8px;
  color: #aebbb4;
  font-weight: 700;
}

.realm-name {
  font-family: Cinzel, Georgia, serif;
  letter-spacing: .1em;
  font-size: 16px;
  color: #fff6d8;
}

.resources {
  display: flex;
  border-radius: 4px 4px 12px 12px;
  overflow: hidden;
}

.resource {
  min-width: 75px;
  height: 49px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-right: 1px solid rgba(255,255,255,.08);
  transition: color .2s;
}

.resource:last-child { border: 0; }
.resource b { font-family: Cinzel, serif; font-size: 15px; color: #f8f2dc; }
.resource.wide { min-width: 136px; }

.resource-icon {
  font-size: 15px;
  filter: drop-shadow(0 0 6px currentColor);
}

.coin { color: #f1c65c; }
.food { color: #d97850; transform: rotate(45deg); }
.wood { color: #b4845b; }
.heart { color: #e78381; }

.morale-track {
  width: 45px;
  height: 5px;
  border-radius: 9px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
}

.morale-track i {
  display: block;
  width: 62%;
  height: 100%;
  background: linear-gradient(90deg, #e08377, #f5b48f);
  box-shadow: 0 0 8px #e89279;
  transition: width .5s ease;
}

.time-card {
  justify-self: end;
  padding: 8px 15px;
  min-width: 140px;
  text-align: right;
  border-radius: 3px;
}

.time-card > div {
  font-family: Cinzel, serif;
  color: #fff3ce;
  font-size: 17px;
}

.time-card small { display: block; margin-top: 2px; color: #9aaba4; }

.panel {
  position: absolute;
  z-index: 9;
  top: 88px;
  left: 22px;
  width: min(280px, calc(100vw - 44px));
  padding: 13px;
  border-radius: 3px 12px 12px 3px;
  pointer-events: none;
}

.panel-title {
  color: #d8c58e;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding-bottom: 9px;
  margin-bottom: 8px;
}

.panel-title span { color: #eac662; }

.objective {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  align-items: start;
  padding: 5px 0;
  font-size: 12px;
  color: #ccd3cc;
}

.objective i {
  width: 15px;
  height: 15px;
  border: 1px solid #6d8077;
  border-radius: 50%;
  position: relative;
}

.objective.done { color: #829087; text-decoration: line-through; }
.objective.done i { background: #77b988; border-color: #99d2a5; }
.objective.done i::after { content: "✓"; position: absolute; left: 2px; top: -2px; color: #102219; font-weight: 800; font-size: 11px; }

.quick-menu {
  position: absolute;
  z-index: 12;
  left: 22px;
  top: 278px;
  display: flex;
  gap: 7px;
}

.quick-menu button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 96px;
  padding: 6px 9px 6px 6px;
  border: 1px solid rgba(224, 195, 112, .28);
  border-radius: 4px;
  color: #cbd4cd;
  background: rgba(9, 20, 22, .86);
  box-shadow: 0 7px 18px rgba(0,0,0,.2);
  cursor: pointer;
}

.quick-menu button:hover { border-color: rgba(239, 207, 119, .62); color: #fff0be; }
.quick-menu button b { display: grid; place-items: center; width: 24px; height: 24px; color: #2c2413; background: linear-gradient(#f0d58b,#bd9848); border-radius: 3px; font: 700 11px Cinzel,serif; }
.quick-menu button span { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.quick-menu button i { position: absolute; right: -5px; top: -6px; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; color: #fff4cc; background: #8e4d42; font-style: normal; font-size: 8px; }

.archive-overlay {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 11, 13, .56);
  backdrop-filter: blur(5px);
}

.archive-card {
  width: min(760px, calc(100vw - 36px));
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(230, 199, 112, .42);
  border-radius: 6px;
  color: #dce1da;
  background:
    linear-gradient(135deg, rgba(229,194,104,.05), transparent 32%),
    rgba(10, 23, 25, .97);
  box-shadow: 0 28px 80px rgba(0,0,0,.56), inset 0 0 50px rgba(232,199,110,.025);
}

.archive-card header { display: flex; justify-content: space-between; align-items: start; border-bottom: 1px solid rgba(255,255,255,.08); padding-bottom: 15px; }
.archive-card header small { color: #d1b768; letter-spacing: .16em; font-size: 8px; }
.archive-card h2 { margin: 4px 0 0; color: #f1e2b5; font: 600 25px Cinzel,serif; }
.archive-card header button { width: 30px; height: 30px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; color: #aebbb4; background: rgba(0,0,0,.2); cursor: pointer; }
.archive-intro { margin: 12px 0 18px; color: #8fa198; font-size: 11px; }
.archive-card footer { margin-top: 15px; color: #71857b; font-size: 9px; text-align: right; }
.archive-card footer kbd { min-width: 22px; height: 22px; margin-right: 5px; font-size: 9px; }

.quest-list { display: grid; gap: 10px; }
.quest-entry { position: relative; padding: 15px 16px 14px 48px; border: 1px solid rgba(255,255,255,.09); border-radius: 4px; background: rgba(255,255,255,.025); }
.quest-entry::before { content: "◇"; position: absolute; left: 17px; top: 18px; color: #d7b85e; font-size: 19px; }
.quest-entry.main::before { content: "♛"; }
.quest-entry.completed { opacity: .66; }
.quest-entry.completed::before { content: "✓"; color: #7fc493; }
.quest-entry .quest-heading { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.quest-entry h3 { margin: 0; color: #ead79d; font: 600 14px Cinzel,serif; }
.quest-entry .quest-category { color: #799087; font-size: 8px; letter-spacing: .12em; }
.quest-entry p { margin: 7px 0; color: #aab8b0; font-size: 11px; line-height: 1.45; }
.quest-step { display: flex; justify-content: space-between; gap: 14px; color: #e6e3d8; font-size: 11px; }
.quest-step b { color: #d6b761; font-weight: 500; }
.quest-progress { height: 3px; margin-top: 10px; overflow: hidden; border-radius: 3px; background: rgba(255,255,255,.07); }
.quest-progress i { display: block; height: 100%; background: linear-gradient(90deg,#8bad70,#dfbd69); }

.inventory-summary { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; color: #81958b; font-size: 9px; }
.inventory-summary b { color: #e7cd84; }
.tool-list { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-bottom: 16px; }
.tool-entry, .item-entry { border: 1px solid rgba(255,255,255,.09); border-radius: 4px; background: rgba(255,255,255,.025); }
.tool-entry { min-height: 82px; padding: 12px; display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; }
.tool-entry.empty { opacity: .45; }
.tool-entry .item-icon, .item-entry .item-icon { font-size: 27px; filter: drop-shadow(0 4px 5px rgba(0,0,0,.35)); }
.tool-entry small, .item-entry small { display: block; color: #71877d; font-size: 7px; letter-spacing: .12em; }
.tool-entry b, .item-entry b { display: block; margin: 3px 0; color: #e6d49d; font: 600 10px Cinzel,serif; }
.tool-entry p, .item-entry p { margin: 0; color: #94a59c; font-size: 8px; line-height: 1.35; }
.inventory-list { display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; }
.item-entry { position: relative; min-height: 104px; padding: 12px; }
.item-entry .quantity { position: absolute; right: 9px; top: 9px; color: #fff0bd; font: 700 11px Cinzel,serif; }
.inventory-empty { grid-column: 1/-1; padding: 34px; border: 1px dashed rgba(255,255,255,.11); color: #71847b; text-align: center; font-size: 10px; }

#hint {
  position: absolute;
  z-index: 11;
  left: 50%;
  bottom: 53px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 16px 8px 8px;
  background: rgba(7, 16, 18, .88);
  border: 1px solid rgba(237, 208, 129, .45);
  border-radius: 5px;
  box-shadow: 0 8px 25px rgba(0,0,0,.38);
  pointer-events: none;
  animation: hintIn .22s ease-out;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  color: #282011;
  background: linear-gradient(#fff1bb, #d6ad5b);
  border: 1px solid #fff0b5;
  border-bottom: 3px solid #8e692f;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(231, 190, 95, .2);
}

#hint div { display: flex; flex-direction: column; }
#hint small { color: #9aaaa2; font-size: 8px; letter-spacing: .14em; }
#hint strong { color: #f3ead0; font-size: 12px; white-space: nowrap; }

#toast-area {
  position: absolute;
  z-index: 30;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.toast {
  color: #f7edd3;
  background: rgba(12, 23, 24, .92);
  border: 1px solid rgba(238, 201, 108, .38);
  border-radius: 3px;
  padding: 8px 15px;
  font-size: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,.32);
  animation: toast 2.7s forwards;
}

.toast.good { color: #bdebc6; border-color: rgba(126, 212, 148, .4); }
.toast.bad { color: #f3aca5; border-color: rgba(220, 108, 100, .4); }

.modal {
  position: absolute;
  z-index: 40;
  left: 50%;
  bottom: 35px;
  transform: translateX(-50%);
  width: min(780px, calc(100vw - 34px));
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(26, 40, 39, .98), rgba(8, 18, 21, .98));
  border: 1px solid rgba(232, 197, 109, .47);
  box-shadow: 0 24px 70px rgba(0,0,0,.6), inset 0 1px rgba(255,255,255,.08);
  border-radius: 5px;
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 17px;
}

.modal::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(235, 201, 117, .1);
  pointer-events: none;
}

.portrait {
  min-height: 125px;
  border: 1px solid rgba(235, 201, 117, .3);
  background:
    radial-gradient(circle at 52% 40%, rgba(246, 218, 144, .32), transparent 44%),
    linear-gradient(155deg, #35584e, #14282a);
  display: grid;
  place-items: center;
  overflow: hidden;
}

#portrait-emoji {
  font-size: 62px;
  filter: drop-shadow(0 8px 7px rgba(0,0,0,.35));
  transform: scale(1.16);
}

.dialogue-main { position: relative; z-index: 1; }
.speaker-row { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.1); padding-bottom: 8px; }
.speaker-row > div { display: flex; align-items: baseline; gap: 10px; }
.speaker-row strong { font-family: Cinzel, serif; letter-spacing: .12em; color: #f1d894; }
.speaker-row small { color: #8da199; }

.speaker-row button, .council header button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.2);
  color: #aab7b0;
  cursor: pointer;
}

#dialogue-text { min-height: 43px; color: #e1e4dc; font-size: 14px; line-height: 1.55; margin: 11px 0; }
#dialogue-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.choice, .council button.edict, .report-card button, .ending-card button, .season-card button {
  position: relative;
  border: 1px solid rgba(232, 194, 100, .35);
  background: rgba(231, 196, 109, .06);
  padding: 9px 13px;
  color: #eee6d2;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: .18s ease;
}

.choice:hover, .choice:focus-visible, .council button.edict:hover, .report-card button:hover, .ending-card button:hover, .season-card button:hover {
  color: #fff2c7;
  border-color: #e4bc60;
  background: rgba(231, 196, 109, .14);
  transform: translateY(-1px);
}

.choice.cost { color: #d9bc72; }
.choice:disabled, .edict:disabled { opacity: .38; cursor: not-allowed; transform: none; }

.council {
  display: block;
  width: min(680px, calc(100vw - 34px));
  bottom: 50%;
  transform: translate(-50%, 50%);
  padding: 22px 24px;
}

.council header { display: flex; justify-content: space-between; align-items: start; position: relative; z-index: 1; }
.council header small { color: #d3b763; }
.council h2 { margin: 3px 0 0; font: 600 25px Cinzel, serif; color: #f5e7bc; }
.council-intro { color: #9eafa7; font-size: 12px; margin: 10px 0 15px; }
#edict-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; position: relative; z-index: 1; }

.council button.edict {
  min-height: 145px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.edict .edict-icon { font-size: 26px; }
.edict b { font: 600 13px Cinzel, serif; color: #f1d98f; }
.edict p { margin: 0; color: #b8c3bc; font-size: 11px; line-height: 1.4; }
.edict em { margin-top: auto; font-style: normal; font-size: 10px; color: #8fc09a; }
.council footer { display: flex; justify-content: space-between; align-items: center; color: #70847b; font-size: 10px; margin-top: 13px; }
.council footer kbd { min-width: 24px; height: 24px; }

#start-screen, .overlay {
  position: absolute;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(3, 10, 13, .1), rgba(3, 9, 11, .48)),
    radial-gradient(circle at 50% 60%, transparent 0, rgba(2, 8, 10, .18) 50%, rgba(2, 6, 8, .75) 100%);
  overflow: hidden;
}

#start-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(2,7,9,.8), transparent 26%, transparent 74%, rgba(2,7,9,.8)),
    linear-gradient(to bottom, rgba(2,7,9,.75), transparent 24%, transparent 72%, rgba(2,7,9,.85));
}

.start-content {
  position: relative;
  z-index: 3;
  width: min(680px, 92vw);
  text-align: center;
  animation: rise .8s cubic-bezier(.2,.8,.2,1);
}

.royal-mark {
  margin: 0 auto 12px;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  font-size: 34px;
  color: var(--gold-light);
  border: 1px solid rgba(240, 207, 119, .5);
  transform: rotate(45deg);
  background: rgba(17, 29, 28, .62);
  box-shadow: 0 0 45px rgba(235, 190, 82, .19);
}

.royal-mark span { display: block; transform: rotate(-45deg); }

.title-rule { display: flex; align-items: center; justify-content: center; gap: 12px; }
.title-rule span { width: 74px; height: 1px; background: linear-gradient(90deg, transparent, #d6b65f); }
.title-rule span:last-child { transform: scaleX(-1); }
.title-rule b { font-size: 9px; letter-spacing: .28em; color: #d2ba75; }

h1 {
  font: 600 clamp(46px, 8vw, 84px)/.88 Cinzel, Georgia, serif;
  letter-spacing: .07em;
  margin: 15px 0 20px;
  color: #f7eed4;
  text-shadow: 0 4px 0 rgba(0,0,0,.2), 0 0 42px rgba(242, 211, 128, .14);
}

h1 em { color: #e5bc61; font-style: normal; font-size: .66em; letter-spacing: .14em; }
.start-content > p { color: #bec8c1; font-family: Georgia, serif; font-style: italic; font-size: 16px; }

.start-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 28px auto 19px;
}

.start-game-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 260px;
  padding: 12px 24px 10px;
  border: 1px solid #ecc96f;
  outline: 1px solid rgba(236, 201, 111, .18);
  outline-offset: 4px;
  color: #261f12;
  background: linear-gradient(110deg, #b98939, #f2d57f 48%, #bd8b36);
  box-shadow: 0 12px 34px rgba(0,0,0,.36), 0 0 32px rgba(238, 201, 102, .12);
  cursor: pointer;
  transition: .2s ease;
}

.start-game-button:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(0,0,0,.45), 0 0 38px rgba(238, 201, 102, .2); }
.start-game-button span { font: 700 12px Cinzel, serif; letter-spacing: .13em; }
.start-game-button small { font-size: 8px; opacity: .68; margin-top: 2px; }

#start-button.secondary {
  color: #dfc982;
  background: rgba(12, 25, 25, .74);
  border-color: rgba(224, 193, 107, .5);
  box-shadow: 0 10px 26px rgba(0,0,0,.3);
}

#continue-button {
  color: #17231d;
  background: linear-gradient(110deg, #76a96f, #d9d68a 48%, #6d9c68);
  border-color: #e5dfa0;
}

.chronicles-button {
  border: 0;
  border-bottom: 1px solid rgba(226, 196, 112, .38);
  padding: 5px 2px;
  color: #bca96f;
  background: transparent;
  font: 700 9px Cinzel, serif;
  letter-spacing: .15em;
  cursor: pointer;
}

.chronicles-button:hover { color: #f1d78d; border-color: #e5c36c; }

.controls-line {
  display: flex;
  justify-content: center;
  gap: 23px;
  color: #738a81;
  font-size: 9px;
  letter-spacing: .04em;
}

.controls-line kbd { min-width: auto; height: 19px; padding: 0 5px; font-size: 8px; border-bottom-width: 2px; margin-right: 3px; }

.start-sky { position: absolute; inset: 0; pointer-events: none; }
.start-sky i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e5c86f;
  box-shadow: 0 0 13px 4px rgba(223, 190, 88, .55);
  animation: firefly 4s ease-in-out infinite;
}
.start-sky i:nth-child(1) { left: 10%; top: 32%; animation-delay: -.2s; }
.start-sky i:nth-child(2) { left: 18%; top: 62%; animation-delay: -2.4s; }
.start-sky i:nth-child(3) { left: 27%; top: 20%; animation-delay: -1.1s; }
.start-sky i:nth-child(4) { left: 38%; top: 78%; animation-delay: -3.2s; }
.start-sky i:nth-child(5) { left: 65%; top: 19%; animation-delay: -2s; }
.start-sky i:nth-child(6) { left: 74%; top: 69%; animation-delay: -.8s; }
.start-sky i:nth-child(7) { left: 87%; top: 37%; animation-delay: -3.4s; }
.start-sky i:nth-child(8) { left: 91%; top: 76%; animation-delay: -1.8s; }
.start-sky i:nth-child(9) { left: 53%; top: 87%; animation-delay: -2.7s; }

.back-link {
  position: absolute;
  z-index: 5;
  top: max(20px, env(safe-area-inset-top));
  left: 22px;
  color: #9baaa3;
  font-size: 11px;
  text-decoration: none;
  letter-spacing: .07em;
}
.back-link:hover { color: #f1d68d; }

.overlay {
  z-index: 80;
  background: rgba(3, 9, 12, .72);
  backdrop-filter: blur(7px);
}

#save-manager { z-index: 140; }

.save-manager-card {
  width: min(850px, calc(100vw - 34px));
  max-height: min(720px, calc(100vh - 34px));
  overflow: auto;
  padding: 26px;
  border: 1px solid rgba(234, 201, 113, .46);
  background: linear-gradient(155deg, rgba(24, 39, 39, .99), rgba(7, 17, 20, .995));
  box-shadow: 0 30px 90px #000c;
}

.save-manager-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.save-manager-card small { color: #d6b963; font-size: 9px; letter-spacing: .2em; }
.save-manager-card h2 { margin: 4px 0 0; color: #f5e8bf; font: 600 28px Cinzel, serif; }
.save-manager-card > p { margin: 9px 0 20px; color: #93a49c; font-size: 12px; }

#save-manager-close {
  width: 31px;
  height: 31px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  color: #b7c1bb;
  background: rgba(0,0,0,.22);
  cursor: pointer;
}

#save-slot-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.save-slot {
  min-height: 220px;
  padding: 16px;
  border: 1px solid rgba(232, 197, 109, .24);
  background: rgba(230, 197, 111, .035);
  display: flex;
  flex-direction: column;
}

.save-slot.active { border-color: rgba(129, 198, 142, .55); box-shadow: inset 0 0 24px rgba(95, 165, 112, .07); }
.save-slot.corrupt { border-color: rgba(220, 108, 100, .52); }
.save-slot-number { color: #d8bd72; font: 700 10px Cinzel, serif; letter-spacing: .16em; }
.save-slot h3 { margin: 13px 0 4px; color: #f0e5c9; font: 600 16px Cinzel, serif; }
.save-slot-meta { color: #96a79f; font-size: 11px; line-height: 1.55; }
.save-slot-empty { margin: auto 0; color: #70827a; font: italic 13px Georgia, serif; }
.save-slot-actions { margin-top: auto; padding-top: 15px; display: flex; flex-wrap: wrap; gap: 6px; }

.save-slot-actions button {
  border: 1px solid rgba(232, 194, 100, .3);
  padding: 7px 9px;
  color: #ded7c3;
  background: rgba(231, 196, 109, .06);
  font-size: 9px;
  cursor: pointer;
}

.save-slot-actions button.primary { color: #e9d58e; border-color: rgba(232, 194, 100, .55); }
.save-slot-actions button.danger { color: #dca8a1; border-color: rgba(210, 111, 101, .32); }
.save-slot-actions button:hover { background: rgba(231, 196, 109, .14); }

.report-card, .ending-card, .season-card {
  position: relative;
  width: min(590px, calc(100vw - 34px));
  padding: 30px;
  border: 1px solid rgba(234, 201, 113, .4);
  background: linear-gradient(155deg, rgba(24, 39, 39, .98), rgba(7, 17, 20, .99));
  box-shadow: 0 30px 90px #000a;
  text-align: center;
}

.report-card small, .ending-card > small, .season-card > small { letter-spacing: .2em; font-size: 9px; color: #d6b963; }
.report-card h2, .ending-card h2, .season-card h2 { margin: 8px 0 18px; font: 600 27px Cinzel, serif; color: #f5e8bf; }
.report-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid rgba(255,255,255,.1); margin: 15px 0; }
.report-stats div { padding: 14px 5px; border-right: 1px solid rgba(255,255,255,.1); }
.report-stats div:last-child { border: 0; }
.report-stats span { display: block; color: #7e9188; font-size: 8px; letter-spacing: .13em; }
.report-stats b { font: 600 20px Cinzel, serif; color: #a9d5af; }
.report-card p, .ending-card p, .season-card p { color: #b9c4bd; line-height: 1.55; font-family: Georgia, serif; font-style: italic; }
.report-card button, .ending-card button, .season-card button { margin-top: 12px; text-align: center; font-family: Cinzel, serif; letter-spacing: .08em; }

.season-card {
  text-align: center;
  overflow: hidden;
}

.season-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle, rgba(233, 200, 108, .09), transparent 55%);
  animation: seasonGlow 5s ease-in-out infinite;
  pointer-events: none;
}

.season-icon {
  position: relative;
  margin: 0 auto 13px;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(235, 204, 122, .45);
  border-radius: 50%;
  color: #f0cf76;
  font-size: 36px;
  box-shadow: 0 0 40px rgba(230, 194, 101, .14);
}

.season-card > * { position: relative; }

@keyframes seasonGlow {
  50% { transform: scale(1.1); opacity: .65; }
}

.ending-crown { color: #f0ca68; font-size: 48px; filter: drop-shadow(0 0 22px rgba(241, 197, 90, .35)); }
#ending-score { display: inline-block; margin: 4px auto 12px; padding: 8px 16px; color: #e8ca77; border-block: 1px solid rgba(232, 202, 119, .25); font: 600 13px Cinzel, serif; }

#sound-toggle {
  position: absolute;
  z-index: 30;
  right: 22px;
  bottom: 20px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  background: rgba(8,18,20,.65);
  cursor: pointer;
  color: #c6d3cc;
}
#sound-toggle.muted { color: #66766e; }

#mobile-controls { display: none; }

@keyframes firefly {
  0%,100% { opacity: .15; transform: translate(0,0) scale(.7); }
  35% { opacity: 1; transform: translate(13px,-11px) scale(1.1); }
  72% { opacity: .45; transform: translate(-7px,-20px) scale(.8); }
}

@keyframes toast {
  0% { opacity: 0; transform: translateY(-8px); }
  10%, 78% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-12px); }
}

@keyframes hintIn { from { opacity: 0; transform: translate(-50%, 5px); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

@media (max-width: 760px), (pointer: coarse) {
  .hud { left: 8px; right: 8px; top: max(8px, env(safe-area-inset-top)); grid-template-columns: auto 1fr auto; }
  .realm-card { padding: 5px 12px 5px 5px; }
  .crest { width: 32px; height: 32px; font-size: 17px; }
  .realm-name { font-size: 11px; }
  .eyebrow { font-size: 6px; }
  .resource { min-width: 39px; height: 41px; padding: 0 6px; gap: 4px; }
  .resource b { font-size: 11px; }
  .resource.wide { min-width: 44px; }
  .morale-track, .resource.wide b { display: none; }
  .time-card { min-width: 91px; padding: 5px 7px; }
  .time-card > div { font-size: 13px; }
  .time-card small { font-size: 6px; }
  .panel { top: 58px; left: 8px; padding: 8px; width: 210px; }
  .objective { font-size: 10px; padding: 3px 0; }
  .panel-title { font-size: 7px; }
  .quick-menu { left: 8px; top: 196px; flex-direction: column; }
  .quick-menu button { min-width: 0; width: 38px; height: 34px; padding: 4px; }
  .quick-menu button span { display: none; }
  .quick-menu button b { width: 27px; height: 25px; }
  .archive-overlay { padding: 8px; }
  .archive-card { width: calc(100vw - 16px); max-height: calc(100vh - 16px); padding: 16px; }
  .archive-card h2 { font-size: 19px; }
  .tool-list { grid-template-columns: 1fr; }
  .inventory-list { grid-template-columns: repeat(2,1fr); }
  .inventory-summary { flex-direction: column; gap: 4px; }
  .modal { bottom: 112px; grid-template-columns: 65px 1fr; gap: 10px; padding: 11px; }
  .portrait { min-height: 92px; }
  #portrait-emoji { font-size: 43px; }
  #dialogue-text { font-size: 12px; margin: 7px 0; }
  .choice { padding: 7px 9px; font-size: 9px; }
  .speaker-row strong { font-size: 12px; }
  .council { bottom: 50%; display: block; max-height: 82vh; overflow-y: auto; padding: 17px; }
  #edict-list { grid-template-columns: 1fr; }
  .council button.edict { min-height: 88px; display: grid; grid-template-columns: 35px 1fr; }
  .edict .edict-icon { grid-row: span 3; }
  .edict em { margin-top: 0; }
  .controls-line { display: none; }
  .save-manager-card { padding: 18px; max-height: calc(100vh - 18px); }
  #save-slot-list { grid-template-columns: 1fr; }
  .save-slot { min-height: 155px; }
  #mobile-controls {
    position: absolute;
    z-index: 20;
    display: block;
    inset: 0;
    pointer-events: none;
  }
  #joystick {
    position: absolute;
    left: 25px;
    bottom: max(24px, env(safe-area-inset-bottom));
    width: 92px;
    height: 92px;
    border: 1px solid rgba(255,255,255,.19);
    border-radius: 50%;
    background: rgba(7,16,18,.25);
    pointer-events: auto;
    touch-action: none;
  }
  #joystick::after {
    content: "↑ SAUT";
    position: absolute;
    left: 50%;
    top: -18px;
    transform: translateX(-50%);
    color: rgba(235, 216, 164, .68);
    font-size: 7px;
    font-weight: 700;
    letter-spacing: .1em;
    white-space: nowrap;
  }
  #stick {
    position: absolute;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    left: 24px;
    top: 24px;
    border: 1px solid rgba(243,217,149,.4);
    background: rgba(226,190,101,.26);
    box-shadow: 0 0 18px rgba(231, 196, 109, .12);
  }
  #mobile-action, #mobile-council {
    position: absolute;
    pointer-events: auto;
    touch-action: manipulation;
    border-radius: 50%;
    border: 1px solid rgba(242,211,132,.48);
    background: rgba(22,38,38,.75);
  }
  #mobile-action {
    right: 25px;
    bottom: max(28px, env(safe-area-inset-bottom));
    width: 72px;
    height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ead18c;
  }
  #mobile-action b { font: 600 20px Cinzel, serif; }
  #mobile-action small { font-size: 7px; letter-spacing: .1em; }
  #mobile-council { right: 108px; bottom: max(84px, calc(env(safe-area-inset-bottom) + 84px)); width: 44px; height: 44px; color: #e2c371; }
  #hint { bottom: 132px; }
  #sound-toggle { bottom: auto; top: 58px; right: 9px; }
}

@media (max-height: 560px) {
  .panel { display: none !important; }
  .start-content { transform: scale(.83); }
  .modal { bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
