@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,400&display=swap");

/* Mobile-first: these apply by default to all screen sizes */
:root {
  --tab-h: 0px;
  --tab-bottom-offset: 0px;
  --bottom-ui-clearance: 0px;
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"],
input[type="week"],
textarea,
select:not(.nav-currency-select) {
  font-size: 16px;
}

.navbar {
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  padding: 0.5rem 0.8rem 0;
  gap: 0.45rem;
}
.nav-logo img {
  height: 42px;
}
.nav-actions {
  flex: 0 0 auto;
  margin-left: auto;
  gap: 0.4rem;
  flex-wrap: nowrap;
}
#theme-toggle {
  width: 30px;
  height: 30px;
  font-size: 1rem;
}
#theme-toggle .theme-icon {
  width: 1.25rem;
  height: 1.25rem;
}
.menu-toggle {
  display: inline-flex;
  justify-content: center;
  width: 30px;
  max-width: 30px;
  min-height: 30px;
  height: 30px;
  padding: 0;
  gap: 0;
  border: none;
  background: none;
  box-shadow: none;
}
.menu-toggle-copy,
.menu-toggle-chevron {
  display: none;
}
.menu-toggle-avatar {
  width: 1rem;
  height: 1rem;
  border: none;
  background: none;
}
.menu-toggle-avatar .menu-toggle-icon {
  width: 1rem;
  height: 1rem;
}
.menu-panel-avatar {
  width: 40px;
  height: 40px;
}
.menu-toggle-copy strong {
  font-size: 0.95rem;
}
.menu-toggle-copy span {
  font-size: 0.7rem;
}
.nav-actions .btn-sm {
  padding: 0.36rem 0.72rem;
  font-size: 0.56rem;
  letter-spacing: 0.04em;
}
.nav-currency-select {
  min-width: 58px;
  padding: 0 0.5rem;
  font-size: 0.58rem;
  height: 28px;
}
.nav-username,
.nav-signout-btn {
  display: none;
}
.mobile-top-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: calc(100% + 1.6rem);
  margin: 0.15rem -0.8rem 0;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
[data-theme="light"] .mobile-top-links {
  background: rgba(138, 104, 32, 0.03);
}
.mobile-top-links > a,
.mobile-top-links > .mobile-nav-dropdown > .nav-dropdown-toggle {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 52px;
  padding: 0.35rem 0.2rem 0.5rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.mobile-top-links > .mobile-nav-dropdown {
  position: relative;
  display: flex;
  justify-content: center;
}
.mobile-top-links > .mobile-nav-dropdown > .nav-dropdown-toggle {
  width: 100%;
  gap: 0.3rem;
  border-radius: 0;
  line-height: 1;
}
.mobile-top-links
  > .mobile-nav-dropdown
  > .nav-dropdown-toggle
  .nav-dropdown-chevron {
  width: 0.78rem;
  height: 0.78rem;
}
.mobile-top-links > a {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-top-links > a.active,
.mobile-top-links .nav-dropdown-toggle.active,
.mobile-top-links .nav-dropdown.is-open > .nav-dropdown-toggle {
  color: var(--gold);
}
.mobile-top-links > a.active::after,
.mobile-top-links .nav-dropdown-toggle.active::after,
.mobile-top-links .nav-dropdown.is-open > .nav-dropdown-toggle::after {
  content: "";
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}
.mobile-top-links .nav-dropdown-menu {
  top: calc(100% + 0.35rem);
  right: 0.65rem;
  left: auto;
  width: min(220px, calc(100vw - 1.3rem));
  min-width: 0;
}
.menu-panel-shell {
  position: fixed;
  inset: 0;
  z-index: 220;
}
.menu-panel-shell.is-open {
  display: block;
}
.menu-panel {
  top: calc(var(--safe-top) + 4.2rem);
}

#search-btn {
  width: 100%;
}
.card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.72rem;
}
.tags-page-modal-dialog {
  padding: 0.45rem;
}
.tags-page-modal-body {
  max-height: calc(
    100dvh - max(0.5rem, var(--safe-top)) - (var(--bottom-ui-clearance) + 2rem)
  );
}
#tags-page-iframe {
  height: 58vh;
  min-height: 260px;
}

#version-modal {
  align-items: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#version-modal .modal {
  margin-top: max(0.5rem, var(--safe-top));
  max-height: calc(
    100dvh - max(0.5rem, var(--safe-top)) -
      max(0.5rem, calc(var(--bottom-ui-clearance) - var(--tab-h)))
  );
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}
#version-modal #version-grid {
  flex: 0 1 auto;
  --version-grid-scroll-height: clamp(220px, 34dvh, 300px);
  min-height: var(--version-grid-scroll-height);
  max-height: var(--version-grid-scroll-height);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 0.1rem;
}
#version-modal #version-options {
  flex-shrink: 0;
}
#version-modal #version-pagination {
  flex-shrink: 0;
}
#version-modal #version-actions {
  position: static;
  background: transparent;
  padding-top: 0.6rem;
  padding-bottom: calc(0.2rem + var(--safe-bottom));
  border-top: 1px solid var(--border);
}

.version-card {
  position: relative;
  border-radius: 10px;
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.version-card:hover {
  border-color: var(--border-glow);
}

.version-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px 8px 0 0;
}

.version-card-info {
  padding: .38rem .45rem .42rem;
}

.version-card-set {
  font-size: .62rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: .1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.version-card-price {
  font-size: .58rem;
  color: var(--gold);
  margin-top: .1rem;
}

.version-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold);
}

.version-card.selected::after {
  content: "✓";
  position: absolute;
  top: .35rem;
  right: .35rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--gold);
  color: #0c0e13;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.4rem;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .55), 0 0 0 1.5px rgba(0, 0, 0, .18);
}

[data-theme="light"] .version-card.selected::after {
  color: #fff;
}

.finish-toggle {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  background: var(--bg-raised);
  box-shadow: inset 0 0 0 1.5px var(--border);
  transition: background .18s ease, box-shadow .18s ease;
}

.finish-toggle::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
  transition: transform .18s ease, background .18s ease;
}

.finish-toggle[data-state="foil"] {
  background: #3daa6e;
  box-shadow: inset 0 0 0 1.5px #2d8a58;
}

.finish-toggle[data-state="foil"]::after {
  background: #fff;
  transform: translateX(20px);
}

.finish-toggle[data-state="either"] {
  background: var(--teal);
  box-shadow: inset 0 0 0 1.5px var(--teal);
}

.finish-toggle[data-state="either"]::after {
  background: #fff;
  transform: translateX(10px);
}

.auth-wrap {
  padding: 1rem;
  align-items: flex-start;
  padding-top: 2rem;
}
.auth-card {
  padding: 1.75rem 1.25rem;
}

#toast-container {
  left: 1rem;
  right: 1rem;
  max-width: none;
}
.toast {
  max-width: none;
}

.version-grid-scroll {
  --version-grid-scroll-height: clamp(220px, 34dvh, 300px);
}

.cookie-banner__inner {
  align-items: stretch;
  flex-direction: column;
  padding: 0.95rem;
}
.cookie-banner__copy {
  gap: 0.75rem;
}
.cookie-banner__body {
  max-width: none;
  font-size: 0.9rem;
}
.cookie-banner__actions {
  width: 100%;
  justify-content: stretch;
}
.cookie-banner__actions .btn {
  flex: 1 1 180px;
  justify-content: center;
}

.card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.stat-item {
  padding: 0.55rem 0.75rem;
}

:root {
  --bg: #0c0e13;
  --bg-card: #12151d;
  --bg-raised: #181c27;
  --bg-overlay: #1a1a2e;
  --border: #252a3a;
  --border-glow: #384060;
  --gold: #c9a84c;
  --gold-light: #e8c96a;
  --gold-dim: #6b5520;
  --teal: #3dbfa8;
  --teal-dim: #1a5e52;
  --red: #c94c4c;
  --text: #e8e4d8;
  --text-muted: #b4bbd0;
  --text-dim: #8a92ab;
  --consent-bg: #12151d;
  --consent-border: #252a3a;
  --consent-shadow: 0 4px 32px rgba(0, 0, 0, 0.6);
  --consent-tint: rgba(201, 168, 76, 0.08);
  --consent-icon-bg: rgba(201, 168, 76, 0.12);
  --consent-icon-border: rgba(201, 168, 76, 0.22);
  --radius: 6px;
  --radius-lg: 12px;
  --shadow: 0 4px 32px rgba(0, 0, 0, 0.6);
  --font-display: "Cinzel", serif;
  --font-body: "Crimson Pro", Georgia, serif;
  --nav-h: 62px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-h: 60px;
  --tab-bottom-offset: 0.5rem;
  --bottom-ui-clearance: calc(
    var(--tab-h) + var(--safe-bottom) + var(--tab-bottom-offset)
  );
}
[data-theme="light"] {
  --bg: #f5f2eb;
  --bg-card: #ffffff;
  --bg-raised: #ede9df;
  --bg-overlay: #ffffff;
  --border: #d4cfc4;
  --border-glow: #b8a87a;
  --gold: #8a6820;
  --gold-light: #a07828;
  --gold-dim: #d4b878;
  --teal: #1a7a6a;
  --teal-dim: #b8e0da;
  --red: #a83232;
  --text: #1a1814;
  --text-muted: #4f493d;
  --text-dim: #6e6658;
  --consent-bg: #fffdf9;
  --consent-border: #d8d1c5;
  --consent-shadow: 0 12px 34px rgba(58, 42, 14, 0.12);
  --consent-tint: rgba(138, 104, 32, 0.08);
  --consent-icon-bg: rgba(138, 104, 32, 0.08);
  --consent-icon-border: rgba(138, 104, 32, 0.18);
  --shadow: 0 4px 32px rgba(0, 0, 0, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}
body.menu-panel-open {
  overflow: hidden;
}
a {
  color: var(--gold-light);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.14em;
  transition: color 0.2s;
}
a:hover {
  color: var(--gold);
}
.btn,
.nav-logo,
.mobile-tab,
.auth-logo a {
  text-decoration: none;
}
img {
  max-width: 100%;
  display: block;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}
main {
  flex: 1;
  padding: 1.25rem 1rem calc(var(--bottom-ui-clearance) + 1rem);
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  overflow-x: clip;
}

#collection-page,
#wishlist-page,
#account-page,
#advance-search-page,
#home-search-page {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.page-content-shell {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  min-width: 0;
}

.navbar {
  background: rgba(12, 14, 19, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 100;
}
[data-theme="light"] .navbar {
  background: rgba(245, 242, 235, 0.97);
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: auto;
  min-height: 58px;
  gap: 0.5rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.28rem 0.65rem;
  flex-wrap: wrap;
  min-width: 0;
}
.nav-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 1;
}
.nav-logo img {
  display: block;
  height: 34px;
  width: auto;
}
.nav-links {
  display: none;
  gap: 1.75rem;
  list-style: none;
}
.nav-links > li {
  position: relative;
  display: flex;
  align-items: center;
}
.nav-links a {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--gold);
}
.nav-dropdown {
  position: relative;
}
.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav-dropdown-toggle:hover,
.nav-dropdown-toggle:focus-visible,
.nav-dropdown-toggle.active,
.nav-dropdown.is-open > .nav-dropdown-toggle {
  color: var(--gold);
}
.nav-dropdown-chevron {
  width: 0.82rem;
  height: 0.82rem;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.7 9.7 12 15l5.3-5.3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.7 9.7 12 15l5.3-5.3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2'/%3E%3C/svg%3E");
  transition: transform 0.2s ease;
}
.nav-dropdown.is-open > .nav-dropdown-toggle .nav-dropdown-chevron {
  transform: rotate(180deg);
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.7rem);
  left: 0;
  min-width: 13rem;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  gap: 0.12rem;
  z-index: 180;
}
.nav-dropdown.is-open > .nav-dropdown-menu {
  display: flex;
}
.nav-dropdown-link {
  display: flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.nav-dropdown-link:hover,
.nav-dropdown-link.active {
  background: rgba(201, 168, 76, 0.12);
  color: var(--text);
}
.nav-dropdown-link-child {
  padding-left: 1.4rem;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}
[data-theme="light"] .nav-dropdown-link:hover,
[data-theme="light"] .nav-dropdown-link.active {
  background: rgba(138, 104, 32, 0.1);
}
.nav-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  min-width: 0;
  max-width: none;
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
  overflow: visible;
  row-gap: 0.25rem;
}
.menu-panel-shell {
  display: none;
}
.menu-panel-shell.is-open {
  display: block;
}
.menu-toggle {
  align-items: center;
  justify-content: flex-start;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 1px solid var(--border);
  outline: none;
  background: var(--bg-raised);
  box-shadow: none;
  border-radius: 999px;
  padding: 0.34rem 0.62rem 0.34rem 0.42rem;
  margin: 0;
  width: auto;
  max-width: min(280px, calc(100vw - 7rem));
  min-height: 54px;
  color: var(--text);
  cursor: pointer;
  flex: 0 0 auto;
  line-height: 1;
  gap: 0.72rem;
  text-align: left;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease,
    opacity 0.2s ease;
}
.menu-toggle-avatar,
.menu-panel-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.96),
    rgba(219, 223, 232, 0.82)
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(95, 101, 116, 0.86);
  flex: 0 0 auto;
}
.menu-toggle:hover,
.menu-toggle:focus-visible {
  color: var(--text);
  border-color: var(--border);
  background: var(--bg-raised);
  box-shadow: none;
}
.menu-toggle-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8.2' r='4.1' fill='black'/%3E%3Cpath d='M4.5 20c1.65-4.35 4.26-6.5 7.5-6.5s5.85 2.15 7.5 6.5Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8.2' r='4.1' fill='black'/%3E%3Cpath d='M4.5 20c1.65-4.35 4.26-6.5 7.5-6.5s5.85 2.15 7.5 6.5Z' fill='black'/%3E%3C/svg%3E");
}
.menu-toggle-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.14rem;
  line-height: 1.1;
}
.menu-toggle-copy strong,
.menu-panel-profile-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-toggle-copy strong {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.menu-toggle-copy span,
.menu-panel-profile-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-toggle-copy span {
  font-size: 0.74rem;
  color: var(--text-dim);
}
.menu-toggle-chevron {
  width: 0.95rem;
  height: 0.95rem;
  margin-left: auto;
  background-color: currentColor;
  color: var(--text-muted);
  flex: 0 0 auto;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.7 14.3 12 9l5.3 5.3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.7 14.3 12 9l5.3 5.3' fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2'/%3E%3C/svg%3E");
  transform: rotate(180deg);
  transition:
    transform 0.2s ease,
    color 0.2s ease;
}
.menu-toggle[aria-expanded="true"] .menu-toggle-chevron {
  transform: rotate(0deg);
  color: var(--text);
}
.menu-toggle[aria-expanded="true"] {
  border-color: var(--border);
  background: var(--bg-raised);
  box-shadow: none;
}
[data-theme="light"] .menu-toggle-avatar,
[data-theme="light"] .menu-panel-avatar {
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 1),
    rgba(225, 229, 236, 0.92)
  );
  border-color: rgba(120, 128, 150, 0.18);
  color: rgba(112, 118, 131, 0.86);
}
.menu-panel-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 0;
  background: rgba(12, 14, 19, 0.26);
}
.menu-panel {
  position: absolute;
  z-index: 1;
  right: 0.8rem;
  width: min(286px, calc(100vw - 1.6rem));
  padding: 1rem 0.95rem 1.05rem;
  border-radius: 26px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
}
.menu-panel-profile {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  color: var(--text);
  padding-bottom: 0.95rem;
}
.menu-panel-profile-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.menu-panel-profile-copy strong {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.menu-panel-profile-copy span {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.menu-panel-auth {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  padding-bottom: 0.95rem;
}
.menu-panel-auth .btn {
  width: 100%;
  justify-content: center;
}
.menu-panel-section-label {
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  margin-bottom: 0.7rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.menu-panel-list {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}
.menu-panel-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 48px;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  color: var(--text-muted);
  text-decoration: none;
}
.menu-panel-link.active {
  background: rgba(201, 168, 76, 0.12);
  color: var(--text);
}
.menu-panel-link-button {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.menu-panel-link-icon {
  flex: 0 0 auto;
  color: currentColor;
}
.menu-panel-divider {
  height: 1px;
  margin: 0.8rem 0;
  background: var(--border);
}
.menu-panel-link-danger {
  color: var(--red);
}
.menu-panel-link-icon-grid,
.menu-panel-link-icon-labels,
.menu-panel-link-icon-clock,
.menu-panel-link-icon-signout {
  width: 1.1rem;
  height: 1.1rem;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}
.menu-panel-link-icon-grid {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.4' fill='black'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.4' fill='black'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.4' fill='black'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.4' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.4' fill='black'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.4' fill='black'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.4' fill='black'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.4' fill='black'/%3E%3C/svg%3E");
}
.menu-panel-link-icon-labels {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.2 4.2H5.8A1.8 1.8 0 0 0 4 6v4.4c0 .48.19.94.53 1.27l7.8 7.8a1.8 1.8 0 0 0 2.54 0l4.64-4.64a1.8 1.8 0 0 0 0-2.54l-7.8-7.8a1.8 1.8 0 0 0-1.27-.53ZM8 9.1a1.35 1.35 0 1 1 0-2.7 1.35 1.35 0 0 1 0 2.7Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.2 4.2H5.8A1.8 1.8 0 0 0 4 6v4.4c0 .48.19.94.53 1.27l7.8 7.8a1.8 1.8 0 0 0 2.54 0l4.64-4.64a1.8 1.8 0 0 0 0-2.54l-7.8-7.8a1.8 1.8 0 0 0-1.27-.53ZM8 9.1a1.35 1.35 0 1 1 0-2.7 1.35 1.35 0 0 1 0 2.7Z' fill='black'/%3E%3C/svg%3E");
}
.menu-panel-link-icon-clock {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='8.2' fill='none' stroke='black' stroke-width='2.2'/%3E%3Cpath d='M12 7.2v5l3.6 2.1' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='8.2' fill='none' stroke='black' stroke-width='2.2'/%3E%3Cpath d='M12 7.2v5l3.6 2.1' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
}
.menu-panel-link-icon-signout {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4H6.8A1.8 1.8 0 0 0 5 5.8v12.4A1.8 1.8 0 0 0 6.8 20H10' fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round'/%3E%3Cpath d='M13 8.2 18.6 12 13 15.8' fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M10 12h8.3' fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4H6.8A1.8 1.8 0 0 0 5 5.8v12.4A1.8 1.8 0 0 0 6.8 20H10' fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round'/%3E%3Cpath d='M13 8.2 18.6 12 13 15.8' fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M10 12h8.3' fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round'/%3E%3C/svg%3E");
}
.mobile-tab-icon {
  width: 1.1rem;
  height: 1.1rem;
  line-height: 1;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}
.mobile-tab-icon-rules {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 4.5a2 2 0 0 1 2-2h10v15.5a2 2 0 0 0-2-2H5z' fill='black'/%3E%3Cpath d='M17 4.2h1a1 1 0 0 1 1 1V20a1.5 1.5 0 0 1-1.5 1.5H7.2a2.7 2.7 0 0 1-2.2-.95c.42.12.86.18 1.3.18H15a2 2 0 0 0 2-2z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 4.5a2 2 0 0 1 2-2h10v15.5a2 2 0 0 0-2-2H5z' fill='black'/%3E%3Cpath d='M17 4.2h1a1 1 0 0 1 1 1V20a1.5 1.5 0 0 1-1.5 1.5H7.2a2.7 2.7 0 0 1-2.2-.95c.42.12.86.18 1.3.18H15a2 2 0 0 0 2-2z' fill='black'/%3E%3C/svg%3E");
}
.mobile-tab-icon-account {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8.2' r='4.1' fill='black'/%3E%3Cpath d='M4.5 20c1.65-4.35 4.26-6.5 7.5-6.5s5.85 2.15 7.5 6.5Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8.2' r='4.1' fill='black'/%3E%3Cpath d='M4.5 20c1.65-4.35 4.26-6.5 7.5-6.5s5.85 2.15 7.5 6.5Z' fill='black'/%3E%3C/svg%3E");
}
.theme-icon {
  width: 1.05rem;
  height: 1.05rem;
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  vertical-align: middle;
}
.theme-icon-w {
  background-image: url("/api/scryfall-symbol.php?code=W");
}
.theme-icon-b {
  background-image: url("/api/scryfall-symbol.php?code=B");
}
.theme-icon-t {
  background-image: url("/api/scryfall-symbol.php?code=T");
}
.theme-icon-q {
  background-image: url("/api/scryfall-symbol.php?code=Q");
}
.theme-icon-sun {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23caa24a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.9'%3E%3Ccircle cx='12' cy='12' r='4.2'/%3E%3Cpath d='M12 2.5v2.3M12 19.2v2.3M4.8 4.8l1.6 1.6M17.6 17.6l1.6 1.6M2.5 12h2.3M19.2 12h2.3M4.8 19.2l1.6-1.6M17.6 6.4l1.6-1.6'/%3E%3C/g%3E%3C/svg%3E");
}
.theme-icon-moon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14.9 2.8a8.8 8.8 0 1 0 6.3 14.9A9.8 9.8 0 1 1 14.9 2.8Z' fill='none' stroke='%23caa24a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.9'/%3E%3C/svg%3E");
}
#theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text);
  font-size: inherit;
}
.nav-username {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
  max-width: 100%;
}
.nav-currency-select {
  display: inline-block;
  width: auto;
  min-width: 60px;
  padding: 0.22rem 0.38rem;
  font-size: 0.56rem;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
}
.nav-currency-toggle {
  display: none;
  gap: 0.18rem;
  padding: 0.18rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-raised);
}
.nav-currency-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(24, 30, 45, 0.98);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition:
    transform 0.18s,
    background 0.18s,
    border-color 0.18s,
    color 0.18s,
    box-shadow 0.18s;
}
.nav-currency-btn:hover {
  transform: translateY(-1px);
  background: rgba(33, 40, 58, 0.98);
  border-color: var(--border-glow);
  color: var(--text);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}
.nav-currency-btn.active {
  background: rgba(201, 168, 76, 0.16);
  color: var(--gold);
  border-color: var(--gold-dim);
}
[data-theme="light"] .nav-currency-btn.active {
  background: #5f4412;
  border-color: #5f4412;
  color: #fff;
}
[data-theme="light"] .nav-currency-btn {
  background: #fbf6ec;
  border-color: rgba(138, 104, 32, 0.18);
  color: #6d624f;
  box-shadow: none;
}
[data-theme="light"] .nav-currency-btn:hover {
  background: #fffaf1;
  border-color: rgba(122, 87, 25, 0.44);
  color: #4f3c1f;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--btn-border, transparent);
  background: var(--btn-bg, transparent);
  color: var(--btn-color, var(--text));
  box-shadow: var(--btn-shadow, none);
  font-weight: var(--btn-weight, 600);
  transition:
    transform 0.18s,
    background 0.18s,
    border-color 0.18s,
    color 0.18s,
    box-shadow 0.18s;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}
.btn:hover {
  transform: translateY(-1px);
  background: var(--btn-hover-bg, var(--btn-bg, transparent));
  color: var(--btn-hover-color, var(--btn-color, var(--text)));
  border-color: var(--btn-hover-border, var(--btn-border, transparent));
  box-shadow: var(--btn-hover-shadow, var(--btn-shadow, none));
}
.btn:focus-visible {
  outline: 2px solid rgba(201, 168, 76, 0.88);
  outline-offset: 2px;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-primary {
  --btn-bg: linear-gradient(180deg, #dfbf73 0%, #c9a84c 58%, #ab8730 100%);
  --btn-border: rgba(223, 191, 115, 0.72);
  --btn-color: #0c0e13;
  --btn-shadow: 0 12px 26px rgba(117, 86, 24, 0.22);
  --btn-hover-bg: linear-gradient(
    180deg,
    #e7ca83 0%,
    #d3af55 58%,
    #b58f35 100%
  );
  --btn-hover-border: rgba(247, 221, 154, 0.92);
  --btn-hover-color: #0c0e13;
  --btn-hover-shadow: 0 16px 32px rgba(117, 86, 24, 0.28);
  --btn-weight: 700;
}
[data-theme="light"] .btn-primary {
  --btn-bg: linear-gradient(180deg, #7d5b1c 0%, #6a4b15 100%);
  --btn-border: rgba(106, 75, 21, 0.88);
  --btn-color: #fff;
  --btn-shadow: none;
  --btn-hover-bg: linear-gradient(180deg, #8b6821 0%, #755317 100%);
  --btn-hover-border: rgba(106, 75, 21, 0.96);
  --btn-hover-color: #fff;
  --btn-hover-shadow: none;
}
.btn-secondary,
.btn-ghost,
.btn-outline {
  --btn-bg: linear-gradient(
    180deg,
    rgba(40, 48, 68, 0.98) 0%,
    rgba(24, 30, 45, 0.98) 100%
  );
  --btn-border: var(--border);
  --btn-color: var(--text-muted);
  --btn-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  --btn-hover-bg: linear-gradient(
    180deg,
    rgba(49, 58, 81, 0.98) 0%,
    rgba(31, 38, 56, 0.98) 100%
  );
  --btn-hover-border: var(--border-glow);
  --btn-hover-color: var(--text);
  --btn-hover-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}
[data-theme="light"] .btn-secondary,
[data-theme="light"] .btn-ghost,
[data-theme="light"] .btn-outline {
  --btn-bg: linear-gradient(180deg, #fbf6ec 0%, #efe4d3 100%);
  --btn-border: rgba(138, 104, 32, 0.18);
  --btn-color: #4f3c1f;
  --btn-shadow: none;
  --btn-hover-bg: linear-gradient(180deg, #fffaf1 0%, #f3e8d8 100%);
  --btn-hover-border: rgba(122, 87, 25, 0.44);
  --btn-hover-color: #3b2d18;
  --btn-hover-shadow: none;
}
.btn-secondary.active,
.btn-ghost.active,
.btn-outline.active {
  --btn-bg: rgba(201, 168, 76, 0.18);
  --btn-border: var(--gold-dim);
  --btn-color: var(--gold);
  --btn-shadow: none;
  --btn-hover-bg: rgba(201, 168, 76, 0.22);
  --btn-hover-border: var(--gold);
  --btn-hover-color: var(--gold);
  --btn-hover-shadow: none;
}
[data-theme="light"] .btn-secondary.active,
[data-theme="light"] .btn-ghost.active,
[data-theme="light"] .btn-outline.active,
[data-theme="light"] .btn-secondary.active .vicon,
[data-theme="light"] .btn-secondary.active .vlabel,
[data-theme="light"] .btn-ghost.active .vicon,
[data-theme="light"] .btn-ghost.active .vlabel,
[data-theme="light"] .btn-outline.active .vicon,
[data-theme="light"] .btn-outline.active .vlabel {
  --btn-bg: #5f4412;
  --btn-border: #5f4412;
  --btn-color: #fff;
  --btn-hover-bg: #6a4b15;
  --btn-hover-border: #6a4b15;
  --btn-hover-color: #fff;
  color: #fff;
}
[data-theme="light"] .btn-secondary.active .vicon,
[data-theme="light"] .btn-secondary.active .vlabel,
[data-theme="light"] .btn-ghost.active .vicon,
[data-theme="light"] .btn-ghost.active .vlabel,
[data-theme="light"] .btn-outline.active .vicon,
[data-theme="light"] .btn-outline.active .vlabel {
  opacity: 1;
}
.btn-danger {
  --btn-bg: linear-gradient(
    180deg,
    rgba(110, 34, 34, 0.98) 0%,
    rgba(78, 25, 25, 0.98) 100%
  );
  --btn-border: rgba(201, 76, 76, 0.36);
  --btn-color: #ffe0e0;
  --btn-shadow: 0 12px 26px rgba(52, 16, 16, 0.22);
  --btn-hover-bg: linear-gradient(
    180deg,
    rgba(128, 41, 41, 0.98) 0%,
    rgba(91, 30, 30, 0.98) 100%
  );
  --btn-hover-border: rgba(255, 154, 154, 0.46);
  --btn-hover-color: #fff3f3;
  --btn-hover-shadow: 0 16px 32px rgba(52, 16, 16, 0.28);
}
[data-theme="light"] .btn-danger {
  --btn-bg: rgba(143, 63, 63, 0.08);
  --btn-border: rgba(143, 63, 63, 0.24);
  --btn-color: #8f3f3f;
  --btn-shadow: none;
  --btn-hover-bg: rgba(143, 63, 63, 0.14);
  --btn-hover-border: rgba(143, 63, 63, 0.34);
  --btn-hover-color: #7b3030;
  --btn-hover-shadow: none;
}
.btn-sm {
  min-height: 32px;
  padding: 0.34rem 0.82rem;
  font-size: 0.64rem;
}
.tag-manage-btn {
  font-size: 0.58rem;
}
.btn-lg {
  min-height: 46px;
  padding: 0.75rem 2rem;
  font-size: 0.78rem;
}
.btn-block {
  width: 100%;
  justify-content: center;
}
.nav-actions .btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.57rem;
}
.nav-signout-btn {
  min-width: 0;
  justify-content: center;
}
.nav-signout-full {
  display: inline;
}

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  padding: 0 1rem calc(1rem + var(--safe-bottom));
  pointer-events: none;
}
.cookie-banner__inner {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--consent-border);
  border-radius: calc(var(--radius-lg) + 4px);
  background:
    linear-gradient(180deg, var(--consent-tint), rgba(201, 168, 76, 0) 42%),
    var(--consent-bg);
  box-shadow: var(--consent-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
}
.cookie-banner__copy {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: 0;
  flex: 1 1 auto;
}
.cookie-banner__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--consent-icon-border);
  background: var(--consent-icon-bg);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.cookie-banner__text {
  min-width: 0;
}
.cookie-banner__eyebrow {
  margin: 0 0 0.2rem;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cookie-banner__body {
  margin: 0;
  max-width: 60ch;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.cookie-banner__body a {
  color: var(--gold);
}
.cookie-banner__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
html[data-theme="light"] .cookie-banner__inner,
body[data-theme="light"] .cookie-banner__inner {
  background:
    linear-gradient(
      180deg,
      rgba(138, 104, 32, 0.08),
      rgba(138, 104, 32, 0) 42%
    ),
    #fffdf9;
  border-color: #d8d1c5;
  box-shadow: 0 12px 34px rgba(58, 42, 14, 0.12);
}
html[data-theme="light"] .cookie-banner__icon,
body[data-theme="light"] .cookie-banner__icon {
  border-color: rgba(138, 104, 32, 0.18);
  background: rgba(138, 104, 32, 0.08);
}
html[data-theme="light"] .cookie-banner__eyebrow,
body[data-theme="light"] .cookie-banner__eyebrow,
html[data-theme="light"] .cookie-banner__body a,
body[data-theme="light"] .cookie-banner__body a {
  color: #8a6820;
}
html[data-theme="light"] .cookie-banner__body,
body[data-theme="light"] .cookie-banner__body {
  color: #4f493d;
}
html[data-theme="light"] .cookie-banner .btn-secondary,
body[data-theme="light"] .cookie-banner .btn-secondary {
  background: transparent;
  color: #4f493d;
  border-color: #d4cfc4;
}
html[data-theme="light"] .cookie-banner .btn-primary,
body[data-theme="light"] .cookie-banner .btn-primary {
  background: #6a4b15;
  color: #fff;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  flex-direction: column;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 1.6rem;
  color: var(--text);
}
.page-header h1 span {
  color: var(--gold);
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}
.page-header .btn {
  width: 100%;
  justify-content: center;
}

.stats-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.65rem 1rem;
  flex: 1 1 calc(50% - 0.25rem);
  min-width: calc(50% - 0.25rem);
}
.stat-label {
  font-family: var(--font-display);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.stat-value {
  font-size: 1.2rem;
  font-weight: 300;
}
.stat-value.gold {
  color: var(--gold);
}
.stat-value.teal {
  color: var(--teal);
}

.form-group {
  margin-bottom: 1.1rem;
}
label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
input,
select,
textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.55rem 0.85rem;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}
input::placeholder {
  color: var(--text-dim);
}
.error-msg {
  color: var(--red);
  font-size: 0.88rem;
  margin-top: 0.35rem;
}
.status-msg {
  margin-bottom: 1rem;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}
.status-msg.is-error {
  border-color: rgba(201, 76, 76, 0.35);
  background: rgba(201, 76, 76, 0.08);
  color: var(--red);
}
.status-msg.is-success {
  border-color: rgba(61, 191, 168, 0.35);
  background: rgba(61, 191, 168, 0.08);
  color: var(--teal);
}
.form-hint {
  margin-top: 0.25rem;
  color: var(--text-dim);
  font-size: 0.75rem;
}
.subtle-link {
  color: var(--text-dim);
  font-size: 0.85rem;
}
.subtle-link:hover {
  color: var(--gold);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  flex-direction: column;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.search-wrap input {
  padding-left: 2.4rem;
}
.search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.search-icon-mtg {
  width: 1rem;
  height: 1rem;
  font-size: 0;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10' cy='10' r='6.5' fill='none' stroke='black' stroke-width='2.2'/%3E%3Cpath d='M14.8 14.8 21 21' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10' cy='10' r='6.5' fill='none' stroke='black' stroke-width='2.2'/%3E%3Cpath d='M14.8 14.8 21 21' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.filter-select {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.8rem;
  font-size: 0.88rem;
}

.pip,
.mpip {
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  color: transparent !important;
  text-shadow: none;
}
.mpip {
  display: inline-block;
  vertical-align: middle;
}
.pip-w,
.mpip.pip-w {
  background-image: url("/api/scryfall-symbol.php?code=W");
}
.pip-u,
.mpip.pip-u {
  background-image: url("/api/scryfall-symbol.php?code=U");
}
.pip-b,
.mpip.pip-b {
  background-image: url("/api/scryfall-symbol.php?code=B");
}
.pip-r,
.mpip.pip-r {
  background-image: url("/api/scryfall-symbol.php?code=R");
}
.pip-g,
.mpip.pip-g {
  background-image: url("/api/scryfall-symbol.php?code=G");
}
.pip-c,
.mpip.pip-c {
  background-image: url("/api/scryfall-symbol.php?code=C");
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem;
  align-items: stretch;
}
.mtg-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-raised);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.mtg-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.65),
    0 0 20px rgba(201, 168, 76, 0.18);
}
.mtg-card img {
  width: 100%;
  display: block;
  border-radius: 10px 10px 0 0;
  aspect-ratio: 63/88;
  object-fit: cover;
}
.mtg-card-no-img {
  aspect-ratio: 63/88;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  padding: 0.75rem;
  text-align: center;
  font-family: var(--font-display);
}
.mtg-card-overlay {
  padding: 0.35rem 0.5rem 0.4rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}
.mtg-card-name {
  font-family: var(--font-display);
  font-size: 0.62rem;
  color: var(--gold-light);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mtg-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.25rem;
  margin-top: auto;
  padding-top: 0.1rem;
  min-height: 1rem;
}
.mtg-card-price {
  font-size: 0.65rem;
  color: var(--teal);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
}
.mtg-card-identity {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.1rem;
  min-height: 0.8rem;
  width: auto;
  min-width: fit-content;
  max-width: 100%;
  flex: 0 0 auto;
  white-space: nowrap;
}
.mtg-card-identity > span {
  flex-wrap: nowrap;
  white-space: nowrap;
}
.mtg-card-identity .mpip {
  width: 0.8rem;
  height: 0.8rem;
  flex: 0 0 0.8rem;
}
.mtg-card-identity-empty {
  display: inline-block;
  width: 4.4rem;
  height: 0.8rem;
}
.mtg-card-badge {
  position: absolute;
  top: 0.4rem;
  font-size: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
}
.badge-qty {
  left: 0.4rem;
  background: rgba(201, 168, 76, 0.85);
  color: #0c0e13;
}
.badge-foil {
  right: 0.4rem;
  background: rgba(61, 191, 168, 0.85);
  color: #0c0e13;
}

.owned-exact {
  box-shadow:
    0 0 0 2px rgba(61, 191, 168, 0.9),
    0 0 16px 2px rgba(61, 191, 168, 0.45);
}
.owned-other {
  box-shadow:
    0 0 0 2px rgba(201, 168, 76, 0.75),
    0 0 14px 2px rgba(201, 168, 76, 0.3);
}
[data-theme="light"] .owned-exact {
  box-shadow:
    0 0 0 2.5px rgba(20, 140, 120, 0.9),
    0 0 6px 1px rgba(20, 140, 120, 0.22);
}
[data-theme="light"] .owned-other {
  box-shadow:
    0 0 0 2.5px rgba(160, 110, 10, 0.85),
    0 0 6px 1px rgba(160, 110, 10, 0.18);
}
.wishlisted:not(.owned-exact):not(.owned-other) {
  box-shadow:
    0 0 0 2px rgba(162, 100, 235, 0.9),
    0 0 16px 2px rgba(162, 100, 235, 0.4);
}
[data-theme="light"] .wishlisted:not(.owned-exact):not(.owned-other) {
  box-shadow:
    0 0 0 2.5px rgba(110, 50, 185, 0.9),
    0 0 6px 1px rgba(110, 50, 185, 0.2);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 500px;
}
thead th {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-card);
}
tbody td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(37, 42, 58, 0.5);
  vertical-align: middle;
}
tbody tr:hover td {
  background: var(--bg-raised);
}
tbody tr:last-child td {
  border-bottom: none;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 20px;
  font-size: 0.65rem;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  font-weight: 600;
}
.badge-gold {
  background: rgba(201, 168, 76, 0.15);
  color: var(--gold);
  border: 1px solid var(--gold-dim);
}
.badge-teal {
  background: rgba(61, 191, 168, 0.12);
  color: var(--teal);
  border: 1px solid var(--teal-dim);
}
.badge-red {
  background: rgba(201, 76, 76, 0.12);
  color: var(--red);
  border: 1px solid rgba(201, 76, 76, 0.3);
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow);
}
.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo a {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--gold);
  letter-spacing: 0.08em;
}
.auth-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}
.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.auth-intro {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
  text-align: center;
}
.auth-action {
  margin-top: 0.5rem;
  min-height: 36px;
  font-size: 0.68rem;
  letter-spacing: 0.075em;
}
.notice-card {
  text-align: center;
  padding: 1.25rem 0;
}
.notice-icon {
  display: block;
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: 1;
  color: var(--gold);
  margin-bottom: 0.75rem;
}
.notice-title {
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 0.45rem;
}
.notice-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.content-shell {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}
.content-prose {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.75;
}
.content-prose h2 {
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 2rem 0 0.6rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  color: var(--text);
}
.content-prose p,
.content-prose li {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.75;
}
.content-prose ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}
.meta-text {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.glossary-page {
  max-width: 1100px;
}
.rules-page {
  max-width: 1040px;
}
.rules-page .glossary-heading h1,
.rules-page .glossary-section-heading h2,
.rules-page .glossary-intro-point h2 {
  font-family: var(--font-body);
  letter-spacing: 0.01em;
}
.rules-page .glossary-heading h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.08;
}
.rules-page .rules-overview {
  margin: -0.35rem 0 1.1rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.75;
}
.rules-page .rules-toc {
  width: 100%;
}
.rules-page .rules-toc-list {
  margin: 0.6rem 0 0;
  padding-left: 1.25rem;
}
.rules-page .rules-toc-list li {
  color: var(--text-muted);
  line-height: 1.8;
}
.rules-page .rules-toc-list li + li {
  margin-top: 0.2rem;
}
.rules-page .rules-toc-list a {
  color: var(--text);
  text-decoration-color: var(--gold-dim);
}
.rules-page .rules-toc-list a:hover {
  color: var(--gold);
}
.rules-page .rules-reference-link {
  margin-top: 0.2rem;
  font-size: 1rem;
  line-height: 1.7;
}
.rules-page .rules-figure {
  margin-top: 0.95rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
}
.rules-page .rules-figure img {
  width: 100%;
  min-width: 900px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}
.rules-page .rules-figure figcaption {
  margin-top: 0.55rem;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.55;
}
.rules-page .page-subtitle,
.rules-page .glossary-intro p,
.rules-page .glossary-section-heading p,
.rules-page .glossary-card p,
.rules-page .glossary-compare-card p,
.rules-page .glossary-compare-card li,
.rules-page .glossary-source-panel li {
  font-size: 1rem;
  line-height: 1.75;
}
.rules-page .glossary-section {
  margin-top: 1.5rem;
}
.rules-page .glossary-section-heading {
  margin-bottom: 1rem;
}
.rules-page .glossary-section-heading h2 {
  font-size: 1.35rem;
  margin-bottom: 0.3rem;
}
.glossary-header {
  margin-bottom: 1rem;
}
.glossary-heading h1 span {
  color: var(--gold);
}
.glossary-intro {
  margin-bottom: 1rem;
}
.glossary-intro p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}
.glossary-intro-points {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}
.glossary-intro-point {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
}
.rules-page .glossary-intro-point {
  background: linear-gradient(
    180deg,
    rgba(201, 168, 76, 0.07),
    rgba(201, 168, 76, 0.02)
  );
}
.glossary-intro-point h2 {
  font-size: 0.82rem;
  color: var(--gold);
  margin-bottom: 0.2rem;
}
.glossary-intro-point p {
  font-size: 0.9rem;
}
.glossary-section {
  margin-top: 1.2rem;
}
.glossary-section-heading {
  margin-bottom: 0.85rem;
}
.glossary-section-heading .badge {
  margin-bottom: 0.45rem;
}
.glossary-section-heading h2 {
  font-size: 1.12rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.glossary-section-heading p {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.glossary-grid,
.glossary-compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.glossary-card,
.glossary-compare-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.95rem;
  box-shadow: var(--shadow);
}
.rules-page .glossary-card,
.rules-page .glossary-compare-card {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}
.rules-page .glossary-grid-plain,
.rules-page .glossary-compare-grid-plain {
  display: block;
}
.rules-page .glossary-card-plain,
.rules-page .glossary-compare-card-plain {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0.9rem 0 1rem;
}
.rules-page .glossary-card-plain + .glossary-card-plain,
.rules-page .glossary-compare-card-plain + .glossary-compare-card-plain {
  border-top: 1px solid var(--border);
}
.rules-page .glossary-card-plain h3,
.rules-page .glossary-compare-card-plain h3 {
  color: var(--text);
}
.rules-page .glossary-card-plain p,
.rules-page .glossary-compare-card-plain p {
  max-width: none;
}
.rules-page .glossary-card-plain .glossary-card-example {
  border-top: 0;
  padding-top: 0.3rem;
}
.rules-page .glossary-card-plain .glossary-card-list,
.rules-page .glossary-compare-card-plain ul {
  max-width: none;
}
.glossary-card h3,
.glossary-compare-card h3 {
  font-size: 0.9rem;
  color: var(--gold);
  margin-bottom: 0.35rem;
}
.rules-page .glossary-card h3,
.rules-page .glossary-compare-card h3 {
  font-family: var(--font-body);
  font-size: 1.18rem;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.glossary-card p,
.glossary-compare-card p,
.glossary-compare-card li,
.glossary-source-panel li {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.7;
}
.glossary-card > p + p {
  margin-top: 0.65rem;
}
.glossary-card-example {
  padding-top: 0.65rem;
  border-top: 1px solid rgba(37, 42, 58, 0.7);
}
.glossary-card-example strong {
  color: var(--text);
}
.glossary-card-list {
  margin-top: 0.65rem;
  padding-left: 1.1rem;
}
.rules-page .glossary-card-list,
.rules-page .glossary-compare-card ul,
.rules-page .glossary-source-list {
  padding-left: 1.25rem;
}
.glossary-card-list li + li {
  margin-top: 0.35rem;
}
.rules-page .glossary-card-list li,
.rules-page .glossary-compare-card li {
  margin-bottom: 0.2rem;
}
.mana-symbol-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.65rem;
}
.mana-symbol-list li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.glossary-compare-summary {
  margin-bottom: 0.45rem;
}
.glossary-compare-card ul,
.glossary-source-list {
  padding-left: 1.1rem;
}
.glossary-source-panel {
  padding: 1rem;
}
.glossary-set-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.glossary-set-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.glossary-set-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.glossary-set-header h3 {
  font-size: 1rem;
  color: var(--text);
}
.glossary-source-note {
  margin-top: 0.1rem;
}
.glossary-source-list {
  margin-top: 0.6rem;
}
.glossary-source-list li + li {
  margin-top: 0.35rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(0.5rem, var(--safe-top)) 0.5rem
    calc(var(--bottom-ui-clearance) + 0.5rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  --modal-max-width: 100%;
  --modal-max-height: calc(
    100dvh - max(0.5rem, var(--safe-top)) -
      (var(--bottom-ui-clearance) + 0.5rem)
  );
  --modal-max-height-desktop: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.1rem 0.95rem;
  width: 100%;
  max-width: min(var(--modal-max-width), 100%);
  box-shadow: var(--shadow);
  transform: translateY(10px);
  transition: transform 0.2s;
  max-height: var(--modal-max-height);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-backdrop.open .modal {
  transform: translateY(0);
}
.modal-sm {
  --modal-max-width: 420px;
}
.modal-md {
  --modal-max-width: 620px;
}
.modal-card {
  --modal-max-width: 860px;
}
.modal-lg {
  --modal-max-width: 720px;
}
.modal-tall {
  --modal-max-height: 90vh;
  --modal-max-height-desktop: 90vh;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold);
}
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(40, 48, 68, 0.98) 0%,
    rgba(24, 30, 45, 0.98) 100%
  );
  color: var(--text-muted);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition:
    transform 0.18s,
    background 0.18s,
    border-color 0.18s,
    color 0.18s,
    box-shadow 0.18s;
}
.modal-close:hover {
  transform: translateY(-1px);
  background: linear-gradient(
    180deg,
    rgba(49, 58, 81, 0.98) 0%,
    rgba(31, 38, 56, 0.98) 100%
  );
  border-color: var(--border-glow);
  color: var(--text);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}
[data-theme="light"] .modal-close {
  background: linear-gradient(180deg, #fbf6ec 0%, #efe4d3 100%);
  border-color: rgba(138, 104, 32, 0.18);
  color: #4f3c1f;
  box-shadow: none;
}
[data-theme="light"] .modal-close:hover {
  background: linear-gradient(180deg, #fffaf1 0%, #f3e8d8 100%);
  border-color: rgba(122, 87, 25, 0.44);
  color: #3b2d18;
  box-shadow: none;
}
.modal-footer {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  padding-top: 0.5rem;
}
.tags-page-modal,
#tag-assign-modal {
  align-items: center;
  padding: 1rem;
}
#tag-assign-modal .modal {
  border-radius: var(--radius-lg);
}
.tags-page-modal-dialog {
  max-height: 92vh;
  padding: 0.65rem;
  position: relative;
  border-radius: var(--radius-lg);
}
.tags-page-modal-close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  z-index: 2;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tags-page-modal-body {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  background: var(--bg-card);
  max-height: calc(92vh - 20px);
  min-height: 0;
}
#tags-page-iframe {
  display: block;
  width: 100%;
  height: 68vh;
  min-height: 340px;
  border: none;
  background: var(--bg-card);
}

#toast-container {
  position: fixed;
  bottom: calc(var(--bottom-ui-clearance) + 0.75rem);
  right: 1rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: calc(100vw - 2rem);
}
.toast {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 0.65rem 1.1rem;
  font-size: 0.92rem;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  max-width: 300px;
}
.toast.success {
  border-left-color: var(--teal);
}
.toast.error {
  border-left-color: var(--red);
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
  color: var(--text-muted);
}
.empty-state h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  color: var(--text-dim);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 2rem auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1rem calc(var(--bottom-ui-clearance) + 0.75rem);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: auto;
}
footer a {
  color: var(--text);
  text-decoration-color: var(--gold-dim);
}
footer a:hover {
  color: var(--gold);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border-glow);
  border-radius: 3px;
}

.mobile-tabs {
  display: none;
  position: fixed;
  bottom: var(--tab-bottom-offset);
  left: 0.5rem;
  right: 0.5rem;
  z-index: 200;
  height: calc(var(--tab-h) + var(--safe-bottom));
  background: rgba(12, 14, 19, 0.97);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
[data-theme="light"] .mobile-tabs {
  background: rgba(245, 242, 235, 0.97);
}

.color-presets-row {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
}
.color-preset {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color .15s;
  flex-shrink: 0;
}

@media (max-width: 680px) {
  .menu-toggle {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    padding: 0;
    background: none;
    box-shadow: none;
    justify-content: center;
  }
  .menu-toggle-avatar {
    width: 1rem;
    height: 1rem;
    background: none;
    border: none;
    border-radius: 0;
    color: var(--text);
  }
  .menu-toggle-avatar .menu-toggle-icon {
    width: 1rem;
    height: 1rem;
  }
  .menu-toggle {
    width: 28px;
    height: 28px;
    min-height: unset;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 50%;
  }
  .menu-toggle-copy,
  .menu-toggle-chevron {
    display: none;
  }
  .nav-username,
  .nav-signout-btn {
    display: none;
  }
}

@media (min-width: 681px) {
  :root {
    --nav-control-h: 34px;
    --tab-h: 0px;
    --tab-bottom-offset: 0px;
    --bottom-ui-clearance: 0px;
  }

  body {
    font-size: 1.1rem;
    line-height: 1.65;
  }
  .container {
    padding: 0 1.5rem;
  }
  main {
    padding: 2rem 1.5rem 3rem;
  }

  .navbar-inner {
    height: var(--nav-h);
    min-height: var(--nav-h);
    padding: 0 1.5rem;
    gap: 1.5rem;
  }
  .nav-logo img {
    height: 48px;
  }
  .nav-links {
    display: flex;
  }
  .nav-actions {
    gap: 0.5rem;
    flex: 0 0 auto;
    margin-left: 0;
    flex-wrap: nowrap;
    row-gap: 0;
  }
  .mobile-top-links {
    display: none;
  }
  .nav-username,
  .nav-signout-btn {
    display: none;
  }
  .nav-currency-select {
    display: inline-block;
    height: var(--nav-control-h);
    min-width: 74px;
    padding: 0 1.85rem 0 0.72rem;
    font-size: 0.62rem;
    line-height: 1;
    background-position: right 0.68rem center;
  }
  .nav-currency-toggle {
    display: none;
  }
  .nav-actions .btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.63rem;
  }
  .nav-signout-btn {
    min-width: 48px;
  }
  .menu-toggle {
    display: inline-flex;
    height: var(--nav-control-h);
    max-width: min(260px, calc(100vw - 16rem));
    min-height: var(--nav-control-h);
    padding: 0.16rem 0.48rem 0.16rem 0.22rem;
    gap: 0.45rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: none;
    color: var(--text);
  }
  .menu-toggle:hover,
  .menu-toggle:focus-visible,
  .menu-toggle[aria-expanded="true"] {
    border-color: var(--border);
    background: var(--bg-raised);
    box-shadow: none;
  }
  .menu-toggle-avatar {
    width: 1.55rem;
    height: 1.55rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
  }
  .menu-toggle-icon {
    width: 0.95rem;
    height: 0.95rem;
  }
  .menu-toggle-copy {
    gap: 0.02rem;
  }
  .menu-toggle-copy strong {
    font-size: 0.82rem;
    color: var(--text);
  }
  .menu-toggle-copy span {
    font-size: 0.6rem;
    color: var(--text-dim);
  }
  .menu-toggle-chevron {
    width: 0.8rem;
    height: 0.8rem;
    color: var(--text-muted);
  }
  .menu-panel-shell {
    position: fixed;
    inset: 0;
    z-index: 220;
  }
  .menu-panel {
    top: calc(var(--safe-top) + 4.8rem);
  }

  .page-header {
    align-items: flex-end;
    gap: 1rem;
    flex-direction: row;
  }
  .page-header .btn {
    width: auto;
  }
  .cookie-banner__inner {
    padding: 1rem 1.15rem;
  }

  .stats-bar {
    gap: 0.75rem;
  }
  .stat-item {
    padding: 0.8rem 1.2rem;
    flex: 1 1 110px;
    min-width: 110px;
  }
  .stat-value {
    font-size: 1.5rem;
  }

  .search-row {
    gap: 0.6rem;
    flex-direction: row;
  }
  .search-wrap {
    min-width: 160px;
  }
  .filter-select {
    width: auto;
    min-width: 130px;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 1.1rem;
  }

  table {
    min-width: 600px;
    font-size: 0.95rem;
  }
  thead th,
  tbody td {
    padding: 0.65rem 0.9rem;
  }

  .panel {
    padding: 1.5rem;
  }

  .glossary-intro-points {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .glossary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
  }
  .glossary-compare-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
  }
  .glossary-set-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .modal-backdrop {
    align-items: center;
    padding: 1rem;
    overflow-y: visible;
  }
  .modal {
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    max-width: min(var(--modal-max-width), 95vw);
    max-height: var(--modal-max-height-desktop);
  }

  footer {
    padding: 1.25rem 1.5rem;
  }

  .mobile-tabs {
    display: none;
  }
}

@media (min-width: 901px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  .tags-page-modal-dialog {
    max-width: min(var(--modal-max-width), 95vw);
  }
  .glossary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ── Shared app page header (collection, wishlist, decks) ── */

#collection-page .page-header,
#wishlist-page .page-header {
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

#collection-page .page-header h1,
#wishlist-page .page-header h1 {
  font-size: 2rem;
  line-height: 1.04;
  letter-spacing: 0.03em;
}

#collection-page .page-subtitle,
#wishlist-page .page-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

@media (min-width: 681px) {
  #collection-page .page-header,
  #wishlist-page .page-header,
  #decks-page .page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.15rem;
    border-bottom: 1px solid var(--border);
    position: relative;
  }

  #collection-page .page-header::after,
  #wishlist-page .page-header::after,
  #decks-page .page-header::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 108px;
    height: 1px;
    background: linear-gradient(90deg, var(--gold), transparent);
  }

  #collection-page .collection-page-kicker,
  #collection-page .collection-filters-kicker,
  #wishlist-page .wishlist-page-kicker,
  #wishlist-page .wishlist-filters-kicker,
  #decks-page .decks-page-kicker {
    font-family: var(--font-display);
    font-size: 0.52rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 0.35rem;
  }

  #collection-page .collection-page-heading h1,
  #wishlist-page .wishlist-page-heading h1,
  #decks-page .decks-page-heading h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.05;
    letter-spacing: 0.06em;
  }

  #collection-page .page-subtitle,
  #wishlist-page .page-subtitle,
  #decks-page .page-subtitle {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
  }

  #collection-page .collection-header-add,
  #wishlist-page .wishlist-header-add,
  #decks-page .decks-header-create {
    min-height: 38px;
    padding: 0.5rem 1rem;
  }
}
