:root {
  color-scheme: dark;
  --bg: #101216;
  --panel: #1c2026;
  --text: #f3efe6;
  --muted: #b7b1a6;
  --line: #7a6844;
  --gold: #7a6844;
  --accent: #8e2428;
  --accent-text: #fff8f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font: 1.125rem/1.45 "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

main {
  margin: 0 auto;
  padding: 0.55rem 0.75rem 0.5rem;
}

.start {
  max-width: 40rem;
  margin: 0 auto;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.note {
  color: var(--muted);
}

form,
section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  margin: 0 0 0.3rem;
}

.start form {
  margin-top: 1rem;
  padding: 1rem;
}

.start .settings h2 {
  margin-bottom: 0.35rem;
}

.start .settings h3 {
  margin-bottom: 0.25rem;
}

.start .settings .note {
  margin-bottom: 0.6rem;
}

.titlebar {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.titlebar h1,
.titlebar p {
  margin-bottom: 0;
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem);
  gap: 0.7rem;
  align-items: start;
}

.board {
  line-height: 1.22;
}

.board p {
  margin-bottom: 0;
}

.board article > p,
.attack p {
  line-height: 1.6rem;
}

.attack {
  margin-left: 0.85rem;
}

.attack + .attack {
  margin-top: 0.2rem;
  padding-top: 0.3rem;
  border-top: 1px dashed var(--gold);
}

.enemy-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.9rem;
  margin-top: 0.2rem;
}

.enemy-list h3,
.enemy-list .attack p,
.mini-card h3,
.mini-card .attack p,
.mini-card > p {
  line-height: 1.35;
}

.enemy-list .attack,
.mini-card .attack {
  margin-left: 0;
}

.enemy-list .attack + .attack,
.mini-card .attack + .attack {
  margin-top: 0.12rem;
  padding-top: 0;
  border-top: 0;
}

.enemy-list article {
  border-top: 1px solid var(--line);
  padding-top: 0.15rem;
}

.enemy-list article:nth-child(even) {
  border-left: 1px solid var(--line);
  padding-left: 0.4rem;
}

.board .enemy-list article + article {
  margin-top: 0;
  border-top: 1px solid var(--line);
}

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.45rem;
}

.mini-actions button {
  width: auto;
  flex: 0 0 auto;
}

.board h2 {
  font-size: 1.1rem;
  margin-bottom: 0;
}

.board h3,
.column > section > h2 {
  margin-bottom: 0;
  line-height: 1.6rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 1.6rem;
}

.section-head h2,
.section-head h3 {
  margin-bottom: 0;
  line-height: 1.6rem;
}

.folds {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.pile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 0.75rem;
  align-items: start;
}

.pile-copy > h2,
.pile-copy > h3,
.pile-copy > p,
.pile-copy > .section-head {
  height: 1.6rem;
  margin: 0;
  line-height: 1.6rem;
}

.pile-copy > p.deck-card-text {
  height: auto;
  margin-top: 0.15rem;
  line-height: 1.35;
}

.pile-copy > p.blade-name {
  height: auto;
  min-height: 1.6rem;
}

.pile-copy > ul,
.pile-copy > ol {
  margin: 0;
}

.pile-actions {
  display: grid;
  grid-auto-rows: 1.6rem;
}

.pile-actions .row-2 {
  grid-row: 2;
}

.pile-actions .row-3 {
  grid-row: 3;
}

.pile-actions.boss {
  grid-template-columns: auto auto;
  column-gap: 0.35rem;
}

.pile-actions.boss > .draw,
.pile-actions.boss > .phase,
.pile-actions.boss > .shuffle {
  grid-column: 2;
}

button.return,
button.shuffle {
  width: auto;
  height: 1.6rem;
  min-height: 1.6rem;
  padding: 0 0.7rem;
  font-size: 0.95rem;
  line-height: 1.6rem;
  white-space: nowrap;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  opacity: 1;
}

.boss-row {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 0.55rem;
  align-items: start;
  margin-top: 0;
}

.boss-current {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}

.boss-current.photo {
  padding: 0;
  background: transparent;
  border: 0;
}

.boss-current img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 34rem;
}

.boss-card-name {
  font-weight: 700;
}

button.draw {
  width: auto;
  height: 1.6rem;
  min-height: 1.6rem;
  padding: 0 0.7rem;
  font-size: 0.95rem;
  line-height: 1.6rem;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
}

.drawn {
  margin-top: 0;
}

.fixed-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.35rem;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: -0.12rem;
}

button.phase,
button.trigger {
  width: auto;
  height: 1.6rem;
  min-height: 1.6rem;
  padding: 0 0.7rem;
  font-size: 0.95rem;
  line-height: 1.6rem;
  white-space: nowrap;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.triggers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

button.fold {
  width: auto;
  height: 1.6rem;
  min-height: 1.6rem;
  padding: 0 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.away {
  position: fixed;
  right: 0.7rem;
  bottom: 0.35rem;
  z-index: 2;
  max-width: 16rem;
}

.away p {
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

label {
  display: block;
  margin-bottom: 0.9rem;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0;
  min-height: 2.6rem;
}

.checks input {
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  accent-color: var(--accent);
}

select,
button {
  font: inherit;
  min-height: 3rem;
}

select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.4rem 0.6rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

form button {
  width: 100%;
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
  border-radius: 10px;
  padding: 0.6rem 1rem;
}

button.quiet {
  width: auto;
  min-height: 0;
  padding: 0.1rem 0.35rem;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--muted);
  background: transparent;
  border: 0;
  opacity: 0.45;
}

.away.asking {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  max-width: 24rem;
}

.away .row button {
  min-height: 2rem;
  font-size: 0.85rem;
  opacity: 1;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
}

.away .row button.quiet {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

button.quiet:hover,
button.quiet:focus-visible {
  opacity: 1;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.errors {
  color: #ffd0c8;
}

.errors ul {
  margin: 0;
  padding-left: 1.2rem;
}

.errors li + li {
  margin-top: 0.45rem;
}

.board article + article {
  margin-top: 0.15rem;
  padding-top: 0.15rem;
  border-top: 1px solid var(--line);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.away .row button.choice {
  flex: 1 1 100%;
}

.row button {
  flex: 1;
}

ul {
  margin-bottom: 0;
  padding-left: 1.2rem;
}

[role="alert"]:focus {
  outline: none;
}

@media (max-width: 1100px) {
  .columns,
  .enemy-list {
    grid-template-columns: 1fr;
  }

  .enemy-list article:nth-child(even) {
    border-left: 0;
    padding-left: 0;
  }
}
