@font-face {
  font-family: AK;
  src: local("Georgia");
  font-display: swap;
}
* {
  box-sizing: border-box;
}
:root {
  --ink: #172f27;
  --muted: #576356;
  --paper: #f3eee2;
  --gold: #c4974e;
  --line: #d6cfbf;
  --purple: #6426b8;
  --red: #973b38;
  --blue: #315e85;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    16px/1.5 "Segoe UI",
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fffaf1;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 650;
  min-height: 44px;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: #e6ddc9;
}
button:active {
  transform: scale(0.98);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
button.primary,
.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff8e8;
}
button.primary:hover {
  background: #315848;
}
button.gold {
  background: #efd294;
  border-color: #b89353;
  color: #213f30;
}
button.danger {
  color: #963c34;
}
a {
  color: inherit;
  text-underline-offset: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid #9c64d6;
  outline-offset: 3px;
}
::selection {
  background: #dec5f6;
  color: #25133b;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2 {
  font-family: AK, Georgia, serif;
  font-weight: normal;
  line-height: 1.08;
  letter-spacing: -0.025em;
}
h1 {
  font-size: clamp(36px, 5vw, 66px);
  margin-bottom: 22px;
}
h2 {
  font-size: 32px;
  margin-bottom: 16px;
}
h3 {
  font-size: 19px;
  margin-bottom: 8px;
}
small,
.muted {
  color: var(--muted);
}
.skip {
  position: fixed;
  top: -100px;
  padding: 10px;
  background: #fff;
  z-index: 10;
}
.skip:focus {
  top: 8px;
}
.top {
  padding: 18px 4vw;
  display: flex;
  gap: 24px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #faf6ed;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.025em;
  line-height: 1.2;
  white-space: nowrap;
}
.wordmark small {
  display: block;
  font-size: 11px;
  letter-spacing: 0.19em;
  margin-top: 5px;
}
.seal {
  border: 2px solid var(--ink);
  border-radius: 50%;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 20px;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
  justify-content: center;
}
nav button {
  border: 0;
  background: none;
  padding: 7px 12px;
  font-size: 14px;
}
nav button.active {
  background: #e2e7dd;
}
.studio {
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
}
.studio span {
  color: var(--purple);
}
main {
  max-width: 1440px;
  margin: auto;
  padding: 40px 4vw 65px;
  min-height: 75vh;
}
.bottom {
  padding: 20px 4vw;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  color: var(--muted);
  font-size: 12px;
}
.bottom button {
  font-size: 12px;
  background: none;
  border: 0;
}
.loading {
  padding: 100px 0;
  text-align: center;
}
.notice {
  padding: 13px 5%;
  background: #f7dfac;
  color: #4c3816;
  border-bottom: 1px solid #c6a76b;
}
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 70px;
  align-items: center;
  min-height: 560px;
}
.intro p {
  max-width: 43ch;
  color: var(--muted);
  font-size: 18px;
}
.showcase {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 410px;
}
.showcase img {
  width: 35%;
  height: auto;
  flex: 0 1 35%;
  max-width: 265px;
  box-shadow: 0 18px 35px #10251c33;
  border-radius: 14px;
  transform: rotate(-10deg);
  margin-right: -8%;
}
.showcase img:nth-child(2) {
  transform: rotate(2deg);
  z-index: 1;
}
.showcase img:nth-child(3) {
  transform: rotate(13deg);
  margin-right: 0;
}
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.spread {
  justify-content: space-between;
}
.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}
.page-head h1 {
  margin: 0;
}
.page-head p {
  margin: 8px 0 0;
}
.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 5px 12px;
  font-size: 12px;
}
.welcome-strip {
  display: flex;
  gap: 30px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 35px;
  font-size: 13px;
}
.welcome-strip b {
  display: block;
  font-size: 22px;
}
.auth {
  max-width: 460px;
  margin: 35px auto;
  padding: 30px 0;
}
.auth h1 {
  font-size: 43px;
}
label {
  display: block;
  font-size: 14px;
  font-weight: 650;
  margin: 15px 0 6px;
}
input,
select {
  border: 1px solid #b4bbaa;
  border-radius: 7px;
  padding: 12px;
  background: #fffdf7;
  color: var(--ink);
  max-width: 100%;
  min-height: 46px;
}
input[type="checkbox"] {
  min-height: 0;
  width: 19px;
  height: 19px;
}
.auth input {
  width: 100%;
}
.auth .primary {
  width: 100%;
  margin: 25px 0 15px;
}
.auth-links {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.auth-links button {
  border: 0;
  background: none;
  font-size: 13px;
}
.kits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
}
.kit {
  border-bottom: 1px solid var(--line);
  padding: 10px 0 25px;
}
.kit img {
  width: 100%;
  height: 280px;
  object-fit: contain;
  display: block;
  margin-bottom: 20px;
}
.kit p {
  font-size: 14px;
  color: var(--muted);
}
.kit h2 {
  margin-bottom: 10px;
}
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.toolbar input {
  flex: 1;
  min-width: 160px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 22px 16px;
}
.collection-item {
  min-width: 0;
}
.card-art {
  display: block;
  border: 0;
  background: none;
  padding: 0;
  width: 100%;
  border-radius: 12px;
}
.card-art:hover {
  background: none;
  transform: translateY(-4px);
}
.card-art img {
  width: 100%;
  height: auto;
  aspect-ratio: 2/3;
  object-fit: contain;
  display: block;
  border-radius: 12px;
}
.collection-item.locked .card-art {
  opacity: 0.55;
}
.collection-item h3 {
  font-size: 14px;
  margin: 9px 0 0;
  line-height: 1.3;
}
.collection-item small {
  font-size: 12px;
}
.card-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
}
.card-controls button {
  min-width: 40px;
  padding: 7px;
}
.card-controls output {
  font-weight: 750;
}
.action-card {
  background: #fffaf0;
  border: 1px solid var(--line);
  border-top: 5px solid var(--red);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 215px;
  padding: 14px;
  text-align: left;
  width: 100%;
  position: relative;
}
.action-card.defense {
  border-top-color: var(--blue);
}
.action-card.status {
  border-top-color: #795091;
}
.action-card.field {
  border-top-color: #4e7844;
}
.action-card .cost {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}
.action-card h3 {
  font-size: 16px;
  line-height: 1.2;
}
.action-card p {
  font-size: 12px;
  font-weight: 400;
  margin: 9px 0;
}
.action-card .category {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: auto;
}
.action-card.selected {
  outline: 3px solid #d5aa5d;
  outline-offset: 3px;
}
.selected-unit {
  outline: 3px solid #dfb85f !important;
  outline-offset: 3px;
}
.pagination {
  justify-content: center;
  margin: 30px 0;
}
.deck-summary {
  padding: 16px 0;
  border-block: 1px solid var(--line);
  margin: 20px 0;
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 2;
}
.trail {
  display: flex;
  gap: 0;
  list-style: none;
  padding: 0;
  margin: 30px 0;
  overflow: auto;
}
.trail li {
  flex: 1;
  min-width: 70px;
  text-align: center;
  font-size: 11px;
  position: relative;
}
.trail li::before {
  content: "";
  height: 1px;
  background: #b0b5a2;
  position: absolute;
  left: 0;
  right: 0;
  top: 19px;
  z-index: 0;
}
.trail span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid #a7b09b;
  background: var(--paper);
  border-radius: 50%;
  margin: 0 auto 10px;
  position: relative;
  font-size: 15px;
}
.trail .current span {
  background: var(--ink);
  color: #fff;
}
.trail .done span {
  background: #a6baa2;
}
.map-panel {
  background: var(--ink);
  color: #fff6e2;
  padding: 42px;
  border-radius: 18px;
  min-height: 280px;
}
.map-panel p {
  color: #c5d3c3;
  max-width: 60ch;
}
.map-panel .row {
  margin-top: 26px;
}
.map-panel button {
  min-width: 160px;
}
.info-split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 30px;
  margin-top: 28px;
}
.stats-list {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.stats-list li {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  flex: 1;
}
.stats-list b {
  font-size: 23px;
  display: block;
}
.formation {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  max-width: 1100px;
  margin: 25px auto;
}
.formation .card-art {
  padding: 5px;
}
.formation .selected-unit {
  background: #e2ca96;
}
.formation .card-art:disabled {
  opacity: 0.5;
}
.battle {
  background: var(--ink);
  color: #f5efdf;
  border-radius: 16px;
  padding: 25px;
  margin-top: 20px;
}
.battle small {
  color: #c0ccbb;
}
.battle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #536757;
  padding-bottom: 14px;
  margin-bottom: 20px;
}
.battle-head h2 {
  font-size: 24px;
  margin: 0;
}
.squad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  max-width: 880px;
  margin: auto;
}
.unit {
  border: 1px solid #56705c;
  background: #234333;
  color: #fff7e7;
  padding: 10px;
  border-radius: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  font-weight: 400;
  min-width: 0;
}
.unit:hover {
  background: #30523f;
}
.unit img {
  width: 62px;
  height: auto;
  aspect-ratio: 2/3;
  object-fit: contain;
  border-radius: 5px;
}
.unit-content {
  display: block;
  flex: 1;
  min-width: 0;
}
.unit strong {
  font-size: 12px;
  line-height: 1.2;
  display: block;
  overflow-wrap: anywhere;
}
.unit small {
  display: block;
  font-size: 11px;
}
.unit.defeated {
  opacity: 0.3;
  filter: grayscale(1);
}
.meter {
  display: block;
  height: 5px;
  background: #405442;
  margin: 7px 0 4px;
  border-radius: 3px;
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  background: #c8d697;
}
.unit.valid {
  border-color: #edcb7e;
}
.field-line {
  text-align: center;
  padding: 18px;
  font-size: 13px;
  color: #d4d7ba;
}
.battle-prompt {
  background: #e8d5a2;
  color: #283b29;
  padding: 13px 18px;
  margin: 20px 0;
  border-radius: 8px;
  font-size: 14px;
  min-height: 50px;
}
.hand {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.battle-controls {
  margin-top: 20px;
}
.battle-controls button {
  font-size: 13px;
}
.log {
  padding: 15px 0;
}
.log ol {
  font-size: 13px;
  max-height: 190px;
  overflow: auto;
  padding-left: 22px;
}
.result {
  text-align: center;
  max-width: 850px;
  margin: 50px auto;
}
.result h1 {
  font-size: 58px;
}
.result p {
  color: var(--muted);
}
.reward-options {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 30px 0;
}
.reward-options button {
  min-width: 200px;
  padding: 24px;
}
.reward-options small {
  display: block;
  font-weight: 400;
  margin-top: 6px;
}
.pack-reveal {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin: 30px 0;
}
.rules {
  max-width: 860px;
  margin: 0 auto;
}
.rules p,
.rules li {
  color: var(--muted);
}
.rules details {
  border-bottom: 1px solid var(--line);
  padding: 15px 0;
}
.rules summary {
  font-weight: 700;
  cursor: pointer;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
th,
td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
}
dialog {
  border: 0;
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  max-width: 850px;
  width: 90%;
  max-height: 92vh;
  padding: 30px;
}
dialog::backdrop {
  background: #07160dd4;
}
.close {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  font-size: 23px;
}
.detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  align-items: center;
}
.detail img {
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
}
.detail p {
  font-size: 14px;
}
.detail h2 {
  margin-top: 20px;
}
.recovery {
  font-family: monospace;
  overflow-wrap: anywhere;
  background: #e6ddc7;
  padding: 15px;
  user-select: all;
}
.danger-zone {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding-top: 25px;
}
.scroll-table {
  overflow-x: auto;
}
.account-banner {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}
.rule-link {
  font-size: 13px;
  color: #ced3b8;
}
.battle .rule-link {
  color: #ced3b8;
}
.pending {
  cursor: progress;
}
body.pending button {
  pointer-events: none;
}
.hidden {
  display: none !important;
}
@media (max-width: 1050px) {
  .top {
    flex-wrap: wrap;
    gap: 10px;
  }
  nav {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
  }
  .studio {
    margin-left: auto;
  }
  .card-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .hand {
    grid-template-columns: repeat(3, 1fr);
  }
  .squad {
    gap: 9px;
  }
  .unit {
    display: block;
    padding: 8px;
    text-align: center;
  }
  .unit img {
    width: 58px;
  }
  .intro {
    gap: 25px;
  }
  .intro h1 {
    font-size: 50px;
  }
}
@media (max-width: 650px) {
  main {
    padding: 25px 16px 40px;
  }
  .top {
    padding: 13px 16px;
  }
  .wordmark {
    font-size: 13px;
  }
  .studio {
    font-size: 11px;
  }
  .seal {
    width: 35px;
    height: 35px;
    font-size: 16px;
  }
  nav {
    gap: 0;
  }
  nav button {
    font-size: 12px;
    padding: 7px 10px;
  }
  .intro {
    grid-template-columns: 1fr;
    gap: 20px;
    min-height: 0;
  }
  .intro h1 {
    font-size: 46px;
  }
  .intro p {
    font-size: 16px;
  }
  .showcase {
    min-height: 310px;
    order: -1;
  }
  .showcase img {
    max-width: 170px;
  }
  .kits {
    grid-template-columns: 1fr;
  }
  .kit {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 18px;
    align-items: center;
  }
  .kit img {
    height: 170px;
    margin: 0;
  }
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 12px;
  }
  .formation {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .formation h3 {
    font-size: 12px;
  }
  .page-head {
    align-items: start;
    flex-direction: column;
  }
  .page-head h1 {
    font-size: 38px;
  }
  .info-split {
    grid-template-columns: 1fr;
  }
  .map-panel {
    padding: 25px;
  }
  .map-panel .row button {
    width: 100%;
  }
  .battle {
    padding: 12px;
    margin-inline: -8px;
  }
  .battle-head {
    gap: 10px;
  }
  .battle-head h2 {
    font-size: 19px;
  }
  .battle-head .tag {
    font-size: 11px;
  }
  .squad {
    gap: 5px;
  }
  .unit {
    padding: 5px;
    border-radius: 7px;
  }
  .unit img {
    width: 46px;
  }
  .unit strong {
    font-size: 11px;
    min-height: 24px;
  }
  .unit small {
    font-size: 11px;
  }
  .field-line {
    padding: 12px;
    font-size: 11px;
  }
  .hand {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .action-card {
    min-height: 190px;
    padding: 12px;
  }
  .action-card h3 {
    font-size: 15px;
  }
  .battle-prompt {
    margin: 12px 0;
  }
  .pack-reveal {
    grid-template-columns: repeat(2, 1fr);
  }
  .bottom {
    flex-wrap: wrap;
    font-size: 11px;
    gap: 6px;
  }
  .detail {
    grid-template-columns: 1fr;
  }
  .detail img {
    max-height: 55vh;
  }
  .welcome-strip {
    gap: 20px;
  }
  .result h1 {
    font-size: 44px;
  }
  .reward-options button {
    width: 100%;
  }
  .auth {
    margin: 10px auto;
  }
  .deck-summary {
    position: static;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
