:root {
  color-scheme: light;
  --bg: #0f1110;
  --bg-soft: #151815;
  --surface: #1c201c;
  --surface-alt: #222724;
  --stroke: rgba(255, 255, 255, 0.08);
  --text: #f1f4ee;
  --muted: #b1b8ad;
  --accent: #e0a852;
  --accent-strong: #f4c06f;
  --danger: #d4634a;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --gap: 24px;
  --font-title: "Cormorant Garamond", "Times New Roman", serif;
  --font-body: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --token-font-ui: "Avenir Next", "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI",
    "Yu Gothic", "Meiryo", sans-serif;
  --token-font-heavy: "Arial Black", "Avenir Next", "Hiragino Kaku Gothic ProN", "Yu Gothic UI",
    "Yu Gothic", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  background: radial-gradient(circle at top left, rgba(224, 168, 82, 0.12), transparent 55%),
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.08), transparent 40%),
    linear-gradient(140deg, #0f1110, #0b0d0c 55%, #151815 100%);
  color: var(--text);
  padding: 48px clamp(24px, 5vw, 72px) 64px;
}

.bg-orbit {
  position: fixed;
  inset: -120px 40% auto auto;
  width: 420px;
  height: 420px;
  background: conic-gradient(from 180deg, rgba(224, 168, 82, 0.22), transparent 40%, rgba(224, 168, 82, 0.12));
  border-radius: 50%;
  filter: blur(0.2px);
  opacity: 0.7;
  z-index: -1;
  animation: orbit 18s linear infinite;
}

@keyframes orbit {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}

.site-top-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.site-top-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(224, 168, 82, 0.35);
  border-radius: 999px;
  background: rgba(224, 168, 82, 0.08);
  color: var(--accent-strong);
  font-size: 12px;
  text-decoration: none;
  letter-spacing: 0.06em;
}

.site-top-links a:hover {
  border-color: rgba(224, 168, 82, 0.6);
  background: rgba(224, 168, 82, 0.16);
}

.brand {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-copy {
  display: grid;
  gap: 4px;
}

.brand-subcopy {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(224, 168, 82, 0.35), rgba(244, 192, 111, 0.12));
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 18px;
  box-shadow: var(--shadow);
}

.brand-eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.24em;
  opacity: 0.9;
}

.brand h1 {
  font-family: var(--font-title);
  font-size: clamp(34px, 4vw, 56px);
  letter-spacing: 0.04em;
  line-height: 0.95;
  font-weight: 700;
  text-shadow: 0 6px 20px rgba(224, 168, 82, 0.24);
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.view-tabs {
  display: flex;
  gap: 8px;
  background: var(--surface);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
}

.view-tabs button,
.view-tabs a {
  background: transparent;
  color: var(--muted);
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
}

.view-tabs button.active,
.view-tabs a.active,
.view-tabs a[aria-current="page"] {
  background: rgba(224, 168, 82, 0.18);
  color: var(--text);
  border-color: rgba(224, 168, 82, 0.4);
}

.bottom-tab-bar {
  display: none;
}

.bottom-tab-link {
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.layout {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.workspace-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}

.workspace-status {
  display: grid;
  gap: 22px;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(224, 168, 82, 0.12), rgba(255, 255, 255, 0.02)),
    rgba(22, 25, 22, 0.92);
}

.workspace-status-copy {
  display: grid;
  gap: 8px;
  max-width: 860px;
}

.workspace-status-eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
}

.workspace-status-copy h2 {
  font-family: var(--font-title);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.08;
}

.workspace-status-copy p:last-child {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.workspace-status-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(180px, 0.8fr)) minmax(0, 1.2fr);
}

.workspace-status-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 10, 9, 0.28);
}

.workspace-status-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace-status-card > strong {
  font-size: 18px;
  line-height: 1.35;
  word-break: break-word;
}

.workspace-status-list {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.workspace-status-list strong {
  color: var(--text);
  font-size: 14px;
}

.workspace-status-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-status-stats article {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.workspace-status-stats span {
  color: var(--muted);
  font-size: 12px;
}

.workspace-status-stats strong {
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
}

.workspace-status-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  word-break: break-word;
}

.workspace-status-card-actions {
  align-content: start;
}

.workspace-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-status-actions button {
  flex: 1 1 160px;
}

.workspace-main {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.95fr);
  align-items: start;
}

.workspace-build,
.workspace-prep,
.workspace-support {
  display: grid;
  gap: 24px;
}

.workspace-prep {
  align-self: start;
}

.tournament-prep {
  gap: 18px;
}

.prep-subsection {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.prep-subsection-head {
  display: grid;
  gap: 6px;
}

.prep-subsection-head h3 {
  font-size: 16px;
}

.prep-subsection-head p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.workspace-support {
  gap: 20px;
}

.workspace-support-head {
  display: grid;
  gap: 6px;
  padding: 0 4px;
}

.workspace-support-head h2 {
  font-family: var(--font-title);
  font-size: clamp(24px, 2.8vw, 32px);
}

.workspace-support-head p {
  color: var(--muted);
  font-size: 14px;
}

.workspace-support-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}

.day-mode-header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.day-mode-main {
  align-items: start;
}

.day-mode-round-panel,
.day-mode-sidebar {
  display: grid;
  gap: 16px;
}

.day-mode-matchup-bar {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.day-mode-chip-groups {
  display: grid;
  gap: 14px;
}

.day-mode-chip-group {
  display: grid;
  gap: 8px;
}

.day-mode-chip-group h3,
.day-mode-io-card h3,
.day-mode-note-card h3,
.day-mode-round-memo h3 {
  font-size: 14px;
}

.day-mode-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.day-mode-chip {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.day-mode-chip.active {
  border-color: rgba(224, 168, 82, 0.55);
  background: rgba(224, 168, 82, 0.18);
}

.day-mode-chip-empty,
.day-mode-inline-note,
.day-mode-entry-empty {
  color: var(--muted);
  font-size: 12px;
}

.day-mode-toggle-row {
  display: grid;
  gap: 10px;
}

.day-mode-playdraw {
  width: fit-content;
}

.day-mode-empty {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px dashed var(--stroke);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.day-mode-io-grid,
.day-mode-notes-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.day-mode-io-card,
.day-mode-note-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
}

.day-mode-entry-list {
  display: grid;
  gap: 8px;
}

.day-mode-entry-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.12);
}

.day-mode-entry-qty {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.day-mode-entry-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.day-mode-note-card p,
.day-mode-log-item-note {
  white-space: pre-wrap;
  word-break: break-word;
}

.day-mode-round-memo {
  display: grid;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid var(--stroke);
}

.day-mode-round-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.day-mode-round-note-field {
  grid-column: 1 / -1;
}

.day-mode-round-actions,
.day-mode-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.day-mode-qr-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.day-mode-qr-panel a {
  color: var(--accent);
  word-break: break-all;
}

.day-mode-qr-image {
  width: min(220px, 100%);
  aspect-ratio: 1;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  padding: 10px;
}

.day-mode-support-grid {
  align-items: start;
}

.day-mode-log-filters {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.day-mode-log-list {
  display: grid;
  gap: 10px;
}

.day-mode-log-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
}

.day-mode-log-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.day-mode-log-item-head strong {
  font-size: 14px;
}

.day-mode-log-item-head span,
.day-mode-log-item-meta {
  color: var(--muted);
  font-size: 12px;
}

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

.page-helper-panel {
  padding-bottom: 18px;
}

.layout > .io.view-builder {
  order: 1;
}

.layout > .deck.view-builder {
  order: 2;
}

.layout > .stats.view-builder {
  order: 3;
}

.layout > .search.view-builder {
  order: 4;
}

.layout > .meta.view-builder {
  order: 5;
}

.about-main {
  max-width: 980px;
  margin: 0 auto;
}

.about-panel {
  display: grid;
  gap: 24px;
}

.about-block {
  display: grid;
  gap: 10px;
}

.about-notice {
  padding: 14px 16px;
  border: 1px solid rgba(224, 168, 82, 0.42);
  border-radius: var(--radius-md);
  background: rgba(224, 168, 82, 0.08);
}

.about-notice a {
  color: var(--accent-strong);
}

.about-block h2 {
  font-family: var(--font-title);
  font-size: clamp(22px, 2.6vw, 30px);
  letter-spacing: 0.02em;
}

.about-block h3 {
  font-family: var(--font-title);
  font-size: clamp(18px, 2.1vw, 24px);
  letter-spacing: 0.01em;
  margin-top: 8px;
}

.about-block p {
  color: var(--text);
  font-size: 15px;
  line-height: 1.86;
}

.about-block a {
  color: var(--accent-strong);
}

.about-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
  padding: 0.15em 0.35em;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
}

.updates-panel {
  gap: 18px;
}

.updates-intro {
  padding-bottom: 4px;
}

.release-entry {
  display: grid;
  gap: 8px;
  padding: 18px 0 18px 18px;
  border-left: 2px solid rgba(224, 168, 82, 0.42);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.release-entry:last-child {
  border-bottom: 0;
}

.release-entry h2 {
  color: var(--accent-strong);
  font-family: var(--font-title);
  font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: 0.03em;
}

.release-entry p {
  color: var(--text);
  font-size: 15px;
  line-height: 1.82;
}

.about-footer {
  max-width: 980px;
  margin: 28px auto 0;
  padding: 0 4px 20px;
  color: var(--muted);
  font-size: 12px;
}

.card {
  background: rgba(22, 25, 22, 0.85);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: reveal 0.6s ease both;
}

.card:nth-child(2) {
  animation-delay: 0.08s;
}

.card:nth-child(3) {
  animation-delay: 0.16s;
}

.card:nth-child(4) {
  animation-delay: 0.24s;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.panel-head-inline {
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
}

.panel-head-inline > div:first-child {
  display: grid;
  gap: 8px;
}

.panel-head h2 {
  font-family: var(--font-title);
  font-size: 24px;
}

.panel-head p {
  color: var(--muted);
  font-size: 14px;
}

.panel-help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.panel-help-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.page-helper-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-help-link-inline {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 196, 93, 0.28);
  border-radius: 999px;
  background: rgba(255, 196, 93, 0.08);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 196, 93, 0.05);
}

.panel-help-link-inline:hover {
  background: rgba(255, 196, 93, 0.14);
  color: #ffd28a;
  text-decoration: underline;
}

.guide-article .panel-head {
  margin-bottom: 0;
}

.guide-article h3 {
  font-size: 18px;
}

.guide-article h4 {
  margin: 18px 0 8px;
  font-size: 15px;
}

.guide-article p {
  line-height: 1.8;
}

.guide-manual {
  display: grid;
  gap: 24px;
}

.guide-meta,
.guide-summary {
  margin: 0;
  padding: 14px 16px;
  border-left: 3px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.guide-meta p,
.guide-summary p {
  margin: 0;
}

.guide-meta p + p,
.guide-summary p + p {
  margin-top: 8px;
}

.guide-toc {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

.guide-toc h3 {
  margin: 0;
  font-size: 16px;
}

.guide-toc-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 14px;
}

.guide-toc-links a {
  color: var(--text);
  text-decoration: none;
  line-height: 1.6;
}

.guide-toc-links a:hover {
  text-decoration: underline;
}

.guide-divider {
  width: 100%;
  height: 1px;
  margin: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
}

.guide-table-wrap {
  overflow-x: auto;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.guide-table th,
.guide-table td {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  vertical-align: top;
  line-height: 1.7;
}

.guide-table th {
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
}

.guide-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}

.guide-list li + li {
  margin-top: 6px;
}

.guide-ordered {
  padding-left: 24px;
}

.guide-note {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.guide-note strong {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.guide-note p {
  margin: 0;
}

.guide-tip {
  background: rgba(120, 187, 255, 0.08);
  border-color: rgba(120, 187, 255, 0.2);
}

.guide-important {
  background: rgba(255, 196, 93, 0.08);
  border-color: rgba(255, 196, 93, 0.24);
}

.guide-warning {
  background: rgba(255, 128, 128, 0.08);
  border-color: rgba(255, 128, 128, 0.22);
}

.guide-note-neutral {
  background: rgba(255, 255, 255, 0.04);
}

.guide-flow {
  margin: 10px 0 0;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(8, 10, 13, 0.72);
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

.guide-mobile-toc {
  display: none;
}

@media (max-width: 720px) {
  body[data-page="goldfish-guide"] {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .guide-mobile-toc {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 1100;
    display: block;
  }

  .guide-mobile-toc > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(18, 20, 24, 0.94);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    color: var(--text);
    font-weight: 700;
    list-style: none;
    cursor: pointer;
  }

  .guide-mobile-toc > summary::-webkit-details-marker {
    display: none;
  }

  .guide-mobile-toc[open] > summary {
    background: rgba(44, 36, 22, 0.96);
    border-color: rgba(255, 196, 93, 0.26);
  }

  .guide-mobile-toc-sheet {
    display: grid;
    gap: 10px;
    width: min(320px, calc(100vw - 32px));
    max-height: min(62vh, 520px);
    margin-top: 10px;
    padding: 14px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    background: rgba(18, 20, 24, 0.98);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  }

  .guide-mobile-toc-sheet a {
    color: var(--text);
    text-decoration: none;
    line-height: 1.5;
  }

  .guide-mobile-toc-sheet a:hover {
    text-decoration: underline;
  }
}

.search-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 16px;
}

.format-bar {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(260px, 1fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}

.format-bar label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.standard-set-filter {
  position: relative;
  display: grid;
  gap: 6px;
}

.standard-set-filter[hidden] {
  display: none;
}

.standard-set-filter p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.standard-set-show-all {
  width: 100%;
  justify-content: center;
  min-height: 40px;
  line-height: 1.35;
}

.standard-set-show-all[hidden] {
  display: none;
}

.standard-set-picker {
  position: relative;
}

.standard-set-select-native {
  display: none;
}

.standard-set-picker-button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--stroke);
  padding: 10px 12px;
}

.standard-set-picker-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.standard-set-picker-button > span:first-child {
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-height: 1.35;
  white-space: normal;
}

.standard-set-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(52vh, 440px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: rgba(18, 20, 24, 0.99);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42);
}

.standard-set-options[hidden] {
  display: none;
}

.standard-set-group-label {
  padding: 8px 10px 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.standard-set-option-group + .standard-set-option-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--stroke);
}

.standard-set-option {
  width: 100%;
  display: block;
  padding: 9px 10px;
  text-align: left;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.standard-set-option:hover,
.standard-set-option[aria-selected="true"] {
  background: rgba(224, 168, 82, 0.16);
}

.standard-set-option-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: normal;
  line-height: 1.35;
}

.standard-set-option-code {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

@media (max-width: 680px) {
  .format-bar {
    grid-template-columns: 1fr;
  }
}

input[type="search"],
input[type="file"] {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

input[type="text"],
input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

button {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button-link:hover {
  transform: translateY(-1px);
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #221d12;
  font-weight: 600;
}

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--stroke);
}

.danger {
  background: rgba(212, 99, 74, 0.18);
  color: #f3c4b3;
  border: 1px solid rgba(212, 99, 74, 0.4);
}

.search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.search-preview-tools {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(224, 168, 82, 0.24);
  background: rgba(224, 168, 82, 0.08);
}

.search-preview-copy {
  display: grid;
  gap: 6px;
}

.search-preview-copy h3 {
  margin: 0;
  font-size: 14px;
}

.search-preview-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.search-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.search-preview-filter {
  display: grid;
  gap: 6px;
  max-width: 280px;
  font-size: 12px;
  color: var(--muted);
}

.search-preview-filter select {
  min-width: 0;
}

.chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 12px;
}

.chip.active {
  background: rgba(224, 168, 82, 0.18);
  color: var(--text);
  border-color: rgba(224, 168, 82, 0.4);
}

.search-results {
  display: grid;
  gap: 12px;
}

.result-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  border: 1px solid var(--stroke);
}

.thumb {
  width: 60px;
  height: 86px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(224, 168, 82, 0.35), rgba(255, 255, 255, 0.08));
  background-size: cover;
  background-position: center;
  overflow: hidden;
  display: block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  transform-origin: left center;
  z-index: 0;
}

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

.result-card {
  position: relative;
}

.thumb.is-zoomed {
  transform: scale(6);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

@media (hover: hover) and (pointer: fine) {
  .thumb:hover,
  .thumb:focus {
    transform: scale(6);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
    z-index: 2;
  }
}

.thumb.alt {
  background: linear-gradient(135deg, rgba(160, 88, 200, 0.35), rgba(255, 255, 255, 0.08));
}

.thumb.land {
  background: linear-gradient(135deg, rgba(118, 160, 98, 0.4), rgba(255, 255, 255, 0.08));
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
}

.status-badge.preview {
  border-color: rgba(224, 168, 82, 0.35);
  background: rgba(224, 168, 82, 0.16);
  color: #f6d49a;
}

.preview-image-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-16deg);
  z-index: 3;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 237, 204, 0.78);
  background: rgba(114, 57, 20, 0.82);
  color: #fff7ea;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  white-space: nowrap;
}

.result-actions {
  display: grid;
  gap: 6px;
}

.search-empty {
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--stroke);
  color: var(--muted);
  font-size: 13px;
}

.deck-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.deck-view-toggle {
  display: flex;
  gap: 8px;
  background: var(--surface);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
}

.deck-view-toggle button {
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
}

.deck-view-toggle button.active {
  background: rgba(224, 168, 82, 0.18);
  color: var(--text);
  border-color: rgba(224, 168, 82, 0.4);
}

.format-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  border-left: 2px solid rgba(224, 168, 82, 0.4);
  padding-left: 10px;
}

.io-toolbar {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(26, 30, 27, 0.62);
  display: grid;
  gap: 10px;
}

.io-toolbar-matchup {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.io-toolbar-matchup select {
  width: 100%;
  max-width: 100%;
}

.io-toolbar-matchup input {
  width: 100%;
  max-width: 100%;
}

.io-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.io-counts {
  font-size: 12px;
  color: var(--muted);
  border-left: 2px solid rgba(224, 168, 82, 0.4);
  padding-left: 10px;
}

.io-counts.is-warning {
  color: #f1d19d;
}

.io-notes {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.io-notes label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.io-notes textarea {
  min-height: 76px;
  resize: vertical;
  font-size: inherit;
  line-height: 1.5;
}

.io-selection {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(26, 30, 27, 0.62);
  display: grid;
  gap: 10px;
}

.io-selection h4 {
  margin: 0;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.io-selection-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.io-selection-col {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 10px;
  background: rgba(12, 15, 13, 0.35);
}

.io-selection-col h5 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.io-selection-item {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.io-selection-empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.sort {
  display: flex;
  gap: 8px;
}

.deck-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.deck-expand-toggle {
  margin-left: auto;
  white-space: nowrap;
}

.deck-category-section {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.deck-category-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding-bottom: 6px;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.1em;
  border-bottom: 1px solid rgba(224, 168, 82, 0.28);
}

.deck-cmc-group {
  display: grid;
  gap: 6px;
}

.deck-cmc-heading {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.deck-expanded-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.deck-expanded-zone {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(224, 168, 82, 0.28);
  border-radius: 14px;
  background: rgba(12, 15, 13, 0.48);
}

.deck-expanded-zone-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-size: 17px;
}

.deck-expanded-empty {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

body.deck-panel-expanded {
  overflow: hidden;
}

body.deck-panel-expanded::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(4, 6, 8, 0.78);
  backdrop-filter: blur(4px);
}

#deck.is-expanded {
  position: fixed;
  inset: 12px;
  z-index: 1000;
  max-height: calc(100dvh - 24px);
  overflow: auto;
  margin: 0;
  background: rgba(22, 25, 22, 0.98);
}

.deck-visual {
  display: grid;
  gap: 12px;
}

.deck-visual-board {
  border: 1px solid rgba(224, 168, 82, 0.35);
  border-radius: 14px;
  padding: 14px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(224, 168, 82, 0.16), transparent 52%),
    radial-gradient(120% 120% at 100% 0%, rgba(98, 148, 221, 0.14), transparent 56%),
    linear-gradient(160deg, rgba(11, 14, 20, 0.95), rgba(12, 16, 19, 0.92));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.deck-visual-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.deck-visual-title {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.04em;
}

.deck-visual-subtitle {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.deck-visual-counts {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.deck-visual-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.deck-visual-zone {
  display: grid;
  align-content: start;
  gap: 8px;
}

.deck-visual-zone-title {
  margin: 0;
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.deck-visual-main-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}

.deck-visual-side-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}

#deck.is-expanded .deck-visual-main-grid,
#deck.is-expanded .deck-visual-side-grid {
  grid-template-columns: repeat(auto-fill, minmax(192px, 1fr));
}

.deck-visual-category {
  display: grid;
  gap: 6px;
}

.deck-visual-category-title {
  margin: 2px 0 0;
  padding-bottom: 4px;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.1em;
  border-bottom: 1px solid rgba(224, 168, 82, 0.24);
}

.deck-visual-cmc-label {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.deck-visual-side-empty {
  padding: 10px;
  border-radius: 8px;
  border: 1px dashed var(--stroke);
  font-size: 12px;
  color: var(--muted);
}

.deck-visual-copy {
  position: relative;
}

.deck-visual-copy-qty {
  position: absolute;
  top: 8px;
  right: 5px;
  z-index: 2;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  background: rgba(15, 18, 16, 0.92);
  color: #f5f3ee;
  border: 1px solid rgba(224, 168, 82, 0.75);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.deck-visual-thumb {
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(
    135deg,
    rgba(224, 168, 82, 0.35),
    rgba(255, 255, 255, 0.08)
  );
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  transform-origin: center center;
  position: relative;
  z-index: 0;
}

.deck-visual-thumb.no-image {
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

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

.deck-visual-thumb .preview-image-overlay {
  font-size: 10px;
  padding: 3px 9px;
}

.deck-visual-thumb.is-zoomed {
  transform: scale(3);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
  z-index: 8;
}

@media (hover: hover) and (pointer: fine) {
  .deck-visual-thumb:hover {
    transform: scale(3);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
    z-index: 8;
  }
}

@media (max-width: 980px) {
  .deck-expand-toggle {
    display: none;
  }

  body.deck-panel-expanded {
    overflow: auto;
  }

  body.deck-panel-expanded::before {
    display: none;
  }

  #deck.is-expanded {
    position: static;
    inset: auto;
    max-height: none;
    overflow: visible;
    margin: 0;
  }

  .deck-expanded-list {
    grid-template-columns: 1fr;
  }

  .deck-visual-body {
    grid-template-columns: 1fr;
  }

  .deck-visual-side-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }

  .deck-visual-main-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }

  #deck.is-expanded .deck-visual-main-grid,
  #deck.is-expanded .deck-visual-side-grid {
    grid-template-columns: repeat(auto-fill, minmax(144px, 1fr));
  }

  .deck-io-grid {
    grid-template-columns: 1fr;
  }

  .io-notes {
    grid-template-columns: 1fr;
  }

  .io-selection-grid {
    grid-template-columns: 1fr;
  }
}

.deck-section {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 8px;
}

.deck-io-summary {
  margin: 4px 0 2px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(22, 25, 22, 0.42);
  font-size: 12px;
  color: var(--muted);
}

.deck-io-summary.is-warning {
  color: #f1d19d;
  border-color: rgba(224, 168, 82, 0.45);
}

.deck-io-section {
  display: grid;
  gap: 8px;
}

.deck-io-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.deck-count {
  margin-left: 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(224, 168, 82, 0.4);
}

.deck-count.over {
  color: #f4c06f;
  border-color: rgba(244, 192, 111, 0.8);
  background: rgba(244, 192, 111, 0.18);
}

.deck-count.under {
  color: #f3c4b3;
  border-color: rgba(212, 99, 74, 0.6);
  background: rgba(212, 99, 74, 0.12);
}

.deck-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(34, 39, 36, 0.6);
  border: 1px solid var(--stroke);
}

.deck-row.is-preview-card {
  border-color: rgba(224, 168, 82, 0.58);
  background:
    linear-gradient(90deg, rgba(224, 168, 82, 0.18), rgba(224, 168, 82, 0.04) 18px, rgba(34, 39, 36, 0.6) 18px),
    rgba(34, 39, 36, 0.6);
  box-shadow:
    inset 4px 0 0 rgba(224, 168, 82, 0.9),
    inset 0 0 0 1px rgba(224, 168, 82, 0.38);
}

.deck-row.color-w {
  border-color: rgba(245, 241, 207, 0.7);
  background: rgba(245, 241, 207, 0.12);
}

.deck-row.color-u {
  border-color: rgba(131, 167, 255, 0.7);
  background: rgba(131, 167, 255, 0.12);
}

.deck-row.color-b {
  border-color: rgba(122, 102, 192, 0.7);
  background: rgba(122, 102, 192, 0.12);
}

.deck-row.color-r {
  border-color: rgba(224, 122, 95, 0.7);
  background: rgba(224, 122, 95, 0.12);
}

.deck-row.color-g {
  border-color: rgba(131, 196, 123, 0.7);
  background: rgba(131, 196, 123, 0.12);
}

.deck-row.gold {
  border-color: rgba(224, 168, 82, 0.8);
  background: rgba(224, 168, 82, 0.16);
}

.deck-row.colorless {
  border-color: rgba(200, 200, 200, 0.5);
  background: rgba(200, 200, 200, 0.08);
}

.deck-row.artifact {
  border-color: rgba(166, 114, 68, 0.85);
  background: rgba(166, 114, 68, 0.16);
}

.deck-row h4 {
  font-size: 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.deck-mana-cost {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.deck-status-badge {
  margin-left: 2px;
  font-size: 11px;
  padding: 3px 9px;
}

.deck-row p {
  font-size: 12px;
  color: var(--muted);
}

.count {
  display: flex;
  align-items: center;
  gap: 8px;
}

.count button {
  padding: 6px 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--stroke);
}

.count .icon {
  background: rgba(255, 255, 255, 0.08);
}

.toggle {
  display: flex;
  gap: 8px;
  background: var(--surface);
  padding: 4px;
  border-radius: 999px;
}

.toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--muted);
  padding: 6px 16px;
  border-radius: 999px;
}

.toggle button.active {
  background: rgba(224, 168, 82, 0.18);
  color: var(--text);
}

.board-tab-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(224, 168, 82, 0.16);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.toggle button.active .board-tab-count {
  background: rgba(224, 168, 82, 0.3);
  color: var(--text);
}

.stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-bottom: 20px;
}

.stat {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  border: 1px solid var(--stroke);
}

.stat h3 {
  font-size: 12px;
  color: var(--muted);
}

.stat p {
  font-size: 20px;
  font-weight: 600;
}

.stat.wide {
  grid-column: span 2;
}

.charts {
  display: grid;
  gap: 16px;
}

.chart {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(34, 39, 36, 0.65);
  border: 1px solid var(--stroke);
}

.chart h4 {
  margin-bottom: 12px;
}

.bars {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  align-items: end;
  height: 120px;
}

.bars span {
  display: grid;
  place-items: end center;
  background: linear-gradient(180deg, rgba(224, 168, 82, 0.8), rgba(224, 168, 82, 0.2));
  border-radius: 8px 8px 4px 4px;
  font-size: 12px;
  color: var(--text);
  padding-bottom: 6px;
}

.land-mana-panel {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
}

.land-mana-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.land-mana-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: rgba(12, 15, 13, 0.35);
  font-size: 13px;
}

.land-mana-item i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  background-size: cover;
  background-position: center;
}

.land-mana-item em {
  font-style: normal;
  color: var(--muted);
}

.land-mana-item strong {
  margin-left: auto;
  font-size: 20px;
  line-height: 1;
  color: var(--text);
}

.conditional-mana-grid {
  margin-top: 8px;
}

.land-type-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 10px;
}

.land-type-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: rgba(12, 15, 13, 0.28);
  font-size: 12px;
}

.land-type-item i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  background-size: cover;
  background-position: center;
}

.land-type-item em {
  font-style: normal;
  color: var(--muted);
}

.land-type-item strong {
  margin-left: auto;
  font-size: 16px;
  line-height: 1;
  color: var(--text);
}

.color-ring {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin-bottom: 12px;
  background: radial-gradient(circle at center, var(--surface) 55%, transparent 56%),
    conic-gradient(
      #f5f1cf 0% 25%,
      #83a7ff 25% 55%,
      #7a66c0 55% 70%,
      #e07a5f 70% 90%,
      #83c47b 90% 100%
    );
}

.legend {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background-size: cover;
  background-position: center;
}

.legend-item .w {
  background-image: url("https://svgs.scryfall.com/card-symbols/W.svg");
}

.legend-item .u {
  background-image: url("https://svgs.scryfall.com/card-symbols/U.svg");
}

.legend-item .b {
  background-image: url("https://svgs.scryfall.com/card-symbols/B.svg");
}

.legend-item .r {
  background-image: url("https://svgs.scryfall.com/card-symbols/R.svg");
}

.legend-item .g {
  background-image: url("https://svgs.scryfall.com/card-symbols/G.svg");
}

.legend-item .c {
  background-image: url("https://svgs.scryfall.com/card-symbols/C.svg");
}

.io-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.io-box-export {
  gap: 16px;
}

.io-purpose-groups {
  display: grid;
  gap: 12px;
}

.io-purpose-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.02);
}

.io-purpose-group h4 {
  font-size: 13px;
}

.goldfish-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.goldfish-count-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.goldfish-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 196, 93, 0.16);
  color: #ffd28a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.goldfish-look-tools {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 12px;
}

.goldfish-look-tools label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.goldfish-mobile-bar {
  display: none;
}

.goldfish-look-check {
  align-content: center;
}

.goldfish-look-check span {
  color: var(--text);
}

.goldfish-effect-panel {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  background: rgba(34, 39, 36, 0.65);
}

.goldfish-effect-summary {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.goldfish-effect-order {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 12px;
}

.goldfish-effect-order-group {
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.14);
}

.goldfish-effect-order-group h4 {
  margin: 0 0 4px;
  font-size: 13px;
}

.goldfish-effect-order-group p {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--muted);
}

.goldfish-effect-order-list {
  display: grid;
  gap: 6px;
}

.goldfish-order-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  font-size: 12px;
  cursor: grab;
}

.goldfish-order-card.dragging {
  opacity: 0.55;
}

.goldfish-order-card strong {
  display: block;
}

.goldfish-order-card span {
  font-size: 11px;
  color: var(--muted);
}

.goldfish-effect-actions {
  display: flex;
  justify-content: flex-end;
}

.look-zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.look-zone-header h3 {
  margin: 0;
}

.look-zone-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.look-zone-settings label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.look-zone-settings label span {
  color: var(--text);
}

.look-zone-actions {
  display: flex;
  justify-content: flex-end;
  margin-left: auto;
  flex: 0 0 auto;
}

.goldfish-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.goldfish-bench-panel {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(209, 158, 91, 0.24);
  background: rgba(31, 26, 18, 0.72);
}

.goldfish-bench-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--text);
}

.goldfish-bench-head span {
  color: var(--muted);
  font-size: 12px;
}

.goldfish-bench-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.goldfish-bench-block {
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.goldfish-bench-block h3 {
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text);
}

.goldfish-bench-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.goldfish-pick {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  margin-bottom: 12px;
}

.goldfish-pick-filters {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.goldfish-pick-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.goldfish-pick-filter input {
  margin: 0;
}

@media (max-width: 720px) {
  .goldfish-pick {
    grid-template-columns: 1fr 1fr;
  }

  .goldfish-pick input,
  .goldfish-pick-filters {
    grid-column: 1 / -1;
  }
}

.goldfish-zones {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.zone {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(34, 39, 36, 0.6);
  border: 1px solid var(--stroke);
  scroll-margin-top: 16px;
}

.zone h3 {
  font-size: 14px;
  margin-bottom: 8px;
}

.zone-list {
  display: grid;
  gap: 6px;
}

.zone-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  font-size: 12px;
}

.zone-card.is-preview-card {
  border-color: rgba(224, 168, 82, 0.58);
  background:
    linear-gradient(90deg, rgba(224, 168, 82, 0.18), rgba(224, 168, 82, 0.04) 12px, var(--surface) 12px),
    var(--surface);
  box-shadow:
    inset 3px 0 0 rgba(224, 168, 82, 0.9),
    inset 0 0 0 1px rgba(224, 168, 82, 0.34);
}

.zone-meta {
  font-size: 11px;
  color: var(--muted);
}

.zone-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 600;
  line-height: 1.4;
}

.zone-status-badge {
  flex: 0 0 auto;
}

.zone-thumb {
  width: 40px;
  height: 56px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--stroke);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  transform-origin: left center;
  position: relative;
  overflow: hidden;
}

.zone-thumb .preview-image-overlay {
  display: none;
}

.zone-preview-pill {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 237, 204, 0.84);
  background: rgba(114, 57, 20, 0.96);
  color: #fff7ea;
  font-size: 5.4px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.08em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
  pointer-events: none;
  white-space: nowrap;
}

.zone-status-badge.status-badge.preview {
  border-color: rgba(255, 220, 165, 0.44);
  background: rgba(224, 168, 82, 0.22);
  color: #ffe6b6;
  box-shadow: inset 0 0 0 1px rgba(255, 228, 181, 0.08);
}

.deck-status-badge.status-badge.preview {
  border-color: rgba(255, 220, 165, 0.44);
  background: rgba(224, 168, 82, 0.22);
  color: #ffe6b6;
}

.zone-thumb:hover,
.zone-thumb:focus,
.zone-thumb.is-zoomed {
  transform: scale(6);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
  z-index: 2;
  position: relative;
}

.zone-card.zone-land-tone {
  border-color: rgba(155, 192, 136, 0.72);
  background: rgba(155, 192, 136, 0.14);
}

.zone-card.zone-spell-tone {
  border-color: rgba(116, 141, 193, 0.7);
  background: rgba(116, 141, 193, 0.12);
}

.zone-card.color-w {
  border-color: rgba(245, 241, 207, 0.7);
  background: rgba(245, 241, 207, 0.12);
}

.zone-card.color-u {
  border-color: rgba(131, 167, 255, 0.7);
  background: rgba(131, 167, 255, 0.12);
}

.zone-card.color-b {
  border-color: rgba(122, 102, 192, 0.7);
  background: rgba(122, 102, 192, 0.12);
}

.zone-card.color-r {
  border-color: rgba(224, 122, 95, 0.7);
  background: rgba(224, 122, 95, 0.12);
}

.zone-card.color-g {
  border-color: rgba(131, 196, 123, 0.7);
  background: rgba(131, 196, 123, 0.12);
}

.zone-card.gold {
  border-color: rgba(224, 168, 82, 0.8);
  background: rgba(224, 168, 82, 0.16);
}

.zone-card.colorless {
  border-color: rgba(200, 200, 200, 0.5);
  background: rgba(200, 200, 200, 0.08);
}

.zone-card.artifact {
  border-color: rgba(166, 114, 68, 0.85);
  background: rgba(166, 114, 68, 0.16);
}

.zone-card.selected {
  border-color: rgba(246, 198, 104, 0.92);
  background:
    linear-gradient(90deg, rgba(246, 198, 104, 0.26), rgba(246, 198, 104, 0.06) 20px, rgba(246, 198, 104, 0.1)),
    rgba(246, 198, 104, 0.1);
  box-shadow:
    inset 4px 0 0 rgba(246, 198, 104, 0.98),
    0 0 0 1px rgba(246, 198, 104, 0.32),
    0 12px 28px rgba(0, 0, 0, 0.16);
}

.zone-card[draggable="true"] {
  cursor: grab;
}

.zone-card.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.zone-thumb.tapped {
  transform: rotate(-90deg);
  transform-origin: center;
}

.zone-actions {
  display: flex;
  gap: 4px;
}

.zone-actions button {
  padding: 4px 6px;
  font-size: 11px;
}

.zone-actions button.is-selected {
  border-color: rgba(246, 198, 104, 0.95);
  background: rgba(246, 198, 104, 0.98);
  color: #2a1a00;
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(255, 242, 207, 0.22) inset;
}

.look-zone-card {
  grid-template-columns: auto 1fr;
}

.look-zone-body {
  display: grid;
  gap: 8px;
}

.look-zone-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.look-zone-buttons button {
  padding: 4px 6px;
  font-size: 11px;
}

.look-zone-assign {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.look-zone-assign select {
  min-width: 0;
}

.look-zone-note {
  font-size: 11px;
  color: var(--muted);
}

@media (pointer: fine) {
  .zone {
    min-height: 116px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  }

  .zone-list.is-drop-target {
    min-height: 104px;
    padding: 10px;
    border-radius: 10px;
    border: 1px dashed rgba(246, 198, 104, 0.22);
    background: rgba(246, 198, 104, 0.03);
  }

  .zone-list.is-drop-target::after {
    content: "ここへドロップ";
    display: block;
    margin-top: 12px;
    font-size: 11px;
    color: var(--muted);
    opacity: 0.72;
    text-align: center;
  }

  .zone.is-drop-active {
    border-color: rgba(246, 198, 104, 0.92);
    background: rgba(246, 198, 104, 0.05);
    box-shadow:
      inset 0 0 0 1px rgba(246, 198, 104, 0.28),
      0 0 0 1px rgba(246, 198, 104, 0.16),
      0 12px 28px rgba(34, 22, 0, 0.12);
  }

  .zone-list.is-drop-active::after {
    color: #f6c668;
    opacity: 1;
  }
}

.look-zone-note.is-error {
  color: #ffb4a2;
}

.token-builder-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.token-form-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.token-form-grid label,
.token-sheet-settings label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.token-form-grid .wide {
  grid-column: 1 / -1;
}

.token-form-grid textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  resize: vertical;
  min-height: 84px;
}

.token-image-name {
  font-size: 12px;
  color: var(--muted);
}

.token-preview-stage {
  padding: 14px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  background: rgba(22, 25, 22, 0.52);
  display: grid;
  place-items: center;
  min-height: 320px;
}

.token-card {
  --token-card-radius: 10px;
  --token-text-scale: 2;
  font-family: var(--token-font-ui);
  position: relative;
  width: 100%;
  aspect-ratio: 63 / 88;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  padding: 6px;
  border-radius: var(--token-card-radius);
  border: 5.3px solid #000;
  box-shadow: none;
  overflow: hidden;
  background: linear-gradient(180deg, #f9f9f9, #f1f1f1);
}

.token-card.token-card-image-only {
  display: block;
  gap: 0;
  padding: 0;
  border: 0;
  background: #ffffff;
}

.token-card-image-only-media {
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.token-card-head {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.95fr 0.81fr;
  grid-template-rows: minmax(56px, auto) minmax(38px, auto);
  grid-template-areas:
    "name name"
    "type color";
  gap: 4px;
}

.token-card-head-type,
.token-card-head-name,
.token-card-head-color {
  min-height: 20px;
  display: grid;
  align-items: center;
  border: 1.35px solid #000;
  border-radius: 3px;
  background: #f4f4f4;
  color: #101010;
  font-size: calc(8.6px * var(--token-text-scale));
  font-weight: 600;
  line-height: 1.12;
  padding: 0 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.token-card-head-type {
  grid-area: type;
  min-height: 38px;
  font-size: calc(8.5px * var(--token-text-scale));
  font-weight: 600;
  white-space: pre-line;
  line-height: 1.12;
  text-overflow: clip;
  align-content: center;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 2px 4px;
}

.token-card-head-name {
  grid-area: name;
  min-height: 56px;
  text-align: center;
  font-family: var(--token-font-heavy);
  font-size: calc(18.8px * var(--token-text-scale));
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: 0.01em;
  white-space: normal;
  text-overflow: clip;
  overflow-wrap: normal;
  word-break: normal;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.token-card-head-color {
  grid-area: color;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  font-size: calc(12.4px * var(--token-text-scale));
  font-weight: 800;
  padding-top: 6px;
  background: #f2f2f2;
}

.token-card-head-color-tag {
  position: absolute;
  left: 5px;
  top: 3px;
  font-size: calc(2.9px * var(--token-text-scale));
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.03em;
  opacity: 0.6;
}

.token-card-head-color-value {
  display: block;
  width: 100%;
  text-align: center;
  line-height: 1;
}

.token-card-art-frame {
  position: relative;
  min-height: 0;
  border: 1.25px solid #000;
  background: #f1f1f1;
  overflow: hidden;
}

.token-card-art {
  position: absolute;
  inset: 4px;
  background:
    radial-gradient(120% 110% at 50% -8%, rgba(255, 255, 255, 0.2), transparent 46%),
    linear-gradient(180deg, rgba(12, 12, 12, 0.14), rgba(12, 12, 12, 0.34)),
    var(--token-image, linear-gradient(135deg, rgba(152, 152, 152, 0.24), rgba(25, 25, 25, 0.92)));
  background-size: cover;
  background-position: center;
  filter: grayscale(1) blur(1.2px);
  opacity: 0.52;
}

.token-card-keywords {
  position: absolute;
  inset: 6px;
  z-index: 1;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 4px;
  background: rgba(10, 10, 10, 0.92);
  color: #f5f5f5;
  font-family: var(--token-font-heavy);
  font-size: calc(20px * var(--token-text-scale));
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: pre-line;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: normal;
  text-shadow: none;
}

.token-card-rules-frame {
  position: relative;
  z-index: 1;
  min-height: 32%;
  padding: 4px;
  border: 1.25px solid #000;
  background: #f3f3f3;
}

.token-card-rules-body {
  margin: 0;
  height: 100%;
  padding: 7px 9px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
  color: #111111;
  font-family: var(--token-font-ui);
  font-size: calc(10px * var(--token-text-scale));
  font-weight: 700;
  line-height: 1.2;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: normal;
  overflow: hidden;
}

.token-card.token-no-keywords .token-card-rules-frame {
  min-height: 0;
}

.token-card.token-no-keywords .token-card-art-frame {
  display: none;
}

.token-card.token-no-keywords {
  grid-template-rows: auto 1fr;
}

.token-card.token-no-keywords .token-card-rules-body {
  font-size: calc(11.2px * var(--token-text-scale));
  font-weight: 700;
  line-height: 1.2;
  padding-top: 9px;
}

.token-card.token-no-rules {
  grid-template-rows: auto 1fr;
}

.token-card.token-no-rules .token-card-rules-frame {
  display: none;
}

.token-card-pt {
  position: absolute;
  z-index: 2;
  right: 9px;
  bottom: 9px;
  min-width: 78px;
  text-align: center;
  padding: 9px 20px;
  border-radius: 4px;
  border: 1.8px solid #000;
  background: #ffffff;
  color: #101010;
  font-family: var(--token-font-heavy);
  font-size: calc(34px * var(--token-text-scale));
  font-weight: 800;
  line-height: 1;
}

.token-card-generated-by {
  position: absolute;
  z-index: 2;
  left: 9px;
  right: 112px;
  bottom: 11px;
  font-family: var(--token-font-ui);
  font-size: calc(6.2px * var(--token-text-scale));
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.token-card-empty {
  position: absolute;
  inset: auto 10px 10px;
  z-index: 3;
  font-family: var(--token-font-ui);
  font-size: calc(11px * var(--token-text-scale));
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
}

.token-card-draft {
  width: min(240px, 100%);
}

.token-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.token-list-item {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(22, 25, 22, 0.55);
  padding: 8px;
}

.token-list-thumb .token-card {
  width: 60px;
}

.token-list-main {
  display: grid;
  gap: 5px;
}

.token-list-title {
  font-size: 13px;
  font-weight: 700;
}

.token-list-meta {
  font-size: 11px;
  color: var(--muted);
}

.token-list-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.token-list-actions button {
  padding: 6px 10px;
  font-size: 12px;
}

.token-list-qty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 3px 4px;
  background: rgba(255, 255, 255, 0.04);
}

.token-list-qty button {
  min-width: 28px;
  padding: 4px 8px;
}

.token-list-qty-value {
  min-width: 2.4ch;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.token-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.token-form-actions button {
  flex: 1 1 140px;
}

.token-sheet-settings {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.token-sheet-preview-box {
  grid-column: 1 / -1;
}

.token-sheet-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.token-sheet-preview {
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  background: rgba(19, 21, 19, 0.58);
  padding: 12px;
  overflow: auto;
}

.token-page-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.token-page-nav button {
  padding: 6px 12px;
  font-size: 12px;
}

.token-page-nav span {
  font-size: 12px;
  color: var(--muted);
}

.token-sheet-board {
  position: relative;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.3);
}

.token-sheet-grid {
  position: absolute;
  display: grid;
  align-content: start;
}

.token-sheet-card .token-card {
  width: 100%;
}

.token-sheet-card-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.io-box {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  border: 1px solid var(--stroke);
  display: grid;
  gap: 10px;
}

.export-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.export-block-head {
  display: grid;
  gap: 4px;
}

.export-block-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.export-block-head p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.export-actions {
  display: grid;
  gap: 8px;
}

.history-filter {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.history-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(22, 25, 22, 0.48);
}

.history-title {
  font-size: 12px;
  font-weight: 700;
}

.history-meta {
  font-size: 12px;
  color: var(--muted);
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-actions button {
  flex: 1 1 120px;
}

.pdf-settings {
  display: grid;
  gap: 10px;
}

.pdf-settings label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.export-settings-toggle {
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 12px;
}

.export-settings-toggle summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.export-settings-toggle summary::-webkit-details-marker {
  display: none;
}

.export-settings-summary-label {
  flex: 0 1 auto;
}

.export-settings-summary-hint {
  flex: 1 1 auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.export-settings-summary-icon {
  flex: 0 0 auto;
  color: #d97f2f;
  transition: transform 0.16s ease;
}

.export-settings-toggle[open] summary {
  margin-bottom: 10px;
}

.export-settings-toggle[open] .export-settings-summary-icon {
  transform: rotate(180deg);
}

.export-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  user-select: none;
}

.export-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #d97f2f;
}

.dict-box {
  display: grid;
  gap: 4px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: rgba(22, 25, 22, 0.5);
}

.dict-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--muted);
}

.dict-box label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.dict-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.dict-auto {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.dict-auto input {
  width: 16px;
  height: 16px;
}

.dict-file {
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
}

.dict-file input {
  display: none;
}

.dict-status {
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--muted);
  border-left: 0;
  padding-left: 0;
  white-space: pre-line;
}

.import-file-picker {
  display: grid;
  gap: 6px;
}

.import-file-button {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 0 12px;
  line-height: 56px;
  border-width: 2px;
  border-style: solid;
  border-color: rgba(224, 168, 82, 0.72);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(224, 168, 82, 0.95), rgba(168, 106, 44, 0.95));
  color: #15120e;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.import-file-name {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: rgba(10, 12, 10, 0.55);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#import-file {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

#import-run {
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
}

.import-paste {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.import-paste label {
  font-size: 12px;
  color: var(--muted);
}

.import-paste textarea {
  width: 100%;
  min-height: 172px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: rgba(10, 12, 10, 0.58);
  color: var(--text);
  font-size: 12px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
  resize: vertical;
}

.import-paste small {
  font-size: 11px;
  color: var(--muted);
}

.import-paste-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.import-paste-actions button {
  flex: 1 1 140px;
}

.share-tools {
  display: grid;
  gap: 8px;
}

.share-tools h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.share-tools small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.embed-link-box {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
}

.embed-link-box p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.deck-format-tools {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}

.deck-format-tools label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  min-width: 220px;
  flex: 1 1 220px;
}

.deck-format-tools select {
  width: 100%;
}

.deck-format-tools .ghost {
  min-width: 120px;
}

.deck-format-check {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(22, 25, 22, 0.42);
  margin-bottom: 10px;
}

.deck-format-check h4 {
  margin: 0;
  font-size: 13px;
}

.deck-format-check-basis {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.deck-rules-sync-box {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.deck-rules-sync-box p {
  margin: 0;
}

.deck-format-check-summary {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.deck-format-check-summary.is-alert {
  color: #f1d19d;
}

.deck-format-check-summary.is-error {
  color: #efada4;
}

.deck-format-check-details {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
}

.deck-format-check-details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}

.deck-format-check-list {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.deck-format-check-item {
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}

.deck-format-check-item p {
  margin: 0;
  color: var(--muted);
}

.deck-format-check-item-head {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.deck-format-check-item a {
  color: #f1d19d;
  text-decoration: underline;
}

.deck-format-check-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.deck-format-check-badge.banned {
  background: rgba(255, 92, 80, 0.2);
}

.deck-format-check-badge.not_legal {
  background: rgba(246, 164, 72, 0.2);
}

.deck-format-check-badge.restricted {
  background: rgba(98, 159, 255, 0.2);
}

.deck-format-check-badge.restricted_over {
  background: rgba(245, 102, 71, 0.24);
}

.deck-format-check-badge.preview {
  background: rgba(224, 168, 82, 0.24);
  color: #f6d49a;
}

.deck-format-check-badge.unknown {
  background: rgba(140, 148, 156, 0.26);
}

.meta-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin-bottom: 8px;
}

.meta-controls label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  min-width: 180px;
}

.meta-status {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.meta-events {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  margin-bottom: 8px;
}

.meta-events h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.meta-events ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.meta-events li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.meta-events li strong {
  color: var(--text);
}

.meta-events li a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.meta-events li a:hover {
  color: #f1d19d;
}

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

.meta-box {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(20, 24, 20, 0.56);
  padding: 10px;
}

.meta-box h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.meta-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.meta-filter-tabs button {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.meta-filter-tabs button.active {
  border-color: rgba(224, 168, 82, 0.55);
  background: rgba(224, 168, 82, 0.16);
}

.meta-top-cards,
.meta-deck-list {
  display: grid;
  gap: 6px;
}

.meta-card-item,
.meta-deck-item {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
}

.meta-card-item.is-missing {
  border-color: rgba(224, 168, 82, 0.4);
  background: rgba(224, 168, 82, 0.08);
}

.meta-card-item strong,
.meta-deck-item strong {
  display: block;
  margin-bottom: 4px;
}

.meta-card-item p,
.meta-deck-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.meta-deck-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-deck-actions a {
  color: #f1d19d;
  font-size: 12px;
  text-decoration: underline;
}

@media (max-width: 720px) {
  html {
    scroll-padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }

  body[data-page="builder"] {
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }

  body[data-page="goldfish"] {
    padding-bottom: calc(146px + env(safe-area-inset-bottom, 0px));
  }

  .bottom-tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 12, 11, 0.97);
    box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .bottom-tab-link {
    position: relative;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 8px 11px;
    border-radius: 16px;
    color: rgba(245, 244, 238, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
    text-align: center;
    transition:
      background-color 160ms ease,
      border-color 160ms ease,
      color 160ms ease,
      transform 160ms ease,
      box-shadow 160ms ease;
  }

  .bottom-tab-link::before {
    content: "";
    position: absolute;
    top: 0;
    left: 12px;
    right: 12px;
    height: 2px;
    border-radius: 999px;
    background: transparent;
  }

  .bottom-tab-link[aria-current="location"] {
    color: #fffdf8;
    background: linear-gradient(180deg, rgba(224, 168, 82, 0.28), rgba(224, 168, 82, 0.16));
    border-color: rgba(224, 168, 82, 0.42);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 8px 18px rgba(0, 0, 0, 0.22);
  }

  .bottom-tab-link[aria-current="location"]::before {
    background: rgba(255, 244, 218, 0.96);
  }

  .bottom-tab-link:focus-visible {
    outline: 2px solid rgba(224, 168, 82, 0.72);
    outline-offset: 1px;
  }

  .bottom-tab-label {
    display: block;
    font-size: 11px;
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .bottom-tab-link[aria-current="location"] .bottom-tab-label {
    font-weight: 700;
  }

  .panel-head-inline {
    flex-direction: column;
  }

  .deck-format-tools {
    align-items: stretch;
  }

  .deck-format-tools .ghost {
    width: 100%;
  }

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

  .day-mode-matchup-bar,
  .day-mode-round-form,
  .day-mode-log-filters {
    grid-template-columns: 1fr;
  }

  .day-mode-io-grid,
  .day-mode-notes-grid {
    grid-template-columns: 1fr;
  }

  .goldfish-mobile-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    display: grid;
    gap: 8px;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 12, 11, 0.97);
    box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .goldfish-mobile-row {
    display: grid;
    gap: 8px;
  }

  .goldfish-mobile-row-top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .goldfish-mobile-row-bottom {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .goldfish-mobile-row-bottom.is-bottom-mode {
    grid-template-columns: minmax(0, 1fr) minmax(0, 3fr) minmax(0, 1fr);
  }

  .look-zone-settings {
    grid-template-columns: 1fr 1fr;
  }

  .goldfish-mobile-action {
    min-height: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 8px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(245, 244, 238, 0.9);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  }

  .goldfish-mobile-action[hidden] {
    display: none !important;
  }

  .goldfish-mobile-action-title {
    display: block;
  }

  .goldfish-mobile-action-meta {
    display: block;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.15;
    color: rgba(245, 244, 238, 0.72);
    white-space: nowrap;
  }

  .goldfish-mobile-action.is-primary {
    border-color: rgba(224, 168, 82, 0.42);
    background: linear-gradient(180deg, rgba(224, 168, 82, 0.28), rgba(224, 168, 82, 0.16));
    color: #fffdf8;
  }

  .goldfish-mobile-bottom-merged {
    grid-column: 2 / span 3;
  }

  .goldfish-mobile-row-bottom.is-bottom-mode .goldfish-mobile-bottom-merged {
    grid-column: auto;
  }

  .goldfish-mobile-bottom-merged .goldfish-mobile-action-title {
    font-size: 11px;
    line-height: 1.1;
    letter-spacing: 0;
    white-space: nowrap;
  }

  .goldfish-mobile-action.is-hidden {
    display: none;
  }

  .goldfish-mobile-action:disabled {
    opacity: 0.4;
    color: rgba(245, 244, 238, 0.48);
  }

  .goldfish-mobile-action:disabled .goldfish-mobile-action-meta {
    color: rgba(245, 244, 238, 0.42);
  }

  .goldfish-mobile-action:focus-visible {
    outline: 2px solid rgba(224, 168, 82, 0.72);
    outline-offset: 1px;
  }
}

@media (max-width: 1040px) {
  .workspace-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace-support-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 680px) {
  .workspace-status {
    padding: 22px 18px;
  }

  .workspace-status-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace-status-actions button {
    flex-basis: 100%;
  }

  .workspace-status-stats {
    grid-template-columns: 1fr 1fr;
  }

  .day-mode-round-actions,
  .day-mode-log-actions {
    flex-direction: column;
  }

  .day-mode-round-actions button,
  .day-mode-log-actions button,
  .day-mode-header-links .button-link {
    width: 100%;
  }
}

.deck-diff {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(22, 25, 22, 0.42);
  margin-bottom: 8px;
}

.deck-diff h4 {
  margin: 0;
  font-size: 13px;
}

.deck-diff-content {
  display: grid;
  gap: 8px;
}

.deck-diff-group {
  display: grid;
  gap: 6px;
}

.deck-diff-group h5 {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.deck-diff-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.deck-diff-empty {
  font-size: 12px;
  color: var(--muted);
}

.sb-guide {
  display: grid;
  gap: 12px;
}

.sb-guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sb-guide-columns {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 12px;
}

.sb-guide-list-wrap h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.sb-guide-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.sb-guide-empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
}

.sb-guide-item {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  padding: 9px 10px;
  text-align: left;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.sb-guide-item strong {
  font-size: 13px;
  line-height: 1.35;
}

.sb-guide-item small {
  font-size: 11px;
  color: var(--muted);
}

.sb-guide-item.is-active {
  border-color: rgba(224, 168, 82, 0.72);
  background: rgba(224, 168, 82, 0.12);
}

.sb-guide-detail {
  display: grid;
  gap: 10px;
}

.sb-guide-detail label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.sb-guide-detail input,
.sb-guide-detail textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(17, 18, 17, 0.55);
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
}

.sb-guide-detail textarea {
  resize: vertical;
  min-height: 86px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
}

.sb-guide-status {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.sb-guide-status[data-tone="saved"] {
  color: #c9dfb0;
}

.sb-guide-status[data-tone="editing"] {
  color: #f2d5a0;
}

.sb-guide-status[data-tone="error"] {
  color: #efada4;
}

.sb-guide-warning {
  margin: 0;
  min-height: 1.2em;
  font-size: 12px;
  color: #f1d19d;
}

.sb-guide-stepper-wrap {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.sb-guide-entry-list {
  display: grid;
  gap: 6px;
}

.sb-guide-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 18, 17, 0.5);
}

.sb-guide-entry-name {
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.sb-guide-entry-qty {
  font-size: 12px;
  font-weight: 700;
  min-width: 2ch;
  text-align: right;
}

.sb-guide-entry-controls {
  display: inline-flex;
  gap: 4px;
}

.sb-guide-entry-controls .ghost {
  min-width: 28px;
  min-height: 26px;
  padding: 0 6px;
}

.sb-guide-entry-empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.sb-guide-candidates {
  display: grid;
  gap: 6px;
}

.sb-guide-candidate-title {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.sb-guide-candidate-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sb-guide-candidate-btn {
  font-size: 11px;
  padding: 4px 8px;
}

.sb-guide-counts {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  color: var(--muted);
}

.sb-guide-counts.is-warning {
  color: #f1d19d;
  border-color: rgba(224, 168, 82, 0.45);
}

@media (max-width: 960px) {
  .sb-guide-columns {
    grid-template-columns: 1fr;
  }

  .sb-guide-list {
    max-height: none;
  }
}

.import-summary {
  font-size: 12px;
  color: var(--muted);
  border-left: 2px solid rgba(224, 168, 82, 0.4);
  padding-left: 10px;
}

.import-status-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(224, 168, 82, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.import-status-box h4 {
  font-size: 12px;
  color: var(--accent-strong);
  letter-spacing: 0.08em;
}

.progress {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, rgba(224, 168, 82, 0.85), rgba(244, 192, 111, 0.6));
  border-radius: 999px;
}

.affiliate-sentinel {
  height: 1px;
  margin-top: 28px;
}

.affiliate-shelf {
  margin-top: 12px;
  color: var(--text);
}

.affiliate-shelf details {
  overflow: hidden;
  border: 1px solid rgba(224, 168, 82, 0.2);
  border-radius: var(--radius-md);
  background: rgba(16, 19, 17, 0.72);
}

.affiliate-shelf summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.affiliate-shelf summary::-webkit-details-marker {
  display: none;
}

.affiliate-shelf summary:hover {
  background: rgba(224, 168, 82, 0.05);
}

.affiliate-summary-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.affiliate-summary-copy > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.affiliate-summary-copy strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.affiliate-summary-copy small {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.affiliate-ad-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgba(224, 168, 82, 0.38);
  border-radius: 999px;
  color: var(--accent-strong);
  font-family: var(--token-font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.affiliate-summary-action {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: var(--accent-strong);
  font-size: 11px;
}

.affiliate-summary-action::after {
  width: 7px;
  height: 7px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  content: "";
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.affiliate-shelf details[open] .affiliate-summary-action::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

.affiliate-shelf-body {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.affiliate-disclosure {
  padding-top: 13px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.affiliate-product-list {
  display: grid;
  overflow-x: auto;
  grid-auto-columns: minmax(176px, 210px);
  grid-auto-flow: column;
  gap: 10px;
  padding: 2px 0 8px;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline proximity;
  scrollbar-width: thin;
}

.commerce-product-card {
  display: grid;
  height: 100%;
  min-width: 0;
  min-height: 242px;
  align-content: start;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  scroll-snap-align: start;
}

.commerce-product-link {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.commerce-product-card:has(.commerce-product-link:hover),
.commerce-product-card:has(.commerce-product-link:focus-visible) {
  border-color: rgba(224, 168, 82, 0.5);
  background: rgba(224, 168, 82, 0.07);
}

.commerce-product-link:focus-visible {
  outline: none;
}

.commerce-product-cover-wrap {
  display: grid;
  width: 100%;
  min-height: 128px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.commerce-product-cover-wrap::after {
  grid-area: 1 / 1;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.commerce-product-cover-wrap[data-image-status="loading"]::after {
  content: "画像を読み込み中";
}

.commerce-product-cover-wrap[data-image-status="error"]::after {
  content: "画像を読み込めませんでした";
}

.commerce-product-cover {
  display: block;
  grid-area: 1 / 1;
  width: 128px;
  height: 128px;
  object-fit: contain;
}

.affiliate-shelf {
  scroll-margin-top: 16px;
}

.commerce-product-name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.commerce-product-price {
  color: var(--accent-strong);
  font-family: var(--token-font-ui);
  font-size: 14px;
  font-weight: 700;
}

.commerce-product-sales-date {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.commerce-product-shop {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commerce-product-destination {
  margin-top: auto;
  color: var(--muted);
  font-size: 10px;
}

.affiliate-fetched-at,
.affiliate-notice,
.affiliate-shelf-body > a {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.affiliate-shelf-body > a {
  width: fit-content;
}

.app-footer {
  margin-top: 32px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.embed-page {
  margin: 0;
  padding: 14px;
  background: #f5f6f7;
  color: #121212;
  font-family: "Avenir Next", "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

.embed-container {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.embed-head {
  padding: 10px 12px;
  border: 1px solid #d2d6d8;
  border-radius: 10px;
  background: #ffffff;
}

.embed-head h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.embed-meta {
  margin-top: 8px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: #4b5458;
  font-size: 13px;
}

.embed-section {
  padding: 10px 12px;
  border: 1px solid #d2d6d8;
  border-radius: 10px;
  background: #ffffff;
}

.embed-section h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.embed-visual-groups {
  display: grid;
  gap: 14px;
}

.embed-visual-group h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.embed-visual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 10px;
}

.embed-visual-card {
  position: relative;
  display: grid;
  gap: 6px;
}

.embed-visual-frame {
  display: block;
  border: 1px solid #d2d6d8;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  text-decoration: none;
  min-height: 172px;
}

.embed-visual-image {
  display: block;
  width: 100%;
  height: auto;
}

.embed-visual-fallback {
  min-height: 172px;
  display: grid;
  place-items: center;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: #4b5458;
  line-height: 1.4;
}

.embed-visual-name {
  margin: 0;
  font-size: 12px;
  color: #283036;
  line-height: 1.35;
}

.embed-visual-qty {
  position: absolute;
  top: 28px;
  right: 6px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #ad3a30;
  background: #cf3f33;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.embed-visual-empty {
  margin: 0;
  font-size: 12px;
  color: #5a6469;
}

.embed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.embed-list li {
  display: flex;
  gap: 8px;
}

.embed-qty {
  min-width: 2.2em;
  text-align: right;
  font-weight: 700;
}

.embed-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: #5a6469;
}

.embed-download-btn {
  appearance: none;
  border: 1px solid #b4bcc1;
  background: #ffffff;
  color: #263137;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.embed-download-btn:hover {
  background: #f2f5f7;
}

.embed-download-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.embed-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d9b0a7;
  background: #f8efed;
  color: #7f2f23;
  border-radius: 10px;
  font-size: 13px;
}

.embed-manage-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: #4b5458;
}

.embed-manage-status {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d2d6d8;
  border-radius: 10px;
  background: #ffffff;
  color: #283036;
  font-size: 13px;
}

.embed-manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.embed-mode-visual .embed-head h1 {
  font-size: 17px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22, 25, 22, 0.95);
  border: 1px solid rgba(224, 168, 82, 0.4);
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -8px);
}

.print-sheet {
  display: none;
}

.print-visual-sheet {
  position: fixed;
  left: -300vw;
  top: 0;
  width: 1000px;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.token-print-sheet {
  display: none;
}

@media print {
  @page {
    size: A4;
    margin: 4mm 5mm 1mm 5mm;
  }

  html,
  body {
    width: 210mm;
    min-height: 297mm;
    height: auto;
    overflow: visible;
    background: #ffffff !important;
    background-image: none !important;
  }

  html.print-multipage,
  body.print-multipage {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body {
    padding: 0;
    margin: 0;
    background: #ffffff;
    background-image: none !important;
    color: #111111;
    font-size: 10pt;
    font-family: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  }

  .bg-orbit,
  .site-top-links,
  .search,
  .stats,
  .io,
  .header-actions,
  .toast,
  .app-footer {
    display: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid #dddddd;
    background: #ffffff;
    padding: 16px;
  }

  .layout,
  .card,
  .app-header,
  .deck {
    display: none;
  }

  .print-sheet {
    display: block;
    width: 100%;
    height: 292mm;
    margin: 0;
    padding-bottom: 24mm;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    break-after: avoid-page;
    page-break-after: avoid;
  }

  .print-visual-sheet {
    display: none;
    width: 100%;
    margin: 0;
    padding-bottom: 0;
    break-after: avoid-page;
    page-break-after: avoid;
    position: static;
    left: auto;
    top: auto;
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
  }

  body.print-multipage .print-sheet,
  body.print-multipage .print-visual-sheet {
    max-height: none !important;
    overflow: visible !important;
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body.print-multipage .print-token-section.token-page-break,
  body.print-multipage .print-v-token-zone.token-page-break {
    break-before: page !important;
    page-break-before: always !important;
  }

  .token-print-sheet {
    display: none;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  body.print-visual-mode .print-sheet {
    display: none !important;
  }

  body.print-visual-mode .print-visual-sheet {
    display: block !important;
  }

  body.print-text-mode .print-sheet {
    display: block !important;
  }

  body.print-text-mode .print-visual-sheet {
    display: none !important;
  }

  body.print-token-mode .print-sheet,
  body.print-token-mode .print-visual-sheet {
    display: none !important;
  }

  body.print-token-mode .token-print-sheet {
    display: block !important;
  }

  .print-reg-header {
    display: block;
    margin-bottom: 3.5mm;
  }

  .print-date {
    margin: 0 0 1.5mm;
    font-size: 7.2pt;
    color: #444;
  }

  .print-reg-header h1 {
    margin: 0;
    font-size: 18pt;
    letter-spacing: 0.02em;
  }

  .print-reg-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 3mm;
    border-top: 0.35mm solid #222;
    border-left: 0.35mm solid #222;
  }

  .print-reg-field {
    min-height: 10.5mm;
    display: grid;
    grid-template-columns: 18mm 1fr;
    border-right: 0.35mm solid #222;
    border-bottom: 0.35mm solid #222;
  }

  .print-reg-field-wide {
    grid-column: 1 / -1;
  }

  .print-reg-field-label {
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 0.35mm solid #222;
    padding: 1mm 1.2mm;
    font-size: 8.4pt;
    font-weight: 600;
  }

  .print-reg-field-value {
    display: flex;
    align-items: center;
    padding: 1.6mm 2mm;
    font-size: 9.2pt;
  }

  .print-reg-note {
    margin: 0 0 3mm;
    font-size: 9.6pt;
    line-height: 1.35;
  }

  .print-reg-body {
    display: grid;
    grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.84fr);
    gap: 5mm;
    align-items: start;
  }

  .print-reg-zone h2 {
    margin: 0 0 0.8mm;
    font-size: 12pt;
    line-height: 1.2;
  }

  .print-reg-zone-head {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 15.5mm;
  }

  .print-reg-zone-head-main {
    min-height: 18.5mm;
  }

  .print-reg-subtitle {
    margin: 0 0 1.2mm;
    font-size: 8.4pt;
    color: #333;
  }

  .print-reg-subtitle-spacer {
    visibility: hidden;
  }

  .print-reg-table-head {
    display: grid;
    grid-template-columns: 15mm 1fr;
    gap: 2.2mm;
    margin-bottom: 0.6mm;
    font-size: 8.6pt;
    font-weight: 600;
  }

  .print-reg-lines {
    display: grid;
    gap: 0.65mm;
  }

  .print-reg-line {
    display: grid;
    grid-template-columns: 15mm 1fr;
    gap: 2.2mm;
    align-items: end;
    min-height: 5.35mm;
    font-size: 8.4pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-reg-line-qty,
  .print-reg-line-name {
    display: flex;
    align-items: flex-end;
    min-height: 5mm;
    border-bottom: 0.22mm solid #555;
    padding: 0 0.8mm 0.5mm;
  }

  .print-reg-line-qty {
    justify-content: center;
  }

  .print-reg-total-row {
    margin-top: 2mm;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 2mm;
    font-size: 9pt;
  }

  .print-reg-total-label {
    font-weight: 600;
  }

  .print-reg-total-box {
    min-width: 17mm;
    min-height: 8mm;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0.35mm solid #222;
    font-size: 10pt;
    font-weight: 700;
  }

  .print-reg-side-stack {
    display: grid;
    gap: 4mm;
  }

  .print-section {
    margin-top: 5mm;
    margin-bottom: 0;
  }

  .print-section h2 {
    font-size: 10.5pt;
    border-bottom: 0.3mm solid #222;
    padding-bottom: 1mm;
    margin-bottom: 2mm;
  }

  .print-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    font-size: 8.5pt;
  }

  .print-token-section {
    margin-top: 5mm;
  }

  .print-token-section.token-page-break {
    break-before: page;
    page-break-before: always;
    margin-top: 0;
  }

  .print-column {
    display: grid;
    gap: 4px;
  }

  .print-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px;
    border-bottom: 1px solid #e2e2e2;
    padding-bottom: 2px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-row span:first-child {
    width: 18px;
    text-align: right;
  }

  .print-group {
    break-inside: avoid;
    break-inside: avoid-column;
    page-break-inside: avoid;
    margin-bottom: 4px;
  }

  .print-group-title {
    font-size: 9pt;
    font-weight: 600;
    margin-bottom: 3px;
    border-bottom: 1px solid #222;
    padding-bottom: 2px;
  }

  .print-token-row {
    border-bottom: 1px solid #e2e2e2;
    padding-bottom: 2px;
    break-inside: avoid;
    page-break-inside: avoid;
    line-height: 1.25;
  }

  .print-footer {
    margin-top: 4mm;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 4mm;
    font-size: 8pt;
    color: #555;
  }

  .print-reg-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding-top: 2mm;
    border-top: 0.25mm solid #888;
  }

  .print-qr-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
    width: 46mm;
  }

  .print-qr-image {
    width: 18mm;
    height: 18mm;
    display: block;
    border: 0.2mm solid #bbb;
    border-radius: 0.8mm;
    background: #fff;
    image-rendering: pixelated;
  }

  .print-qr-caption {
    margin-top: 1.4mm;
    font-size: 6.3pt;
    line-height: 1.2;
    text-align: center;
    color: #444;
    word-break: break-word;
    white-space: pre-line;
  }

  .print-qr-expiry {
    margin-bottom: 1.1mm;
    font-size: 6.2pt;
    line-height: 1.2;
    text-align: center;
    color: #333;
    word-break: break-word;
  }

  body.print-mobile-list-compact .print-reg-header {
    margin-bottom: 2.2mm;
  }

  body.print-mobile-list-compact .print-reg-info-grid {
    margin-bottom: 2.2mm;
  }

  body.print-mobile-list-compact .print-reg-field {
    min-height: 9.4mm;
  }

  body.print-mobile-list-compact .print-reg-note {
    margin-bottom: 2mm;
    font-size: 8.8pt;
    line-height: 1.25;
  }

  body.print-mobile-list-compact .print-reg-body {
    gap: 3.5mm;
  }

  body.print-mobile-list-compact .print-reg-zone-head {
    min-height: 14.2mm;
  }

  body.print-mobile-list-compact .print-reg-zone-head-main {
    min-height: 16.2mm;
  }

  body.print-mobile-list-compact .print-reg-subtitle {
    margin-bottom: 0.8mm;
    font-size: 7.8pt;
  }

  body.print-mobile-list-compact .print-reg-table-head {
    margin-bottom: 0.45mm;
    font-size: 8.1pt;
  }

  body.print-mobile-list-compact .print-reg-lines {
    gap: 0.45mm;
  }

  body.print-mobile-list-compact .print-reg-line {
    min-height: 4.9mm;
    font-size: 8pt;
  }

  body.print-mobile-list-compact .print-reg-line-qty,
  body.print-mobile-list-compact .print-reg-line-name {
    min-height: 4.55mm;
    padding-bottom: 0.3mm;
  }

  body.print-mobile-list-compact .print-reg-total-row {
    margin-top: 1.2mm;
    font-size: 8.4pt;
  }

  body.print-mobile-list-compact .print-reg-total-box {
    min-height: 7mm;
    font-size: 9pt;
  }

  body.print-mobile-list-compact .print-footer {
    margin-top: 2.2mm;
    gap: 2.6mm;
    font-size: 7pt;
  }

  body.print-mobile-list-compact .print-reg-footer {
    padding-top: 1.2mm;
  }

  body.print-mobile-list-compact .print-qr-wrap {
    width: 38mm;
  }

  body.print-mobile-list-compact .print-qr-image {
    width: 14mm;
    height: 14mm;
  }

  body.print-mobile-list-compact .print-qr-caption {
    margin-top: 0.8mm;
    font-size: 5.6pt;
    line-height: 1.1;
  }

  body.print-mobile-list-compact .print-qr-expiry {
    margin-bottom: 0.8mm;
    font-size: 5.5pt;
    line-height: 1.1;
  }

  .print-v-header {
    border-bottom: 1px solid #222;
    padding-bottom: 3px;
    margin-bottom: 4px;
  }

  .print-v-export-line {
    margin: 0;
    font-size: 8pt;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .print-v-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: #f1f1f1;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 8.5pt;
    margin-bottom: 8px;
  }

  .print-v-body {
    --print-v-gap: 1.6mm;
    --print-v-cols: 8;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10mm;
  }

  body.print-multipage .print-v-body {
    display: block !important;
    gap: 0 !important;
  }

  body.print-multipage .print-v-zone {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-v-side-zone {
    margin-top: 3mm;
  }

  .print-v-token-zone {
    margin-top: 3mm;
  }

  .print-v-token-zone.token-page-break {
    break-before: page;
    page-break-before: always;
    margin-top: 0;
  }

  .print-v-zone h2 {
    font-size: 10pt;
    border-bottom: 1px solid #222;
    padding-bottom: 3px;
    margin-bottom: 4px;
  }

  .print-v-main-grid,
  .print-v-side-grid,
  .print-v-token-grid {
    display: grid;
    grid-template-columns: repeat(var(--print-v-cols), minmax(0, 1fr));
    gap: var(--print-v-gap);
    justify-content: start;
  }

  .print-v-card {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 7;
    overflow: hidden;
    border: 0.2mm solid #555;
    border-radius: 0.8mm;
    background: #f7f7f7;
  }

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

  .print-v-card .preview-image-overlay {
    font-size: 7.2pt;
    padding: 0.55mm 2.8mm;
    border-width: 0.16mm;
    box-shadow: none;
  }

  .print-v-card.is-preview-card::before {
    content: none;
  }

  .print-v-card.no-image {
    display: grid;
    place-items: center;
    font-size: 8pt;
    font-weight: 700;
  }

  .print-v-qty {
    position: absolute;
    top: 4.2mm;
    right: 0.7mm;
    padding: 0 2.2mm;
    border-radius: 3.4mm;
    font-size: 13pt;
    font-weight: 800;
    line-height: 1.2;
    background: #fff3c8;
    color: #111;
    border: 0.25mm solid #333;
  }

  .print-v-qty.print-v-qty-token {
    top: 1mm;
    right: 1mm;
    width: 7.6mm;
    height: 7.6mm;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #ffffff;
    font-size: 9.2pt;
    font-weight: 900;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
  }

  .print-v-qty.print-v-qty-token::before {
    content: "";
    position: absolute;
    inset: 0.36mm;
    background: #b20f0f;
    border: 0.23mm solid #2a0000;
    transform: rotate(45deg);
    z-index: -1;
  }

  .print-v-empty {
    border: 0.2mm dashed #bbb;
    border-radius: 1mm;
    min-height: 10mm;
    display: grid;
    place-items: center;
    font-size: 8pt;
    color: #666;
  }

  .print-v-footer {
    margin-top: 3px;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 4mm;
    font-size: 8pt;
    color: #555;
  }

  .print-v-qr-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
    width: 46mm;
  }

  .print-v-qr-image {
    width: 18mm;
    height: 18mm;
    display: block;
    border: 0.2mm solid #bbb;
    border-radius: 0.8mm;
    background: #fff;
    image-rendering: pixelated;
  }

  .print-v-qr-caption {
    margin-top: 1.4mm;
    font-size: 6.3pt;
    line-height: 1.2;
    text-align: center;
    color: #444;
    word-break: break-word;
    white-space: pre-line;
  }

  .print-v-qr-expiry {
    margin-bottom: 1.1mm;
    font-size: 6.2pt;
    line-height: 1.2;
    text-align: center;
    color: #333;
    word-break: break-word;
  }

  .token-print-page {
    margin: 0 auto;
    background: #ffffff;
    break-after: page;
    page-break-after: always;
    overflow: hidden;
  }

  .token-print-canvas {
    display: block;
  }

  .token-print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .token-print-grid {
    display: grid;
    align-content: start;
  }

  .token-print-card {
    --token-card-radius: 1.3mm;
    border: none;
    box-shadow: none;
  }

  .token-print-card .token-card {
    padding: 1.84mm;
    gap: 1.08mm;
    border-width: 0.75mm;
    border-color: #000;
    box-shadow: none;
  }

  .token-print-card .token-card-head {
    grid-template-columns: 1.95fr 0.81fr;
    grid-template-rows: minmax(10.4mm, auto) minmax(7.1mm, auto);
    grid-template-areas:
      "name name"
      "type color";
    gap: 0.9mm;
  }

  .token-print-card .token-card-head-type,
  .token-print-card .token-card-head-name,
  .token-print-card .token-card-head-color {
    min-height: 7.1mm;
    font-size: calc(4.94pt * var(--token-text-scale));
    border-width: 0.24mm;
    border-color: #000;
    border-radius: 0.45mm;
    padding: 0 1.1mm;
  }

  .token-print-card .token-card-head-name {
    min-height: 10.4mm;
    font-size: calc(9.6pt * var(--token-text-scale));
    font-weight: 900;
    line-height: 1.04;
    white-space: normal;
    text-overflow: clip;
    overflow-wrap: normal;
    word-break: normal;
    padding: 0.3mm 0.8mm;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .token-print-card .token-card-head-type {
    min-height: 7.1mm;
    font-size: calc(4.75pt * var(--token-text-scale));
    line-height: 1.12;
  }

  .token-print-card .token-card-head-color {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 7.1mm;
    font-size: calc(6.67pt * var(--token-text-scale));
    font-weight: 800;
    padding-top: 1.12mm;
  }

  .token-print-card .token-card-head-color-tag {
    position: absolute;
    left: 0.9mm;
    top: 0.55mm;
    font-size: calc(1.82pt * var(--token-text-scale));
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.03em;
    opacity: 0.6;
  }

  .token-print-card .token-card-head-color-value {
    display: block;
    width: 100%;
    text-align: center;
    line-height: 1;
  }

  .token-print-card .token-card-art-frame {
    border-width: 0.24mm;
    border-color: #000;
  }

  .token-print-card .token-card-art {
    inset: 1mm;
    opacity: 0.52;
  }

  .token-print-card .token-card-keywords {
    inset: 1mm;
    font-size: calc(8.6pt * var(--token-text-scale));
    font-weight: 800;
    line-height: 1.2;
    padding: 0.65mm 0.8mm;
    background: #000;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.45);
    text-shadow: none;
  }

  .token-print-card .token-card-rules-frame {
    min-height: 32%;
    padding: 0.95mm;
    border-width: 0.24mm;
    border-color: #000;
  }

  .token-print-card .token-card-rules-body {
    font-size: calc(6.2pt * var(--token-text-scale));
    line-height: 1.2;
    font-weight: 700;
    border-width: 0.2mm;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.4);
    padding: 0.95mm 1.4mm;
    background: rgba(255, 255, 255, 0.96);
    word-break: normal;
    overflow-wrap: normal;
  }

  .token-print-card .token-card.token-no-keywords .token-card-rules-frame {
    min-height: 32%;
  }

  .token-print-card .token-card.token-no-keywords .token-card-rules-body {
    font-size: calc(6.5pt * var(--token-text-scale));
    font-weight: 700;
    line-height: 1.2;
  }

  .token-print-card .token-card-pt {
    right: 1.9mm;
    bottom: 1.9mm;
    min-width: 14.8mm;
    padding: 1.05mm 2.55mm;
    border-width: 0.24mm;
    border-radius: 0.6mm;
    font-size: calc(16pt * var(--token-text-scale));
  }

  .token-print-card .token-card-generated-by {
    left: 2mm;
    right: 22mm;
    bottom: 2.1mm;
    font-size: calc(3.4pt * var(--token-text-scale));
  }
}

@media (max-width: 900px) {
  body {
    padding: calc(14px + env(safe-area-inset-top, 0px)) 20px calc(36px + env(safe-area-inset-bottom, 0px));
  }

  .brand h1 {
    font-size: clamp(28px, 8vw, 42px);
    line-height: 1;
  }

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

  .result-card {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .land-mana-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .land-type-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .token-sheet-settings,
  .token-form-grid {
    grid-template-columns: 1fr;
  }

  .token-form-grid .wide {
    grid-column: auto;
  }

  .token-sheet-preview-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) and (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (max-width: 600px) {
  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 16px;
  }

  .brand-eyebrow {
    font-size: 10px;
    letter-spacing: 0.2em;
  }

  .brand h1 {
    font-size: clamp(24px, 9vw, 34px);
    letter-spacing: 0.03em;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat.wide {
    grid-column: span 2;
  }

  .view-tabs {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .site-top-links {
    justify-content: space-between;
  }

  .bottom-tab-bar {
    padding-left: 8px;
    padding-right: 8px;
    gap: 5px;
  }

  .bottom-tab-link {
    min-height: 52px;
    padding-left: 5px;
    padding-right: 5px;
  }

  .bottom-tab-label {
    font-size: 10px;
  }

  .token-list-item {
    grid-template-columns: 58px 1fr;
  }

  .token-list-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .affiliate-shelf summary {
    min-height: 54px;
    padding: 10px 12px;
  }

  .affiliate-summary-copy small {
    max-width: 48vw;
  }

  .affiliate-summary-action {
    font-size: 10px;
  }

  .affiliate-shelf-body {
    padding-right: 12px;
    padding-left: 12px;
  }

  .affiliate-product-list {
    grid-auto-columns: minmax(164px, 70vw);
  }
}

@media print {
  .bottom-tab-bar {
    display: none !important;
  }

  .affiliate-sentinel,
  .affiliate-shelf {
    display: none !important;
  }
}
