:root {
  color-scheme: dark;
  --ink: #eee9d8;
  --muted: #b6c8bb;
  --gold: #d9bd7b;
  --green: #78cbb1;
  --line: #cfbf8e35;
  background: #102824;
  color: var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
select {
  font: inherit;
}
button,
a,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #23463d;
  color: var(--ink);
  padding: 12px 17px;
  min-height: 48px;
}
button:hover {
  border-color: var(--gold);
  background: #30584b;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid #f3d894;
  outline-offset: 3px;
}
.primary {
  background: #d6bb7f;
  color: #192f28;
}
.primary:hover {
  background: #f0d69e;
}
.ghost {
  background: transparent;
}
.top {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4vw;
  border-bottom: 1px solid var(--line);
  background: #102824ec;
  position: relative;
  z-index: 3;
}
.logo {
  letter-spacing: 0.22em;
}
.logo small {
  display: block;
  color: var(--gold);
  letter-spacing: 0.25em;
  margin-top: 5px;
}
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.eyebrow {
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--gold);
}
.landing {
  position: relative;
  min-height: calc(100svh - 76px);
  padding: 8vh 7vw 45px;
  background:
    linear-gradient(90deg, #102824 7%, #102824c9 46%, #10282422),
    url("../chronicle/assets/worldtree-hub.webp") center/cover;
}
.landing:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #102824 0%, transparent 50%);
  pointer-events: none;
}
.landing > * {
  position: relative;
  z-index: 1;
}
.hero-copy {
  max-width: 650px;
}
h1 {
  letter-spacing: -0.035em;
  margin: 23px 0;
}
h2 {
  margin: 12px 0 20px;
}
h3 {
  margin: 12px 0;
}
p {
  color: var(--muted);
}
.lead {
  max-width: 560px;
}
.roster {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin: 35px 0 24px;
  max-width: 1000px;
}
.role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 9px 6px;
  background: #16362eef;
  position: relative;
  border-top: 2px solid var(--role);
}
.role-card[aria-pressed="true"] {
  background: #3d5948;
  border-color: #ddc791;
  box-shadow: inset 0 0 20px #efdb9c11;
}
.role-card img {
  width: 78px;
  height: 85px;
  object-fit: contain;
  filter: drop-shadow(0 7px 5px #071b1a66);
}
.role-card span {
  margin-top: 8px;
}
.selection {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  max-width: 1000px;
  background: #102c25ee;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.selection img {
  width: 135px;
  height: 155px;
  object-fit: contain;
}
.selection .details {
  flex: 1;
}
.selection p {
  margin: 8px 0;
}
.tiers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 15px 0;
}
.tiers button {
}
.tiers button[aria-pressed="true"] {
  border-color: var(--gold);
  background: #3a5643;
}
.footnote {
  color: #9fb4a7;
  max-width: 950px;
}
.game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  min-height: calc(100svh - 76px);
}
.field-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #102930;
  min-width: 0;
}
.stage-bar {
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  min-height: 88px;
  border-bottom: 1px solid var(--line);
  background: #142e2b;
}
.stage-bar h3 {
  margin: 3px 0;
}
.stage-bar p {
  margin: 3px 0;
}
.canvas-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  overflow: hidden;
}
.canvas-wrap canvas {
  width: 100%;
  aspect-ratio: 1000/650;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.hud {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  position: absolute;
  left: 20px;
  right: 20px;
  top: 16px;
  pointer-events: none;
}
.hp {
  width: 180px;
  background: #152f2a;
  border: 1px solid #b9c1a94d;
  padding: 7px 10px;
  border-radius: 4px;
}
.hp .track {
  height: 5px;
  background: #334d43;
  margin-top: 5px;
}
.hp .fill {
  background: #a8dab2;
  height: 100%;
}
.tutorial {
  position: absolute;
  bottom: 22px;
  left: 22px;
  max-width: 260px;
  padding: 10px 13px;
  background: #102a27dd;
  border: 1px solid var(--line);
  pointer-events: none;
}
.joystick {
  position: absolute;
  left: 38px;
  bottom: 38px;
  width: 92px;
  height: 92px;
  border: 1px solid #e5e0b340;
  border-radius: 50%;
  background: #c6d2be11;
  pointer-events: none;
  display: none;
}
.joystick i {
  position: absolute;
  width: 40px;
  height: 40px;
  left: 25px;
  top: 25px;
  border-radius: 50%;
  background: #e0d3a544;
  border: 1px solid #e0d3a566;
}
.battle-footer {
  padding: 12px 20px;
  background: #102c27;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.skills {
  display: flex;
  gap: 8px;
}
.skill {
  position: relative;
  padding: 0;
  width: 60px;
  height: 60px;
  overflow: hidden;
  border: 1px solid #d8bd7b88;
  border-radius: 7px;
  background-size: 360px 240px;
  background-image: url("../game/assets/ui/role-skill-icons-v1.png");
}
.skill small {
  background: #08241deb;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}
.skill b {
  position: absolute;
  top: 0;
  right: 0;
  padding: 2px 5px;
  background: #102a24dd;
}
.sidebar {
  padding: 25px 22px;
  border-left: 1px solid var(--line);
  background: linear-gradient(160deg, #1b382d, #102822);
}
.sidebar .role-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar img {
  width: 66px;
  height: 76px;
  object-fit: contain;
}
.sidebar p {
}
.bag {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}
.material {
  border: 1px solid var(--line);
  padding: 10px;
  background: #071d1722;
}
.material:before {
  content: "◆";
  color: var(--gold);
  margin-right: 9px;
}
.sidebar button {
  width: 100%;
  margin-top: 10px;
}
.sidebar details {
  margin: 20px 0;
}
.sidebar summary {
  cursor: pointer;
  min-height: 40px;
  color: var(--gold);
}
.glossary p {
}
.glossary b {
  color: var(--gold);
}
.overlay {
  position: fixed;
  inset: 0;
  background: #061916c9;
  backdrop-filter: blur(8px);
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: auto;
}
.panel {
  width: min(900px, 100%);
  max-height: calc(100svh - 44px);
  overflow: auto;
  border: 1px solid #e4c98a66;
  border-radius: 10px;
  background: linear-gradient(145deg, #244537, #122d26);
  box-shadow: 0 30px 90px #00140cd9;
  padding: 35px;
}
.panel.narrow {
  width: min(600px, 100%);
}
.panel p {
}
.panel .steps {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.panel .steps button {
  flex: 1;
  text-align: left;
  min-width: 180px;
}
.panel .steps button[aria-pressed="true"] {
  border-color: var(--gold);
  background: #44634d;
}
.panel hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}
.panel .row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 15px 0;
}
.panel .row > * {
  flex: 1;
}
.panel label {
  display: block;
  color: var(--gold);
  margin: 15px 0 8px;
}
.panel select {
  width: 100%;
  border: 1px solid var(--line);
  background: #14352a;
  color: var(--ink);
  padding: 13px;
  min-height: 48px;
}
.panel .output {
  border-left: 3px solid var(--green);
  padding: 15px 18px;
  background: #0b241b88;
  margin: 18px 0;
}
.panel .output p {
  margin: 0;
}
.panel .output small {
  display: block;
  color: var(--gold);
}
.panel .error {
  color: #ffd0af;
  border-left: 3px solid #d88d6c;
  padding: 12px;
  background: #67402b44;
}
.eval-row {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.eval-row button {
  min-width: 95px;
}
.upgrade-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.upgrade-cards button {
  text-align: left;
}
.upgrade-cards button[aria-pressed="true"] {
  border-color: var(--gold);
  background: #3f6049;
}
.upgrade-cards small {
  display: block;
  color: var(--muted);
}
.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 22px;
  border: 1px solid var(--gold);
  background: #153c2deb;
  border-radius: 7px;
  z-index: 30;
  max-width: 90vw;
}
.checks {
  color: #bfe7c8;
}
.badge {
  color: var(--gold);
  border: 1px solid var(--line);
  padding: 6px 9px;
  border-radius: 3px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.settings {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}
.settings label {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.settings input {
  width: 20px;
  height: 20px;
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  color: #b3ccb9;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.result-grid article {
  padding: 17px;
  border: 1px solid var(--line);
  background: #112d22;
}
a {
  color: var(--gold);
}
@media (max-width: 1050px) {
  .game {
    grid-template-columns: 1fr 260px;
  }
  .sidebar {
    padding: 20px 15px;
  }
  .roster {
    grid-template-columns: repeat(4, 1fr);
    max-width: 600px;
  }
  .role-card {
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }
  .role-card img {
    width: 48px;
    height: 55px;
  }
  .landing {
    padding: 5vh 6vw 30px;
  }
}
@media (max-width: 760px) {
  .top {
    height: 64px;
    padding: 0 15px;
  }
  .logo {
  }
  .top .badge {
    display: none;
  }
  .top button {
    padding: 10px;
  }
  .landing {
    min-height: calc(100svh - 64px);
    background-position: 60% center;
    padding: 30px 20px;
  }
  .landing h1 {
    max-width: 400px;
  }
  .lead {
  }
  .roster {
    gap: 6px;
    margin: 24px 0 16px;
  }
  .role-card {
    flex-direction: column;
    padding: 5px;
    gap: 0;
  }
  .role-card img {
    width: 55px;
    height: 60px;
  }
  .role-card span {
    margin-top: 3px;
  }
  .selection {
    gap: 12px;
    padding: 15px;
  }
  .selection > img {
    width: 80px;
    height: 100px;
  }
  .selection h3 {
  }
  .selection p {
  }
  .selection .tiers {
    gap: 5px;
  }
  .selection .tiers button {
    padding: 8px;
  }
  .game {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .stage-bar {
    min-height: 80px;
    padding: 12px 14px;
  }
  .stage-bar p {
  }
  .canvas-wrap {
    min-height: 0;
    aspect-ratio: 1000/760;
  }
  .canvas-wrap canvas {
    width: 120%;
    max-width: none;
    flex-shrink: 0;
  }
  .sidebar {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .sidebar .role-heading,
  .sidebar > p,
  .sidebar > details {
    grid-column: 1/-1;
  }
  .sidebar .bag {
    margin: 0;
  }
  .sidebar h3 {
  }
  .sidebar button {
    margin: 0;
  }
  .sidebar > h3 {
    display: none;
  }
  .battle-footer {
    padding: 10px;
  }
  .battle-footer > div:first-child {
  }
  .skill {
    width: 55px;
    height: 55px;
    background-size: 330px 220px;
  }
  .tutorial {
    max-width: 180px;
    left: 12px;
    bottom: 12px;
    padding: 8px;
  }
  .hud {
    left: 12px;
    right: 12px;
    top: 10px;
  }
  .hp {
    width: 145px;
  }
  .panel {
    padding: 22px 18px;
  }
  .overlay {
    padding: 12px;
  }
  .panel {
    max-height: calc(100svh - 24px);
  }
  .panel .steps {
    flex-direction: column;
  }
  .upgrade-cards {
    grid-template-columns: 1fr;
  }
  .result-grid {
    grid-template-columns: 1fr;
  }
  .joystick {
    display: block;
  }
  .footnote {
  }
  .actions {
    gap: 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
@media (min-width: 761px) {
  .game {
    height: calc(100svh - 76px);
    min-height: 0;
  }
  .field-wrap {
    overflow: hidden;
  }
  .canvas-wrap {
    min-height: 0;
    height: 0;
    flex: 1;
  }
  .canvas-wrap canvas {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }
  .sidebar {
    overflow: auto;
  }
}
.panel-language {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 10px;
}
.panel-language button {
  min-height: 36px;
  padding: 6px 10px;
  background: transparent;
}
.advance-portrait {
  display: block;
  width: 180px;
  height: 190px;
  object-fit: contain;
  margin: 20px auto;
  filter: drop-shadow(0 10px 20px #dfc18a44);
}
.skill-status {
  min-height: 35px;
  color: #e5cb8e !important;
}
.cast-cancel {
  min-height: 44px;
  padding: 8px;
  white-space: nowrap;
}
.skill:disabled {
  opacity: 0.55;
}
.sidebar .skill-status {
  grid-column: 1/-1;
}
.audio-sliders {
  display: grid;
  gap: 7px;
  margin: 18px 0;
}
.audio-sliders label {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  margin: 0;
  color: var(--muted);
}
.audio-sliders input {
  width: 100%;
  height: 44px;
  accent-color: #d8bd7c;
}
.skill-guide article {
  border-top: 1px solid var(--line);
  padding-top: 6px;
  margin-top: 8px;
}
.skill-guide article h3 {
  color: var(--gold);
}
.skill-guide article p {
}
.skill:hover,
.skill:disabled:hover {
  background-color: #30584b;
  background-image: url("../game/assets/ui/role-skill-icons-v1.png");
  background-size: 360px 240px;
}
@media (max-width: 760px) {
  .skill:hover,
  .skill:disabled:hover {
    background-size: 330px 220px;
  }
}
.control-settings {
  border: 1px solid #78908466;
  border-radius: 10px;
  margin: 1rem 0;
  padding: 1rem;
}
.control-settings select {
  margin: 0.4rem;
  max-width: 100%;
}
.control-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.control-keys label {
  display: grid;
  gap: 0.3rem;
}
.control-keys input {
  width: 3rem;
  padding: 0.6rem;
  text-align: center;
  text-transform: uppercase;
  background: #153831;
  color: #f1e6ba;
  border: 1px solid #718b7a;
  border-radius: 6px;
}
.skill[data-preview="true"] {
  outline: 3px solid #eed7a2;
  outline-offset: 3px;
}
.encounter-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.encounter-cards button {
  display: grid;
  gap: 0.8rem;
  text-align: left;
  padding: 1.2rem;
  min-height: 160px;
  background: linear-gradient(145deg, #34554a, #153830);
  border: 1px solid #bca77380;
}
.encounter-cards small {
  color: #d7e2d3;
}
#combat-energy {
  color: #d8c58d;
}
#encounter-start {
  margin-bottom: 1rem;
  border-color: #bdab73;
  color: #f0dcaa;
}
[hidden] {
  display: none !important;
}
.recipe-icon {
  display: block;
  width: 82px;
  height: 82px;
  overflow: hidden;
  margin: 0 auto 0.6rem;
}
.upgrade-cards button {
  background: linear-gradient(150deg, #38564c99, #173a32);
  box-shadow: inset 0 1px 0 #e2d4a522;
  text-align: left;
}
.upgrade-cards button[aria-pressed="true"] {
  border-color: #e8cd87;
  box-shadow:
    inset 0 0 0 1px #e8cd8777,
    0 0 18px #d4c07515;
}
.upgrade-cards button span {
  color: #d7bc78;
}
.encounter-icon {
  display: block;
  width: 86px;
  height: 86px;
  background-size: 258px 172px;
  background-position: 0 0;
  background-repeat: no-repeat;
}
.encounter-icon.pincer {
  background-image: url("assets/enemies/static-scrambler-v1.png");
}
.encounter-icon.battery {
  background-image: url("assets/enemies/echo-lantern-v1.png");
}
.encounter-icon.bulwark {
  background-image: url("assets/enemies/misbinding-sentinel-v1.png");
}
