:root {
  color-scheme: dark;
  --bg: #101113;
  --panel: #181a1f;
  --panel-2: #20232a;
  --line: #343944;
  --line-strong: #525a6a;
  --text: #f5f1e8;
  --muted: #b8b0a2;
  --dim: #807a70;
  --red: #e5483f;
  --gold: #d5a246;
  --cyan: #4fb7c7;
  --green: #54b96f;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(229, 72, 63, 0.14), transparent 27rem),
    radial-gradient(circle at 88% 4%, rgba(79, 183, 199, 0.11), transparent 25rem),
    linear-gradient(135deg, var(--bg), #17130f 55%, #0c1012);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
label.file-action {
  user-select: none;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.board-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  padding-bottom: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 84px;
}

.topbar h1 {
  margin: 0;
  font-size: 2.1rem;
  font-weight: 850;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions,
.board-actions,
.editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-button,
.solid-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 800;
}

.solid-button {
  border-color: transparent;
  background: linear-gradient(135deg, var(--red), #f2763f);
  color: #fff9f1;
  box-shadow: 0 12px 28px rgba(229, 72, 63, 0.22);
}

.ghost-button:hover,
.character-card:hover {
  border-color: var(--line-strong);
}

.solid-button:hover {
  filter: brightness(1.06);
}

.file-action {
  position: relative;
  cursor: pointer;
}

.file-action input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toolbar {
  position: sticky;
  z-index: 3;
  top: 0;
  display: grid;
  grid-template-columns: minmax(240px, 360px) 1fr;
  gap: 14px;
  align-items: end;
  padding: 14px 0 18px;
  background: linear-gradient(180deg, rgba(16, 17, 19, 0.96), rgba(16, 17, 19, 0.72));
  backdrop-filter: blur(16px);
}

.search-box {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.search-box input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.search-box input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(79, 183, 199, 0.16);
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.filter-tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 850;
}

.filter-tab.is-active {
  border-color: rgba(229, 72, 63, 0.75);
  color: #fff;
  background: rgba(229, 72, 63, 0.18);
}

.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 12px;
  padding-top: 10px;
}

.character-card {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 194px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: #111318;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
}

.character-image-link:focus-visible,
.character-name-link:focus-visible,
.ghost-button:focus-visible,
.solid-button:focus-visible,
.filter-tab:focus-visible,
.add-card-button:focus-visible,
.mini-button:focus-visible,
.inline-move:focus-visible,
.move-chip:focus-visible,
.move-chip-label:focus-visible,
.move-chip-remove:focus-visible,
.move-result:focus-visible,
.move-filter select:focus-visible,
.sidestep-badge:focus-visible,
.sidestep-select:focus-visible {
  outline: 3px solid rgba(79, 183, 199, 0.38);
  outline-offset: 2px;
}

.character-image-link {
  display: block;
}

.character-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #07080a;
}

.character-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 46px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 9px;
  background: rgba(16, 17, 19, 0.96);
}

.character-name-link {
  min-width: 0;
}

.character-footer h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.1;
}

.sidestep-badge {
  display: inline-flex;
  min-width: 44px;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(184, 176, 162, 0.35);
  border-radius: 6px;
  padding: 0 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.78rem;
  font-weight: 950;
  cursor: pointer;
}

.sidestep-badge.is-ssl {
  border-color: rgba(229, 72, 63, 0.62);
  color: #fff0ee;
  background: rgba(229, 72, 63, 0.22);
}

.sidestep-badge.is-ssr {
  border-color: rgba(79, 183, 199, 0.62);
  color: #e9fbff;
  background: rgba(79, 183, 199, 0.22);
}

.sidestep-badge.is-dont-ss {
  border-color: rgba(213, 162, 70, 0.62);
  color: #fff6df;
  background: rgba(213, 162, 70, 0.2);
}

.sidestep-badge.is-unknown {
  border-color: rgba(184, 176, 162, 0.35);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
}

.sidestep-badge.large {
  min-width: 58px;
  min-height: 36px;
  font-size: 0.98rem;
}

.sidestep-select {
  width: 88px;
  min-height: 30px;
  border: 1px solid var(--cyan);
  border-radius: 6px;
  outline: none;
  padding: 0 6px;
  color: var(--text);
  background: #101318;
  font-size: 0.76rem;
  font-weight: 850;
}

.sidestep-select.large {
  width: 118px;
  min-height: 38px;
  font-size: 0.92rem;
}

.sidestep-control {
  display: inline-flex;
  align-items: center;
}

.empty-state,
.not-found {
  display: grid;
  min-height: 260px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 850;
}

.not-found {
  align-content: center;
  gap: 14px;
}

.not-found h1 {
  margin: 0;
  color: var(--text);
}

.board-page .topbar {
  position: sticky;
  z-index: 4;
  top: 0;
  min-height: 112px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 17, 19, 0.92);
  backdrop-filter: blur(16px);
}

.back-link {
  flex: 0 0 auto;
}

.fighter-summary {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.fighter-image {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  object-fit: cover;
  background: #07080a;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.board-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.board-main {
  min-height: 0;
}

.notes-panel {
  display: grid;
  gap: 10px;
  padding: 16px 0 36px;
}

.note-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}

.note-row:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.note-body-cell {
  min-width: 0;
}

.note-freeform {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.inline-move {
  display: inline;
  border: 0;
  border-radius: 5px;
  margin: 0 1px;
  padding: 1px 5px 2px;
  color: #eaffff;
  background: rgba(79, 183, 199, 0.24);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font: inherit;
  font-weight: 900;
  line-height: inherit;
}

.inline-move:hover,
.inline-move:focus-visible {
  background: rgba(79, 183, 199, 0.38);
}

.muted-text {
  color: var(--dim);
  font-size: 0.84rem;
  font-weight: 750;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-content: start;
  gap: 6px;
}

.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.compact-action {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.note-row-editor {
  grid-template-columns: 1fr;
  border-color: rgba(79, 183, 199, 0.48);
  background: #13161b;
}

.note-editor-body textarea {
  min-height: 180px;
}

.note-move-insert {
  display: grid;
  min-width: 0;
}

.row-editor-field,
.editor-stack {
  display: grid;
  gap: 7px;
}

.row-editor-field {
  width: 100%;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.row-editor-field input,
.row-editor-field textarea,
.move-search input,
.move-filter select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  padding: 8px;
  color: var(--text);
  background: #0f1114;
}

.row-editor-field textarea {
  min-height: 94px;
  resize: vertical;
}

.row-editor-field input:focus,
.row-editor-field textarea:focus,
.move-search input:focus,
.move-filter select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(79, 183, 199, 0.13);
}

.move-picker {
  position: relative;
  display: grid;
  width: 100%;
  gap: 8px;
}

.selected-moves,
.note-meta {
  display: flex;
  flex-wrap: wrap;
  min-height: 30px;
  gap: 6px;
}

.move-search {
  position: relative;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.move-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.move-count {
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.move-filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 6px;
}

.move-filter {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

.move-filter select {
  min-height: 36px;
  padding: 0 8px;
  font-size: 0.76rem;
  font-weight: 750;
}

.mini-button.move-filter-reset {
  min-height: 36px;
  align-self: end;
  padding-inline: 10px;
}

.move-results {
  position: absolute;
  z-index: 10;
  top: calc(100% + 4px);
  left: 0;
  display: grid;
  width: 100%;
  max-height: 290px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #101318;
  box-shadow: var(--shadow);
}

.move-results:empty {
  display: none;
}

.move-result,
.move-result-empty {
  padding: 9px 10px;
}

.move-result {
  display: grid;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  background: transparent;
  text-align: left;
}

.move-result:hover,
.move-result:focus-visible {
  background: rgba(79, 183, 199, 0.13);
}

.move-result strong {
  font-size: 0.86rem;
}

.move-result span,
.move-result-empty {
  color: var(--muted);
  font-size: 0.76rem;
}

.move-result-traits {
  color: var(--cyan) !important;
}

.move-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(79, 183, 199, 0.55);
  border-radius: 7px;
  color: #e9fbff;
  background: rgba(79, 183, 199, 0.16);
  font-size: 0.78rem;
  font-weight: 900;
}

button.move-chip,
.move-chip-label,
.move-chip-remove {
  border: 1px solid rgba(79, 183, 199, 0.55);
  color: #e9fbff;
  background: rgba(79, 183, 199, 0.16);
}

button.move-chip {
  padding: 0 8px;
}

.move-chip-label {
  min-height: 28px;
  border: 0;
  padding: 0 8px;
  font-weight: 900;
}

.move-chip-remove {
  min-height: 28px;
  border-width: 0 0 0 1px;
  padding: 0 7px;
  font-weight: 950;
}

.move-chip:hover,
.move-chip-label:hover,
.move-chip-remove:hover {
  filter: brightness(1.12);
}

.move-preview {
  position: fixed;
  z-index: 30;
  display: none;
  width: 360px;
  max-height: min(620px, calc(100vh - 24px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: #111318;
  box-shadow: var(--shadow);
}

.move-preview.is-visible {
  display: grid;
  gap: 10px;
}

.move-preview-media,
.move-preview-no-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: #050608;
}

.move-preview-media {
  position: relative;
  overflow: hidden;
}

.move-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.move-preview-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #050608;
  font-size: 0.82rem;
  font-weight: 850;
}

.move-preview-media.is-loaded .move-preview-loading {
  display: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.move-preview-media.has-error video {
  opacity: 0;
}

.move-preview-media.has-error .move-preview-loading {
  display: grid;
  color: var(--text);
  background: #111318;
  visibility: visible;
  opacity: 1;
}

.move-preview-no-video {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.move-preview-title {
  display: grid;
  gap: 3px;
}

.move-preview-title strong {
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.move-preview-title span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.move-preview-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  margin: 0;
  font-size: 0.8rem;
}

.move-preview-grid dt {
  color: var(--muted);
  font-weight: 850;
}

.move-preview-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.move-preview-notes {
  max-height: 142px;
  overflow: auto;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: pre-line;
}

.move-preview-link {
  justify-self: start;
  color: var(--cyan);
  font-size: 0.8rem;
  font-weight: 850;
}

.notes-empty {
  gap: 12px;
}

.notes-empty p {
  margin: 0;
}

.board {
  display: flex;
  gap: 12px;
  min-height: calc(100vh - 148px);
  overflow: auto;
  padding: 16px 0;
  scroll-snap-type: x proximity;
}

.list {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 316px;
  min-width: 316px;
  max-height: calc(100vh - 180px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  scroll-snap-align: start;
}

.list.is-drop-target {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(79, 183, 199, 0.12);
}

.list-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

.list-title-wrap {
  min-width: 0;
}

.list-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
  font-weight: 900;
}

.list-count {
  display: inline-flex;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.list-menu {
  display: flex;
  gap: 6px;
}

.list-title-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--cyan);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--text);
  background: #111316;
}

.cards {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 180px;
  overflow: auto;
  padding: 10px;
}

.note-card {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-left: 4px solid var(--priority);
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  color: var(--text);
  background: var(--panel-2);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.note-card.dragging {
  opacity: 0.46;
}

.note-card:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.note-card h4 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  line-height: 1.2;
}

.note-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 3px 6px;
  color: #f7efe2;
  background: rgba(255, 255, 255, 0.055);
  font-size: 0.7rem;
  font-weight: 850;
}

.card-actions {
  display: flex;
  gap: 6px;
}

.mini-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.76rem;
  font-weight: 850;
}

.mini-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.add-card-button {
  min-height: 40px;
  margin: 0 10px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-weight: 850;
}

.add-card-button:hover {
  color: var(--text);
  border-color: var(--cyan);
}

.card-editor {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(79, 183, 199, 0.45);
  border-radius: 8px;
  padding: 10px;
  background: #13161b;
}

.card-editor label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.card-editor input,
.card-editor textarea,
.card-editor select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  padding: 8px;
  color: var(--text);
  background: #0f1114;
}

.card-editor textarea {
  resize: vertical;
}

.card-editor input:focus,
.card-editor textarea:focus,
.card-editor select:focus {
  border-color: var(--cyan);
}

.editor-row {
  display: grid;
  grid-template-columns: minmax(105px, 0.65fr) 1fr;
  gap: 10px;
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 24px, 1500px);
    padding-top: 18px;
  }

  .topbar,
  .board-page .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 1.7rem;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .toolbar {
    grid-template-columns: 1fr;
    position: static;
  }

  .filter-tabs {
    justify-content: flex-start;
  }

  .roster {
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  }

  .character-card {
    min-height: 176px;
  }

  .fighter-summary {
    justify-content: flex-start;
  }

  .notes-panel {
    overflow-x: visible;
  }

  .note-row {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .move-results {
    width: 100%;
  }

  .move-filter-bar {
    grid-template-columns: 1fr;
  }

  .move-filter-reset {
    justify-self: start;
  }

  .move-preview {
    left: 12px !important;
    width: calc(100vw - 24px);
  }

  .board {
    min-height: calc(100vh - 240px);
  }

  .list {
    width: min(316px, calc(100vw - 36px));
    min-width: min(316px, calc(100vw - 36px));
    max-height: none;
  }

  .editor-row {
    grid-template-columns: 1fr;
  }
}
