:root {
  --bg: #f7f5ef;
  --panel: #ffffff;
  --panel-soft: #fbfaf6;
  --ink: #1f2933;
  --muted: #667085;
  --line: #ded8c8;
  --line-strong: #c9bfa9;
  --accent: #1f7a6d;
  --accent-dark: #15584f;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #027a48;
  --shadow: 0 12px 30px rgba(31, 41, 51, 0.08);
  --radius: 8px;
  --sticky-top: 72px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.loading,
.error-state {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  color: var(--muted);
}

.mobile-wip {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.mobile-wip-card {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.mobile-wip-eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.mobile-wip h1 {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.25;
}

.mobile-wip p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.7;
}

.mobile-wip-note {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  font-size: 12px;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(31, 122, 109, 0.1), transparent 36%),
    linear-gradient(315deg, rgba(180, 71, 8, 0.08), transparent 32%),
    var(--bg);
}

.auth-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 24px;
  align-items: center;
}

.auth-intro h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.05;
}

.auth-intro p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.auth-eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.auth-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-tabs button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 10px;
  font-weight: 700;
}

.auth-tabs button.active {
  border-color: var(--accent);
  background: #e8f5f1;
  color: var(--accent-dark);
}

.auth-submit {
  width: 100%;
  justify-content: center;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 72px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 245, 239, 0.96);
  backdrop-filter: blur(12px);
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.brand {
  min-width: 0;
}

.disclaimer {
  margin: 4px 0 0;
  max-width: 920px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.cloud-badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fffdf7;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  padding: 8px 10px;
}

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 12px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.button:hover {
  background: var(--accent-dark);
}

.button.secondary {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
}

.button.secondary:hover {
  background: var(--panel-soft);
}

.button.danger {
  background: var(--danger);
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 340px;
  gap: 14px;
  padding: 0 14px 14px;
  min-width: 0;
}

.preview-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.home {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.home-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
}

.compact-home-hero {
  padding: 12px 14px;
}

.home-hero h2 {
  margin: 0;
  font-size: 22px;
}

.home-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-card strong {
  font-size: 24px;
}

.home-list {
  overflow: hidden;
}

.home-list-body {
  padding: 14px;
}

.compact-home-list .home-list-body {
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
}

.compact-list-head {
  padding: 10px 12px;
}

.compact-list-head h2 {
  font-size: 16px;
}

.compact-home-search {
  gap: 6px;
}

.home-empty {
  padding: 20px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.filters,
.deck-panel {
  position: sticky;
  top: var(--sticky-top);
  max-height: calc(100vh - var(--sticky-top) - 14px);
  overflow: auto;
}

.panel-head {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.deck-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.save-dirty-badge,
.unsaved-inline {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.save-dirty-badge.saved {
  background: #e7f6ec;
  color: var(--ok);
}

.save-dirty-badge.dirty,
.unsaved-inline {
  background: #fff4e5;
  color: var(--warn);
}

.unsaved-inline {
  display: inline-block;
  margin-top: 5px;
  border-radius: 6px;
}

.panel-body {
  padding: 14px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

.textarea {
  min-height: 260px;
  resize: vertical;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.export-text-block .textarea {
  min-height: 150px;
}

.export-text-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 109, 0.12);
}

.step-list,
.chip-row,
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.step-list {
  display: grid;
  grid-template-columns: 1fr;
}

.step-btn,
.chip,
.subtab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.step-btn {
  justify-content: flex-start;
  text-align: left;
}

.step-btn.active,
.chip.active,
.subtab.active {
  border-color: var(--accent);
  background: #e4f3ef;
  color: var(--accent-dark);
}

.content-head {
  position: sticky;
  top: var(--sticky-top);
  z-index: 10;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.content-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
}

.content-title h2 {
  margin: 0;
  font-size: 18px;
}

.summary-line {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.mobile-filter-grid {
  display: none;
}

.mobile-only-controls {
  display: none;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  padding: 14px;
  min-width: 0;
}

.card-item {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 12px;
}

.card-thumb {
  display: block;
  width: 78px;
  height: 109px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eee8da;
  padding: 0;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-item.selected {
  border-color: var(--accent);
  background: #eef8f5;
}

.card-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.card-name-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

.card-name {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.card-subtitle {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

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

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 3px 7px;
  font-size: 12px;
}

.color-red { color: #b42318; }
.color-orange { color: #c2410c; }
.color-yellow { color: #a16207; }
.color-green { color: #027a48; }
.color-blue { color: #175cd3; }
.color-purple { color: #6941c6; }
.color-colorless { color: #667085; }

.effect {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-all;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  white-space: pre-line;
}

.card-blocked-reason {
  border-radius: 5px;
  background: #fff4e5;
  color: var(--warn);
  font-size: 12px;
  line-height: 1.4;
  padding: 5px 7px;
}

.card-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.counter {
  display: inline-grid;
  min-width: 32px;
  min-height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-weight: 800;
}

.icon-btn {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.icon-btn:hover {
  background: #f0eee7;
}

.deck-section {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.deck-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.button.compact {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}

.deck-section:last-child {
  border-bottom: 0;
}

.deck-section h4 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 8px;
  font-size: 14px;
}

.deck-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.deck-row-editable {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.deck-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.deck-row-card {
  min-width: 0;
}

.deck-row-no {
  justify-self: end;
  white-space: nowrap;
}

.deck-row-actions {
  display: inline-flex;
  gap: 4px;
  flex: 0 0 auto;
}

.mini-icon-btn {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.mini-icon-btn:hover:not(:disabled) {
  background: #f0eee7;
  border-color: var(--line-strong);
}

.mini-icon-btn:disabled {
  color: #b8b0a3;
  cursor: not-allowed;
  opacity: 0.6;
}

.deck-row strong {
  color: var(--ink);
}

.curve-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
  align-items: end;
}

.curve-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.curve-count,
.curve-label {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.curve-bar-wrap {
  display: flex;
  align-items: end;
  justify-content: center;
  height: 76px;
  border-radius: 5px;
  background: #f2efe6;
  overflow: hidden;
}

.curve-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 5px 5px 0 0;
  background: var(--accent);
}

.type-stat-list {
  display: grid;
  gap: 7px;
}

.type-stat-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 24px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.type-stat-row strong {
  color: var(--ink);
  text-align: right;
}

.type-stat-track {
  height: 8px;
  border-radius: 999px;
  background: #f2efe6;
  overflow: hidden;
}

.type-stat-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--accent);
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

.status-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
}

.status-item.clickable {
  cursor: pointer;
}

.status-item.clickable:hover {
  filter: brightness(0.98);
}

.status-item strong {
  flex: 0 0 auto;
  font-size: 12px;
}

.status-item.ok {
  background: #e7f6ec;
  color: var(--ok);
}

.status-item.warn {
  background: #fff4e5;
  color: var(--warn);
}

.status-item.error {
  background: #fee4e2;
  color: var(--danger);
}

.save-status-card {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  padding: 12px;
}

.save-status-card div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.save-status-card span {
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

.save-status-card strong {
  font-size: 20px;
}

.save-status-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.save-status-card.ok {
  background: #e7f6ec;
  color: var(--ok);
}

.save-status-card.warn {
  background: #fff4e5;
  color: var(--warn);
}

.save-status-card.error {
  background: #fee4e2;
  color: var(--danger);
}

.save-count-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-curve {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.export-warning {
  border-left: 3px solid var(--warn);
  background: #fff8e6;
  padding: 9px 10px;
}

.bottom-tabs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: none;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.bottom-tabs button {
  min-height: 58px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bottom-tabs button.active {
  color: var(--accent-dark);
  background: #e4f3ef;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.modal {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.26);
}

.modal-head,
.modal-foot {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.modal-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hidden-file-input {
  display: none;
}

.filter-reset {
  width: 100%;
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.modal-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.section-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--line);
}

.invite-create-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1.2fr;
  gap: 10px;
  align-items: end;
}

.invite-list {
  display: grid;
  gap: 8px;
}

.invite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.legend-undo,
.legend-change-card {
  display: grid;
  gap: 10px;
  margin: 12px 14px;
  padding: 12px;
  border: 1px solid #d6a83d;
  border-radius: 8px;
  background: #fff8e6;
}

.legend-undo .button {
  justify-self: start;
}

.removal-list {
  display: grid;
  gap: 10px;
}

.removal-group {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.removal-group h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.removal-group ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.removal-group li {
  color: var(--ink);
  font-size: 13px;
}

.removal-group li span {
  color: var(--muted);
  font-weight: 800;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.detail-facts div {
  display: grid;
  gap: 3px;
  min-width: 0;
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 9px 10px;
}

.detail-facts .wide {
  grid-column: 1 / -1;
}

.detail-facts span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-facts strong {
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.card-image-frame {
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #eee8da;
  padding: 10px;
}

.card-image-frame img {
  display: block;
  width: min(100%, 360px);
  max-height: 72vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.library-list {
  display: grid;
  gap: 10px;
}

.compact-deck-list {
  grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
  align-items: start;
}

.library-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 12px;
}

.compact-library-card {
  grid-template-columns: 1fr;
  min-height: 0;
  padding: 10px 12px;
}

.library-card-main {
  min-width: 0;
}

.library-card h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.compact-library-card h4 {
  margin-bottom: 4px;
  font-size: 15px;
}

.library-meta {
  margin-top: 6px;
}

.library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.compact-library-card .library-actions {
  justify-content: flex-start;
  align-items: center;
  padding-top: 2px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 84px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 6px;
  background: #1f2933;
  color: #fff;
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-intro h1 {
    font-size: 36px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .top-actions {
    overflow-x: auto;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 0 10px 10px;
  }

  .home {
    padding: 10px;
  }

  .home-hero {
    align-items: flex-start;
  }

  .filters,
  .deck-panel {
    position: static;
    max-height: none;
  }

  .filters {
    order: 1;
  }

  .content-panel {
    order: 2;
  }

  .deck-panel {
    order: 3;
  }
}

@media (max-width: 720px) {
  .auth-gate {
    align-items: start;
    padding: 16px;
  }

  .auth-intro h1 {
    font-size: 30px;
  }

  .auth-panel {
    gap: 16px;
  }

  .app-shell {
    padding-bottom: 64px;
  }

  .topbar {
    padding: 12px;
  }

  .brand h1 {
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  .disclaimer {
    font-size: 11px;
    max-width: 100%;
    word-break: break-all;
  }

  .layout {
    padding: 0 8px 8px;
    overflow-x: hidden;
  }

  .home {
    padding: 8px;
  }

  .home-hero,
  .home-actions {
    display: grid;
    justify-content: stretch;
  }

  .home-stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .content-panel,
  .panel {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }

  .content-head {
    overflow: hidden;
  }

  .mobile-filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mobile-only-controls {
    display: grid;
  }

  .mobile-filter-grid .field {
    margin-bottom: 0;
  }

  .filters {
    display: none;
  }

  .deck-panel {
    display: none;
  }

  .card-grid {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .card-item {
    grid-template-columns: 72px minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .card-thumb {
    width: 72px;
    height: 101px;
  }

  .bottom-tabs {
    display: grid;
  }

  .top-actions .button.secondary:not(.mobile-keep) {
    display: none;
  }

  .content-title {
    display: grid;
    justify-content: stretch;
  }

  .card-actions {
    display: flex;
    justify-content: flex-start;
  }

  .card-actions > div {
    display: flex;
    gap: 8px;
  }

  .library-card {
    grid-template-columns: 1fr;
  }

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

  .save-count-list {
    grid-template-columns: 1fr;
  }
}
