@font-face {
  font-family: Fallback;
  src: local('Georgia');
}
* {
  box-sizing: border-box;
}
:root {
  color-scheme: dark;
  --gold: #c8b17c;
  --text: #d7d4ca;
  --muted: #c2bcab;
  --line: #71664b;
  --panel: #101719;
}
body {
  margin: 0;
  background: #11191b;
  color: var(--text);
  font:
    15px Alegreya,
    Georgia,
    serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-image: radial-gradient(ellipse at 50% 30%, #293032, transparent 70%);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
select {
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}
button {
  padding: 10px 14px;
  border-radius: 2px;
  transition:
    background 0.2s,
    color 0.2s;
}
button:hover {
  color: #f0dca8;
  background: #c5ab7020;
}
button:disabled {
  opacity: 0.3;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #e1c98d;
  outline-offset: 4px;
}
header {
  height: 100px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 30px;
  gap: 25px;
  border-bottom: 1px solid var(--line);
  z-index: 2;
  background: #101719b8;
}
.brand {
  font-size: 27px;
  letter-spacing: 5px;
  text-align: center;
  white-space: nowrap;
}
.brand span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  margin-top: 7px;
}
nav {
  display: flex;
  justify-content: center;
  flex: 1;
  align-self: stretch;
  align-items: center;
}
nav button {
  font-family: Cinzel, Georgia, serif;
  letter-spacing: 0.06em;
  font-size: 15px;
  white-space: nowrap;
  border-right: 1px solid #6d604655;
  padding: 12px 18px;
  position: relative;
}
nav button:last-child {
  border-right: 0;
}
nav button[aria-selected='true'] {
  color: #e5c98a;
}
nav button[aria-selected='true']:after {
  content: '';
  position: absolute;
  bottom: -17px;
  left: 12%;
  right: 12%;
  height: 2px;
  background: #e0c381;
  box-shadow: 0 0 9px #dec37788;
}
.identity {
  text-align: right;
  min-width: 130px;
}
.identity strong {
  display: block;
  font-weight: normal;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #ddc898;
}
.identity em {
  font-size: 12px;
  display: block;
  margin-top: 6px;
  color: var(--muted);
}
main {
  display: grid;
  grid-template-columns: 29% 1fr;
  flex: 1;
  min-height: 0;
  padding: 15px 20px 0;
  gap: 12px;
}
aside {
  border: 1px solid #71664b99;
  background: linear-gradient(115deg, #111719e8, #13191bc9);
  padding: 22px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #75664b #101617;
  z-index: 2;
  margin-bottom: 55px;
  border-radius: 9px 9px 2px 2px;
}
h2,
h3 {
  font-family: Cinzel, Georgia, serif;
  font-weight: normal;
  letter-spacing: 0.05em;
  margin: 0;
}
h2 {
  font-size: 24px;
}
h3 {
  font-size: 16px;
  margin-bottom: 17px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.card {
  padding: 8px 3px 12px;
  border: 1px solid #625d51;
  min-height: 139px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  background: #ffffff03;
}
.card svg {
  width: 100%;
  height: 89px;
  color: #a6a69c;
}
.card.active {
  border-color: #e7c77c;
  box-shadow:
    0 0 10px #d2b97133,
    inset 0 0 12px #d2b9710d;
  color: #f1deb2;
}
.card.active svg {
  color: #d4c7a9;
}
.description {
  font-style: italic;
  line-height: 1.6;
  color: #bdc0b9;
  margin: 17px 0 20px;
  min-height: 24px;
}
.slider-row {
  display: grid;
  grid-template-columns: 110px 1fr 27px;
  align-items: center;
  gap: 9px;
  margin: 20px 0;
  font-size: 14px;
}
.slider-row output {
  text-align: right;
  color: #dcd8cc;
  font-size: 12px;
}
input[type='range'] {
  appearance: none;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, #bca16b, #827966);
  border: 1px solid #6f6f66;
  border-radius: 4px;
  cursor: pointer;
}
input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e3d3af, #9a8050);
  border: 1px solid #e2cfa2;
  box-shadow: 0 0 8px #c9b27340;
}
input[type='range']::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ccb788;
  border: 1px solid #e2cfa2;
}
.color-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 16px 0;
}
.color-row > span {
  font-size: 13px;
  min-width: 38px;
}
.swatch {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  padding: 0;
  border: 1px solid #a8a49888;
  box-shadow: inset 0 2px 6px #0006;
  background: var(--swatch);
}
.swatch:hover {
  background: var(--swatch);
  transform: scale(1.08);
}
.swatch.active {
  outline: 1px solid #e6ca84;
  outline-offset: 3px;
}
.color-row input[type='color'] {
  width: 32px;
  height: 32px;
  padding: 3px;
  background: none;
  border: 1px solid #827c6c;
  cursor: pointer;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  font-size: 14px;
}
input[type='checkbox'] {
  accent-color: #c9ad75;
  width: 17px;
  height: 17px;
}
.field {
  display: block;
  margin: 18px 0;
}
.field > span {
  display: block;
  color: #abaeaa;
  font-size: 13px;
  margin-bottom: 8px;
}
.field select,
.field input[type='text'] {
  width: 100%;
  padding: 11px;
  background: #1a2121;
  border: 1px solid #71664b;
  color: var(--text);
  border-radius: 2px;
}
.note {
  font-size: 13px;
  line-height: 1.65;
  color: #c9c4b4;
}
.lock {
  margin-top: 25px;
  border-top: 1px solid #71664b55;
  padding-top: 14px;
}
.lock label {
  font-size: 12px;
  color: #c3c5bb;
}
#stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: 3px;
  background: radial-gradient(ellipse at 58% 40%, #50565a30, transparent 65%);
  transition: background 1s;
}
.scenery {
  position: absolute;
  inset: 0;
  opacity: 0.8;
  transition: opacity 0.5s;
}
.floor {
  position: absolute;
  bottom: 55px;
  height: 20%;
  width: 100%;
  background: linear-gradient(transparent, #88919120 50%, #20282a);
  transform: perspective(250px) rotateX(25deg);
  border-radius: 50%;
}
.shadow {
  position: absolute;
  bottom: 16%;
  left: 30%;
  width: 47%;
  height: 4%;
  background: #030809b0;
  filter: blur(13px);
  border-radius: 50%;
}
#creature {
  position: absolute;
  inset: 2% 1% 14%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 50% 90%;
  transition:
    transform 0.25s,
    filter 0.5s;
}
#Faravar {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 10px #d9e2ed09);
}
.preview-label {
  position: absolute;
  left: 25px;
  bottom: 105px;
  color: #b5b6ad;
  font-size: 13px;
  letter-spacing: 0.6px;
}
.preview-label small {
  display: block;
  color: #aab3ad;
  font-size: 12px;
  margin-top: 6px;
}
.stats {
  position: absolute;
  right: 15px;
  bottom: 80px;
  width: 235px;
  background: linear-gradient(130deg, #131a1ce0, #101617aa);
  border: 1px solid #71664b99;
  border-radius: 6px;
  padding: 17px;
}
.stats h3 {
  font-size: 13px;
  margin-bottom: 14px;
}
.stat {
  display: grid;
  grid-template-columns: 75px 1fr 24px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  margin: 11px 0;
}
.bar {
  height: 6px;
  border: 1px solid #76766b;
  background: #252c2b;
}
.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #82683f, #d4bd8c);
  transition: width 0.3s;
}
.stats small {
  font-size: 12px;
  color: #b9b3a3;
  font-style: italic;
}
.preview-tools {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-top: 1px solid #71664b44;
  font-size: 12px;
  background: #11191bd9;
}
.preview-tools button {
  padding: 7px 12px;
}
.preview-tools label {
  display: flex;
  align-items: center;
  gap: 9px;
}
.preview-tools input {
  width: 65px;
}
.preview-tools select {
  max-width: 170px;
  padding: 6px;
}
select option {
  background: #172021;
  color: #ddd;
}
.preview-tools [aria-pressed='true'] {
  color: #e3c787;
}
footer {
  height: 75px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 28px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  background: #101719e0;
  font-size: 13px;
  gap: 10px;
}
footer > div {
  display: flex;
  gap: 8px;
}
footer #save,
footer #presets {
  border: 1px solid #71664b;
}
footer .primary {
  border: 1px solid #d3b57b;
  outline: 1px solid #7f6944;
  outline-offset: -5px;
  padding: 15px 26px;
  background: linear-gradient(120deg, #4b3a23, #2c271f);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ebd5aa;
}
#save-status {
  font-size: 12px;
  color: #b6bdb6;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translate(-50%, 20px);
  padding: 12px 24px;
  border: 1px solid var(--gold);
  background: #151e20;
  z-index: 9;
  opacity: 0;
  transition: 0.2s;
  pointer-events: none;
  font-size: 14px;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
dialog {
  width: min(540px, 90vw);
  background: #141e20;
  border: 1px solid #ad925f;
  color: var(--text);
  padding: 30px;
  border-radius: 6px;
  box-shadow: 0 20px 100px #0009;
}
dialog::backdrop {
  background: #000a;
  backdrop-filter: blur(5px);
}
dialog p {
  font-size: 13px;
  line-height: 1.7;
  color: #a6afa9;
}
.close {
  float: right;
  font-size: 25px;
  padding: 0 7px;
}
.preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #71664b66;
  padding: 12px 0;
  gap: 10px;
}
.preset-item strong {
  font-weight: normal;
}
.preset-item small {
  display: block;
  color: #98a19a;
  margin-top: 5px;
}
.preset-item button {
  border: 1px solid #71664b;
  font-size: 12px;
}
.import {
  display: block;
  margin-top: 25px;
  color: #d2bb88;
  font-size: 13px;
}
.import input {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  max-width: 100%;
}
.clean header,
.clean aside,
.clean footer,
.clean .preview-tools,
.clean .stats,
.clean .preview-label {
  display: none;
}
.clean main {
  display: block;
  padding: 0;
}
.clean #stage {
  height: 100%;
}
.clean #restore {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 5;
  background: #101719b0;
  border: 1px solid #71664b;
}
.sun {
  display: none;
  position: absolute;
  top: 19%;
  right: 19%;
  width: 120px;
  height: 120px;
  background: #ffde9d;
  border-radius: 50%;
  box-shadow: 0 0 90px 45px #e7a75850;
}
.mountain {
  display: none;
  position: absolute;
  bottom: 15%;
  left: -10%;
  width: 120%;
  height: 58%;
  clip-path: polygon(0 75%, 10% 44%, 22% 70%, 39% 3%, 53% 58%, 68% 12%, 85% 68%, 100% 30%, 100% 100%, 0 100%);
  background: #4d606d;
}
.mountain.front {
  height: 37%;
  background: #293c45;
  transform: scaleX(-1);
}
#stage.sunset {
  background: linear-gradient(#263645, #b27660 60%, #5b503b);
}
.sunset .sun {
  display: block;
}
.sunset .mountain {
  display: block;
  opacity: 0.45;
}
#stage.forest {
  background: radial-gradient(ellipse at 65% 25%, #768269, #1b3330 70%);
}
.trees {
  display: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    93deg,
    transparent 0 9%,
    #11221ccc 10% 13%,
    transparent 14% 22%,
    #1a2c24cc 23% 25%,
    transparent 26% 33%
  );
  mask-image: linear-gradient(#000 70%, transparent);
}
.forest .trees {
  display: block;
}
#stage.mountains {
  background: linear-gradient(#667e8d, #a4aeb0 65%, #32434c);
}
.mountains .mountain {
  display: block;
}
#stage.winter {
  background: linear-gradient(#75858e, #b3bec0 68%, #a6afb0);
}
.winter .mountain {
  display: block;
  background: #d1d6d5;
}
.winter .mountain.front {
  background: #819498;
}
.winter .trees {
  display: block;
  opacity: 0.25;
}
.winter .floor {
  background: linear-gradient(transparent, #dce6e790);
}
.snow {
  display: none;
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, #fff9 1px, transparent 2px), radial-gradient(circle, #fff5 1px, transparent 2px);
  background-size:
    83px 107px,
    131px 71px;
  background-position:
    17px 35px,
    50px 70px;
}
.winter .snow {
  display: block;
}
#stage.battlefield {
  background: linear-gradient(#252b2f, #675448 60%, #302b26);
}
.ruins {
  display: none;
  position: absolute;
  inset: 20% 0 15%;
  background: #1c2327;
  opacity: 0.6;
  clip-path: polygon(
    0 100%,
    0 55%,
    10% 55%,
    10% 30%,
    13% 30%,
    13% 53%,
    17% 53%,
    17% 60%,
    26% 60%,
    26% 85%,
    64% 85%,
    64% 30%,
    67% 30%,
    67% 38%,
    72% 38%,
    72% 20%,
    74% 20%,
    74% 60%,
    83% 60%,
    83% 45%,
    86% 45%,
    86% 65%,
    100% 65%,
    100% 100%
  );
}
.battlefield .ruins {
  display: block;
}
@media (min-width: 1700px) {
  aside {
    padding: 30px;
  }
  .card {
    min-height: 165px;
  }
  .card svg {
    height: 110px;
  }
  .slider-row {
    margin: 27px 0;
  }
  .swatch {
    width: 37px;
    height: 37px;
  }
}
@media (max-width: 1250px) {
  header {
    gap: 12px;
    padding: 0 18px;
    height: 85px;
  }
  .brand {
    font-size: 21px;
    letter-spacing: 3px;
  }
  .brand span {
    font-size: 10px;
  }
  nav button {
    font-size: 12px;
    padding: 10px;
  }
  .identity {
    min-width: 90px;
    font-size: 12px;
  }
  main {
    grid-template-columns: 33% 1fr;
    padding: 12px 12px 0;
    gap: 4px;
  }
  aside {
    padding: 16px;
  }
  .slider-row {
    grid-template-columns: 100px 1fr 22px;
  }
  .color-row {
    gap: 7px;
  }
  .swatch {
    width: 25px;
    height: 25px;
  }
  .stats {
    width: 195px;
  }
  .preview-tools {
    gap: 1px;
    font-size: 11px;
  }
  .preview-tools button {
    padding: 7px;
  }
  .preview-label {
    bottom: 95px;
    left: 12px;
    font-size: 11px;
  }
  footer {
    padding: 10px 15px;
  }
  footer button {
    padding: 10px;
    font-size: 12px;
  }
  footer .primary {
    padding: 14px;
  }
  .card {
    font-size: 11px;
  }
  .identity em {
    font-size: 10px;
  }
}
@media (max-width: 850px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }
  header {
    height: auto;
    flex-wrap: wrap;
    padding: 20px 15px 12px;
    justify-content: space-between;
  }
  .identity {
    margin-left: auto;
  }
  nav {
    order: 3;
    width: 100%;
    flex-basis: 100%;
    overflow: auto;
    justify-content: flex-start;
    margin-top: 15px;
  }
  nav button {
    flex: 1;
  }
  nav button[aria-selected='true']:after {
    bottom: -2px;
  }
  main {
    display: flex;
    flex-direction: column;
    padding: 0;
  }
  #stage {
    height: 58vw;
    min-height: 330px;
    order: -1;
  }
  aside {
    margin: 0 12px 15px;
    max-height: 560px;
  }
  .stats {
    bottom: 65px;
    right: 10px;
    width: 170px;
    padding: 10px;
  }
  .stats h3 {
    margin-bottom: 7px;
  }
  .stat {
    grid-template-columns: 63px 1fr 20px;
    margin: 7px 0;
  }
  .preview-label {
    bottom: 75px;
  }
  .preview-tools {
    flex-wrap: wrap;
    height: 55px;
  }
  .preview-tools input {
    width: 50px;
  }
  footer {
    height: auto;
    flex-wrap: wrap;
    justify-content: center;
    padding: 15px;
  }
  footer #save-status {
    order: 3;
    width: 100%;
    text-align: center;
  }
  .cards .card {
    min-height: 120px;
  }
  .color-row {
    gap: 13px;
  }
  .swatch {
    width: 32px;
    height: 32px;
  }
  .clean #stage {
    height: 100vh;
  }
  .clean main {
    height: 100vh;
  }
  .preview-tools .environment select {
    max-width: 135px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
.lineage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.lineage-card {
  border: 1px solid #71664b80;
  padding: 7px 5px 10px;
  background: #ffffff03;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.lineage-card img {
  width: 100%;
  height: 96px;
  object-fit: contain;
}
.lineage-card span {
  color: #d5c29a;
  font-size: 15px;
}
.lineage-card small {
  font-size: 12px;
  color: #c0c6c1;
}
.lineage-card.active {
  border-color: #e0c181;
  background: #c8b17c0c;
  box-shadow: 0 0 10px #d2b97122;
}
#asset-status {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 13px;
  color: #e3c992;
  background: #141c1ded;
  border-radius: 4px;
  padding: 9px 14px;
}
#asset-status:empty {
  display: none;
}
#Faravar {
  object-fit: contain;
  filter: none;
}
.equipment-spec {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 13px;
  padding: 15px 0;
  color: #a2afa7;
}
.equipment-spec strong {
  text-align: right;
  color: #d4bb85;
  font-weight: normal;
}
fieldset.planned {
  border: 1px solid #71664b44;
  padding: 16px;
  margin: 14px 0;
  opacity: 0.6;
  min-width: 0;
}
fieldset.planned legend {
  font-size: 12px;
  color: #b8b7ab;
  padding: 0 7px;
}
fieldset.planned input,
fieldset.planned select {
  cursor: not-allowed;
}
.planned .slider-row {
  grid-template-columns: 90px 1fr 24px;
}
.planned .color-row {
  flex-wrap: wrap;
}

/* Individual control resets and compact additions preserve the existing theme. */
.slider-row,
.planned .slider-row {
  grid-template-columns: minmax(80px, 105px) minmax(40px, 1fr) 27px 28px;
  gap: 7px;
}
.slider-reset,
.preview-tools .slider-reset {
  padding: 3px;
  width: 28px;
  height: 28px;
  border: 1px solid #71664b88;
  color: #d4bd8c;
  line-height: 1;
  font-size: 18px;
}
.color-row {
  flex-wrap: wrap;
}
.color-row > span {
  min-width: 55px;
}
.wing-study-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.wing-study {
  border: 1px solid #71664b88;
  padding: 10px;
  text-align: left;
}
.wing-study strong {
  display: block;
  font-weight: normal;
  color: #d4bd8c;
}
.wing-study small {
  display: block;
  font-size: 11.5px;
  line-height: 1.5;
  margin-top: 5px;
  color: #c0c6bf;
}
.wing-study.active {
  border-color: #e2c98b;
  background: #c8b17c12;
}

.stats #profile-open {
  pointer-events: auto;
  display: block;
  border: 1px solid var(--line);
  padding: 6px 10px;
  margin-top: 10px;
  font-size: 12px;
}
#profile-dialog {
  width: min(740px, 94vw);
  max-height: 88vh;
  overflow: auto;
}
.profile-stat {
  border-bottom: 1px solid #71664b55;
  padding: 12px 0;
}
.profile-stat p {
  margin: 6px 0;
}
.profile-stat small {
  color: var(--muted);
  line-height: 1.6;
}
details {
  margin: 18px 0;
}
summary {
  cursor: pointer;
  color: var(--gold);
  padding: 8px 0;
}
.battle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.battle-actions button {
  border: 1px solid var(--line);
}
#battle-log {
  max-height: 160px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.7;
}
#lineage-info-dialog {
  max-width: 480px;
  width: calc(100% - 48px);
  line-height: 1.6;
}
#lineage-info-heading {
  color: var(--gold);
  letter-spacing: 0.12em;
  font-family: Cinzel, Georgia, serif;
}
#editor details {
  margin: 14px 0;
}
#editor summary {
  cursor: pointer;
  padding: 10px 0;
}
@media (max-width: 650px) {
  .stats small,
  .identity em,
  .lineage-card small {
    font-size: 11px;
  }
}
