/* SpellGang: one visual language, with the cards at its centre.
   Loaded last in the private application and the public collection. */
:root {
  --sg-bg: #0d1615;
  --sg-panel: #14231f;
  --sg-raised: #1a2c26;
  --sg-border: #35473d;
  --sg-line: #78917c30;
  --sg-text: #eeeae0;
  --sg-muted: #a3b5a9;
  --sg-gold: #d0b578;
  --sg-radius: 12px;
}
body, body.shared-page {
  color: var(--sg-text);
  background: radial-gradient(ellipse at 65% 0, #355e4533, transparent 55%), var(--sg-bg);
  background-attachment: fixed;
}
[hidden] { display: none !important; }
::selection { background: #cbb37b55; color: #fff8e8; }
input, select, textarea, dialog input, dialog select, dialog textarea {
  font-family: Manrope, system-ui, sans-serif;
  color: var(--sg-text);
  background: #0d1b17;
  border: 1px solid var(--sg-border);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 12px;
}
input::placeholder, textarea::placeholder { color: #90a197; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--sg-gold); border-color: var(--sg-gold); }
input[type=checkbox] { accent-color: var(--sg-gold); }
textarea { resize: vertical; line-height: 1.6; }
.button, .primary {
  border-radius: 8px;
  font-size: 12px;
  min-height: 38px;
  line-height: 1.4;
  padding: 10px 14px;
  transition: background .15s, border-color .15s;
}
.button { background: #20332a; border-color: #536648; color: #e3e8dc; }
.button:hover { background: #2c4436; border-color: #9baf83; }
.primary { background: linear-gradient(125deg, #e2cb95, #c2a36a); border-color: #dbc38f; color: #20261c; }
.primary:hover { background: #e7d29c; }
.subtle { background: transparent; }
.eyebrow { color: var(--sg-gold); letter-spacing: 1.5px; font-size: 9px; }
.text-button { font-size: 11px; color: #c3cebd; }
#app .sidebar {
  width: 218px;
  padding: 26px 15px 18px;
  background: linear-gradient(165deg, #182c22, #101d18 50%, #0d1815);
  border-right: 1px solid #72845e38;
}
#app .sidebar .brand { font-size: 22px; letter-spacing: .2px; }
#app .brand small { font-size: 8px; letter-spacing: 2px; color: #a5b39e; }
#app .sidebar .nav-label { color: #9aaa94; font-size: 9px; margin: 34px 12px 13px; }
#app .sidebar .nav {
  min-height: 45px;
  border-radius: 8px;
  font-size: 12px;
  padding: 10px 11px;
  gap: 10px;
  color: #bac6bc;
}
#app .sidebar .nav:hover { background: #294033; }
#app .sidebar .nav.active { background: linear-gradient(90deg, #3b4c32, #253a2d); border-color: #9c946b55; color: #f2e5be; box-shadow: inset 3px 0 var(--sg-gold); }
#app .sidebar .nav>span { color: #9eb89d; }
#app .sidebar .nav.active>span { color: #e2c689; }
#app .user { gap: 10px; padding-top: 16px; }
#app .user strong { font-size: 12px; overflow-wrap: anywhere; }
#app .user small { color: #a4b29f; font-size: 10px; }
#app .avatar { background: #314631; color: #e8d6a7; }
#app main { margin-left: 218px; padding: 0 28px; max-width: 1820px; }
#app .topbar { height: 58px; margin-bottom: 8px; border-bottom: 1px solid var(--sg-line); }
#app .topbar>span { font-size: 11px; }
#app .topbar>div { gap: 8px; }
body:is([data-view=decks], [data-view=editions], [data-view=admin], [data-view=community]) .topbar>div { display: none; }
#app .hero { height: 88px; border-color: var(--sg-border); border-radius: var(--sg-radius); }
#app .hero-copy { padding: 16px 20px; }
#app .hero h1 { font-size: 27px; margin: 5px 0 0; letter-spacing: -.5px; }
#app .hero h1 br { display: none; }
#app .hero h1 em { margin-left: 8px; }
#app .hero p, #app .hero-edition { display: none; }
#app .hero .eyebrow { font-size: 8px; }
#app .hero .primary { position: absolute; right: 20px; top: 24px; padding: 9px 12px; font-size: 11px; }
#app .stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 12px 0 18px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
  overflow: hidden;
  background: #18281fcc;
}
#app .stats>article { border: 0; border-right: 1px solid var(--sg-line); border-radius: 0; background: transparent; padding: 12px 15px; gap: 12px; }
#app .stats>article:nth-child(4) { border-right: 0; }
#app .stat-icon { background: transparent; width: 24px; height: 30px; font-size: 24px; color: #9bac8d; }
#app .stats small { font-size: 10px; margin-bottom: 4px; color: var(--sg-muted); }
#app .stats strong { font-size: 23px; color: #e3e5d8; }
#app .stats article div>span { font-size: 10px; color: #9eae98; }
#app .stats>.collection-value { grid-column: 1 / -1; border: 0; border-top: 1px solid var(--sg-line); border-radius: 0; margin: 0; }
.collection-tabs, .profile-tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  margin: 0 0 16px;
  background: #14221c;
  border: 1px solid var(--sg-border);
  border-radius: 10px;
}
.collection-tabs button, .profile-tabs .button { padding: 9px 14px; border-radius: 6px; font-size: 12px; color: #b9c5b6; background: transparent; border: 0; min-height: 36px; }
.collection-tabs button.active, .profile-tabs .selected { background: #374a32; color: #f2e4b9; box-shadow: 0 2px 6px #0003; }
#app .section-title { margin-bottom: 12px; }
#app .section-title .eyebrow { display: none; }
#app .section-title h2 { font-size: 23px; margin: 0; }
#app .filters { gap: 8px; }
#app .filters input, #app .filters select { font-size: 12px; background: #112019; border-color: var(--sg-border); }
#app .filters .search { flex-basis: auto; }
#app .filters>select { max-width: 210px; }
#app .filter-bottom { margin: 0 0 16px; padding: 12px 0; border-color: var(--sg-line); }
#app .colors button { width: 28px; height: 28px; font-size: 16px; }
#app .colors button:first-of-type { width: auto; font-size: 10px; }
#app .colors>span { font-size: 8px; }
#app .trade-check { font-size: 11px; }
/* Keep artwork large even on a wide screen; no six-column thumbnail wall. */
#app .cards, .shared-page .cards, #community-content.card-market {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px 18px;
}
.card {
  background: linear-gradient(150deg, #213428, #13231c);
  border: 1px solid #52674766;
  border-radius: 12px;
  padding: 7px;
  box-shadow: 0 6px 18px #0002;
}
.card:hover { transform: translateY(-3px); border-color: #b7a46b; box-shadow: 0 12px 28px #0007; }
#app .card-picture, .card-picture { border-radius: 8px; }
#app .card-open h3, .card h3 { font-size: 12px; line-height: 1.5; margin: 11px 4px 6px; }
#app .card-meta, .card-meta { font-size: 10px; margin: 0 4px 5px; color: #a8baa0; }
#app .card-badge, .card-badge { font-size: 11px; padding: 5px 8px; }
#app .trade-badge, .trade-badge { font-size: 10px; }
.card-price-line { margin: 7px 4px 3px; gap: 3px; color: #a4b49e; }
.card-price-line small { font-size: 10px; }
/* Page headings and reusable containers. */
#app .deck-intro, #community-section .deck-intro { padding: 10px 0 20px; align-items: center; gap: 16px; }
#app .deck-intro h1, #community-section .deck-intro h1 { font-size: 32px; margin: 8px 0; }
#app .deck-intro p { font-size: 12px; color: var(--sg-muted); }
#app .deck-intro .eyebrow { font-size: 9px; }
#app .deck-tile, #app .deck-composition, #app .deck-pool, .edition-card, .offer-tile, .admin-user {
  background: linear-gradient(145deg, #203328, #15241d);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
}
#app .deck-list { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; }
#app .deck-banner { height: 185px; }
#app .deck-tile-body { padding: 18px; }
#app .deck-tile h2 { font-size: 21px; }
#app .deck-toolbar { background: #101e19f2; border-color: var(--sg-line); }
#app .deck-workspace { grid-template-columns: 1.15fr 1fr; gap: 20px; }
#app .deck-composition, #app .deck-pool { padding: 18px; }
#app .deck-card-row { gap: 12px; padding: 10px 0; }
#app .deck-thumb { width: 76px; min-width: 76px; height: auto; padding: 0; background: transparent; }
#app .deck-thumb img { width: 100%; height: auto; display: block; border-radius: 5px; }
#app .deck-row-title strong, #app .pool-title strong { font-size: 12px; }
#app .deck-row-title small, #app .pool-title small { font-size: 10px; line-height: 1.5; }
#app .pool-card { gap: 12px; padding: 10px 0; }
#app .pool-card>img { width: 76px; height: auto; border-radius: 5px; }
#app .deck-type-heading { font-size: 11px; color: #d6c591; }
#app .deck-step { flex-shrink: 0; }
#app .deck-analysis { padding: 14px 18px; background: #18281f; }
#app #deck-validation { font-size: 11px; }
.format-help, .deck-statistics-toggle { background: #17271f; border-color: var(--sg-border); border-radius: 10px; }
.format-help>summary, .deck-statistics-toggle>summary { font-size: 12px; padding: 12px 16px; }
#deck-statistics.illustrated-stats { background: transparent; }
.illustrated-stats .deck-stat-note, .deck-stats-method { font-size: 10px; }
.edition-grid { gap: 18px; }
.edition-card { padding: 22px; }
.edition-card h3 { font-size: 22px; }
/* Market cards use the same portrait scale as the collection. */
.exchange-toolbar .collection-tabs { flex: initial; }
.exchange-toolbar>input { flex: 1; max-width: none; min-width: 180px; }
.market-filters { margin: 12px 0; gap: 16px; }
.exchange-hint { margin: 10px 0 16px; font-size: 11px; color: #a3b29d; }
.market-card { display: flex; flex-direction: column; gap: 0; padding: 7px; border-radius: 12px; border-color: #52674766; background: linear-gradient(150deg,#213428,#13231c); min-width: 0; }
.market-card>img { width: 100%; aspect-ratio: 488 / 680; align-self: stretch; border-radius: 8px; }
.market-card-info { padding: 11px 7px 7px; width: 100%; }
.market-card h3 { font: 600 13px/1.5 Manrope, sans-serif; margin: 6px 0; }
.market-card small { font-size: 10px; }
.market-card .eyebrow { font-size: 9px; }
.market-tags { margin: 9px 0; }
.market-tags span { background: #34472b; color: #dfd9b6; }
.market-owner strong { font-size: 12px; overflow-wrap: anywhere; }
.market-card .exchange-actions { gap: 6px; margin-top: 10px; }
.market-card .exchange-actions button { font-size: 11px; padding: 8px 10px; flex: 1 1 auto; }
.exchange-card img { width: 78px; height: auto; aspect-ratio: 488/680; border-radius: 5px; }
.exchange-card { background: #14251c; border-color: var(--sg-border); }
.exchange-card small { font-size: 10px; }
.offer-tile { padding: 20px; }
/* Consistent, comfortable dialogs. Large art, separate edit fields. */
dialog { background: radial-gradient(ellipse at top left,#34533b33,transparent 65%), #15241d; border-color: #81916a88 !important; border-radius: 16px; box-shadow: 0 28px 110px #000b; padding: 28px; max-height: 92dvh; }
dialog::backdrop { background: #030b09cc; backdrop-filter: blur(7px); }
dialog h2 { color: #e6d2a2; font-size: 27px; line-height: 1.3; }
dialog .eyebrow { display: block; padding-right: 28px; }
dialog label { font-size: 12px; color: #bdcbb8; }
dialog>p, dialog small { line-height: 1.7; }
.close { background: #344537; border: 1px solid #71836166; width: 32px; height: 32px; line-height: 26px; }
.small-dialog { max-width: 490px; }
#card-dialog, .shared-page #shared-dialog { max-width: 1100px; }
.card-detail { grid-template-columns: minmax(300px, .95fr) minmax(0,1fr); gap: 30px; }
.detail-visual { align-self: start; position: sticky; top: 0; }
.detail-visual img, .shared-page #shared-image { width: 100%; max-height: 78dvh; object-fit: contain; border-radius: 12px; }
.detail-info { min-width: 0; padding-top: 8px; }
.detail-info h2 { font-size: 27px; overflow-wrap: anywhere; margin: 12px 0; }
.ownership { background: #1b3021; border-color: #526b45; padding: 16px; margin: 18px 0; }
.card-wanted-panel { background: #29351f; border-color: #7b805455; }
.finish-row { background: #17291e; border-color: #506443; }
.foil-row { background: linear-gradient(110deg,#25392c,#303247,#413426); }
.finish-head, .finish-row { grid-template-columns: minmax(60px,1fr) 132px 132px; }
.finish-stepper input { padding: 8px 3px; }
.price-table { font-size: 12px; }
.price-extra { font-size: 11px; color: #a7b59f; }
/* Shared profiles have the same card scale and understated chrome. */
.shared-main { max-width: 1460px; padding: 24px 32px; }
.shared-brand { padding-bottom: 18px; border-color: var(--sg-line); }
.shared-intro { padding: 24px 0 18px; }
.shared-intro h1 { font-size: 36px; margin: 8px 0; }
.shared-intro p { font-size: 12px; margin-bottom: 14px; }
.shared-counts { gap: 8px; }
.shared-counts span { background: #1e3023; border-color: var(--sg-border); padding: 7px 11px; font-size: 11px; }
.shared-intro .collection-value { margin: 12px 0 0; }
.shared-toolbar { margin: 12px 0; padding: 12px; background: #17261e; border-color: var(--sg-border); }
.shared-result { font-size: 11px; }
.shared-page footer { border-color: var(--sg-line); }
/* Messaging and management belong to the same tavern. */
#chat-launcher { background: #243e2d; color: #e9d9ad; border-color: #9b9c64; padding: 12px 18px; }
#chat-dock { background: #12221a; border-color: #7c8c62; box-shadow: 0 20px 65px #000a; }
#chat-dock>header { background: linear-gradient(110deg,#354b31,#1c3224); }
#chat-status { font-size: 10px; }
.chat-bubble { background: #293e32; }
.chat-bubble.mine { background: #3e5732; }
.chat-bubble time { font-size: 9px; }
.admin-summary>article { background: #1b2f22; border-color: var(--sg-border); }
.admin-activity { border-color: var(--sg-border); background: #14241c; border-radius: 12px; }
.admin-user .button, .admin-user small { font-size: 11px; }
.login-art { background: radial-gradient(ellipse at 25% 35%,#56754244,transparent 65%),repeating-linear-gradient(45deg,transparent,transparent 80px,#d2b77a08 81px,transparent 82px),#14271d; }
.login-art:after { color: #bfce8b0c; }
.login-form { background: radial-gradient(ellipse at top right,#5b543122,transparent 70%); }
.login-form h2 { color: #e4d1a7; }
.login-note { margin-top: 34px; }
.login-form small { color: #a2b39a; }
/* Game piece dimensions and transforms intentionally remain in their own stylesheets. */
#table-screen, #mp-screen { background: radial-gradient(ellipse at center,#284331,#0d1b15 75%); }
.table-top, .mp-top { background: #101e18; border-color: #5a714f66; }
.table-mat, .mp-board { border-color: #71876144; }
.table-tools-dialog { background: #15241d; }
#mp-zone-list { grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); }
@media(min-width:1800px) {
  #app .cards, .shared-page .cards, #community-content.card-market { grid-template-columns: repeat(5,minmax(0,1fr)); }
}
@media(min-width:761px) and (max-width:1150px) {
  #app .sidebar { width: 190px; padding: 22px 10px; }
  #app .sidebar .brand { font-size: 20px; }
  #app main { margin-left: 190px; padding: 0 20px; }
  #app .cards, .shared-page .cards, #community-content.card-market { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px 14px; }
  #app .stats>article { padding: 12px 9px; }
  #app .stat-icon { display: none; }
  #app .stats article div>span { display: block; margin: 4px 0 0; }
  #app .hero .primary { display: none; }
  #app .filters .search { flex-basis: 100%; }
  #app .filters>select { flex: 1; max-width: none; }
  #app .deck-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #app .deck-workspace { grid-template-columns: 1fr; }
  #app .deck-pool { position: static; }
  #app .sidebar .user>span:not(.avatar) { display: block; }
  #app .sidebar .nav-label { display: block; }
  #app .sidebar .nav { justify-content: flex-start; }
  #app .sidebar .sigil { font-size: 30px; }
}
@media(max-width:900px) {
  .card-detail { grid-template-columns: minmax(230px,.85fr) minmax(0,1fr); gap: 20px; }
  .finish-head, .finish-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .finish-head>span:first-child { display: none; }
  .finish-row>strong { grid-column: 1/-1; }
}
@media(max-width:760px) {
  #app .sidebar { position: relative; width: 100%; inset: auto; padding: 12px 12px 8px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; border-right: 0; border-bottom: 1px solid var(--sg-border); }
  #app .sidebar .brand { font-size: 20px; letter-spacing: 0; white-space: nowrap; }
  #app .sidebar .brand .sigil { font-size: 26px; margin-right: 4px; }
  #app .sidebar .brand small, #app .sidebar>.nav-label, #app .sidebar .play-label { display: none; }
  #app .sidebar nav, #app .sidebar nav.without-tables { display: flex; grid-column: 1/-1; grid-row: 2; width: 100%; gap: 5px; overflow-x: auto; scrollbar-width: thin; padding: 2px 0 4px; margin: 0; }
  #app .sidebar nav .nav { flex: 0 0 auto; width: auto; min-height: 39px; flex-direction: row; padding: 8px 10px; gap: 6px; font-size: 11px; white-space: nowrap; }
  #app .sidebar nav .nav>span { font-size: 17px; }
  #app .sidebar .side-bottom { grid-column: 2; grid-row: 1; display: flex; gap: 7px; margin: 0; padding: 0; align-items: center; }
  #app .sidebar #users-open { font-size: 0; min-height: 30px; padding: 4px; width: 26px; }
  #app .sidebar #users-open>span { font-size: 20px; }
  #app .user { width: auto; padding: 0; border: 0; }
  #app .user>span:not(.avatar) { display: none; }
  #app .avatar { width: 29px; height: 29px; }
  #app .discord-link { margin: 0; padding: 9px 10px; font-size: 11px; white-space: nowrap; }
  #app main { margin-left: 0; padding: 0 14px; }
  #app .topbar { height: 48px; margin-bottom: 8px; gap: 8px; }
  #app .topbar>span { font-size: 10px; }
  #app .topbar i { margin: 0 7px; }
  #app .topbar .button { min-height: 32px; padding: 7px 9px; font-size: 10px; }
  #app .hero { height: 74px; }
  #app .hero-copy { padding: 13px 15px; }
  #app .hero h1 { font-size: 21px; margin-top: 6px; }
  #app .hero h1 br { display: none; }
  #app .hero h1 em { margin-left: 5px; }
  #app .hero .eyebrow { font-size: 7px; }
  #app .hero .primary { display: none; }
  #app .stats { grid-template-columns: repeat(2,minmax(0,1fr)); margin: 10px 0 14px; gap: 0; }
  #app .stats>article { padding: 9px 12px; min-height: 58px; border-bottom: 1px solid var(--sg-line); }
  #app .stats>article:nth-child(2) { border-right: 0; }
  #app .stats>article:nth-child(3), #app .stats>article:nth-child(4) { border-bottom: 0; }
  #app .stat-icon { display: none; }
  #app .stats small { font-size: 9px; min-height: 0; margin-bottom: 3px; }
  #app .stats strong { font-size: 20px; }
  #app .stats article div>span { display: none; }
  #app .collection-tabs { width: 100%; margin-bottom: 14px; }
  .collection-tabs button, .profile-tabs .button { font-size: 11px; padding: 8px 7px; flex: 1; }
  #app .section-title h2 { font-size: 20px; }
  #app .sort-label { font-size: 0; }
  #app .sort-label select { max-width: 135px; font-size: 10px; }
  #app .filters { flex-wrap: wrap; }
  #app .filters .search { flex-basis: 100%; }
  #app .filters input { font-size: 12px; }
  #app .filters>select { flex: 1; width: 0; max-width: none; padding: 10px 6px; font-size: 10px; }
  #app .colors { width: 100%; gap: 8px; }
  #app .colors>span { display: none; }
  #app .filter-bottom { margin-bottom: 14px; gap: 10px; }
  #app .cards, .shared-page .cards, #community-content.card-market { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 10px; }
  #app .card, .card { padding: 4px; border-radius: 10px; }
  #app .card-open h3, .card h3 { font-size: 11px; margin: 8px 3px 5px; }
  #app .card-meta, .card-meta { font-size: 9px; flex-wrap: wrap; gap: 4px; margin: 0 3px 5px; }
  #app .card-badge, .card-badge { font-size: 10px; }
  #app .trade-badge, .trade-badge { font-size: 9px; }
  .card-price-line small { font-size: 9px; line-height: 1.4; }
  #app .deck-intro { align-items: flex-start; }
  #app .deck-intro h1, #community-section .deck-intro h1 { font-size: 28px; }
  #app .deck-intro p { font-size: 11px; }
  #app .deck-intro .eyebrow { font-size: 8px; }
  #app .deck-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  #app .deck-banner { height: 145px; }
  #app .deck-tile-body { padding: 12px; }
  #app .deck-tile h2 { font-size: 17px; overflow-wrap: anywhere; }
  #app .deck-tile-count { flex-wrap: wrap; gap: 6px; }
  #app .deck-workspace { grid-template-columns: 1fr; }
  #app .deck-composition, #app .deck-pool { padding: 14px; }
  #app .deck-pool { position: static; }
  #app .deck-thumb, #app .pool-card>img { width: 72px; min-width: 72px; }
  #app .deck-row-title strong, #app .pool-title strong { font-size: 11px; }
  #app .deck-card-row { gap: 10px; }
  #app .deck-row-title small, #app .pool-title small { font-size: 9px; }
  #app .deck-step { flex-direction: column-reverse; gap: 2px; }
  #app .deck-step button { width: 27px; height: 27px; }
  #app .edition-grid { grid-template-columns: 1fr; }
  .edition-card { padding: 20px; }
  .exchange-toolbar .collection-tabs { flex-wrap: wrap; }
  .exchange-toolbar .collection-tabs button { flex: 1 1 40%; }
  .exchange-toolbar>input { width: 100%; }
  .market-filters { flex-wrap: wrap; gap: 10px; }
  .market-card { padding: 4px; }
  .market-card>img { width: 100%; }
  .market-card-info { padding: 8px 4px 5px; }
  .market-card h3 { font-size: 11px; }
  .market-card .eyebrow, .market-card small { font-size: 9px; }
  .market-card .exchange-actions button { font-size: 10px; padding: 7px 5px; }
  .market-owner strong { font-size: 11px; }
  .market-tags span { font-size: 9px; }
  .exchange-card img { width: 68px; }
  .exchange-card { gap: 9px; padding: 8px; }
  .exchange-card strong { font-size: 11px; }
  .exchange-card>input { width: 54px; }
  .offer-columns { grid-template-columns: 1fr; }
  dialog { width: calc(100% - 20px); max-width: calc(100vw - 20px); padding: 23px 16px; border-radius: 14px; }
  dialog h2 { font-size: 25px; }
  .card-detail, .shared-page .card-detail { grid-template-columns: 1fr; gap: 22px; }
  .detail-visual { position: static; }
  .detail-visual img, .shared-page #shared-image { max-height: 72dvh; width: min(100%,420px); }
  .detail-info h2 { font-size: 26px; }
  .ownership { padding: 12px; }
  .finish-stepper button { min-height: 38px; }
  .shared-main { padding: 18px 14px; }
  .shared-brand { gap: 12px; }
  .shared-brand .brand { font-size: 20px; letter-spacing: 0; }
  .shared-readonly { font-size: 8px; letter-spacing: 1px; }
  .shared-intro { padding: 22px 0 18px; }
  .shared-intro h1 { font-size: 29px; }
  .shared-toolbar { padding: 10px; gap: 8px; }
  .shared-toolbar input[type=search] { width: 100%; flex-basis: 100%; }
  .shared-toolbar select { width: calc(50% - 4px); max-width: none; flex: 1; font-size: 10px; }
  .shared-toolbar .trade-check { width: 100%; font-size: 11px; }
  .login-art { min-height: 300px; padding: 26px; }
  .login-art .brand { font-size: 22px; }
  .login-story { margin: 28px 0 14px; }
  .login-story h1 { font-size: 30px; margin: 16px 0; }
  .login-story p, .login-art .credit { display: none; }
  .mana-orbit { margin-top: 20px; }
  .login-form { padding: 30px 24px; }
  .login-note { margin-top: 25px; }
  #chat-launcher { padding: 11px 14px; }
  #mp-zone-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:370px) {
  #app .sidebar .brand { font-size: 17px; }
  #app .sidebar .brand .sigil { font-size: 23px; margin-right: 1px; }
  #app .sidebar .side-bottom { gap: 4px; }
  #app .discord-link { padding: 8px; font-size: 10px; }
  #app main { padding: 0 10px; }
  #app .hero h1 { font-size: 19px; }
  #app .deck-list { grid-template-columns: 1fr; }
  .finish-stepper button { flex-basis: 26px; }
}
@media(prefers-reduced-motion:reduce) {
  .card, .button, .primary { transition: none; }
  .card:hover { transform: none; }
}
/* Filters stay nearby, but do not take the stage from the collection. */
#app .hero { display: none; }
#app .stats>.collection-value { padding: 0 15px; }
.collection-filter-bar { display: grid; gap: 10px; }
.collection-filter-bar>.search { width: 100%; }
.collection-filter-bar>.search input { width: 100%; background: #112019; border-color: var(--sg-border); font-size: 12px; }
.collection-filter-options>summary { display: none; cursor: pointer; padding: 10px 12px; border: 1px solid var(--sg-border); border-radius: 8px; color: #d8ddce; background: #20332a; font-size: 12px; list-style: none; }
.collection-filter-options>summary::-webkit-details-marker { display: none; }
.collection-filter-options>summary>span:last-child { margin-left: 8px; }
#app .filters>select { flex: 1; max-width: none; }
#app .filter-bottom { flex-wrap: wrap; }
#app #clear { margin-left: auto; max-width: none; white-space: nowrap; }
#app #deck-pool-cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 10px; padding-right: 7px; max-height: 670px; }
#app .pool-card { display: grid; grid-template-columns: minmax(0,1fr) auto; align-content: start; gap: 8px; padding: 5px; background: #14271c; border: 1px solid #53674755; border-radius: 9px; }
#app .pool-card>img { grid-column: 1/-1; width: 100%; min-width: 0; aspect-ratio: 488/680; border-radius: 6px; }
#app .pool-card .pool-add { width: 30px; height: 34px; align-self: end; }
#app .pool-title strong { font-size: 11px; }
#app .pool-title small { font-size: 9px; }
@media(min-width:761px) {
  .collection-filter-bar { grid-template-columns: minmax(200px,1fr) minmax(0,1.3fr); position: relative; padding-bottom: 55px; margin-bottom: 16px; }
  .collection-filter-options .filter-bottom { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 !important; }
  #app .collection-filter-bar .filters>select { min-width: 0; width: 0; }
}
@media(max-width:760px) {
  #app .stats { grid-template-columns: repeat(4,minmax(0,1fr)); }
  #app .stats>article { min-height: 72px; padding: 9px 8px; border-bottom: 0; }
  #app .stats>article:nth-child(2) { border-right: 1px solid var(--sg-line); }
  #app .stats small { font-size: 8px; line-height: 1.4; min-height: 24px; }
  #app .stats strong { font-size: 20px; }
  #app .stats>.collection-value { padding: 0 9px; }
  .collection-filter-bar { display: block; position: relative; margin-bottom: 16px; }
  .collection-filter-bar>.search { width: calc(100% - 94px); }
  .collection-filter-options { display: block; }
  .collection-filter-options>summary { position: absolute; right: 0; top: 0; display: flex; align-items: center; justify-content: center; gap: 3px; width: 84px; height: 42px; }
  .collection-filter-options[open]>summary { border-color: #bcaa75; color: #ead5a1; }
  .collection-filter-options>.collection-filter-body { margin-top: 10px; width: 100%; padding: 12px 10px 0; border: 1px solid var(--sg-border); border-radius: 9px; background: #14251c; }
  .collection-filter-options:not([open])>.collection-filter-body { display: none; }
  #app .filter-bottom { gap: 12px 8px; border: 0; margin-bottom: 0; }
  #app .colors { flex-wrap: wrap; width: 100%; min-width: 0; gap: 6px; }
  #app .trade-check { font-size: 10px; }
  #app #clear { font-size: 10px; }
  #app .deck-pool { order: -1; }
}
@media(max-width:760px) {
  #app .deck-list { grid-template-columns: 1fr; }
  #app .deck-banner { height: 180px; }
  #app .deck-tile h2 { font-size: 21px; }
  #app .deck-tile-body { padding: 16px; }
}
/* Browser-native macOS/Safari controls must not introduce silver gradients. */
:root { color-scheme: dark; }
#app select, #app .filters select, #app .sort-label select, #app .deck-fields select, #app .pool-filters select, dialog select, .shared-page select, select {
  -webkit-appearance: none;
  appearance: none;
  background-color: #14251c;
  background-image: url('/static/select-chevron.svg?v=f0124108fa7b2489');
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px;
  padding-right: 34px;
  border: 1px solid #41583f;
  border-radius: 8px;
  color: #e2e6d8;
  box-shadow: inset 0 1px #c0d3a608;
  cursor: pointer;
}
select option, select optgroup { background: #17271f; color: #e2e6d8; }
#app select:hover, dialog select:hover, .shared-page select:hover { border-color: #85966c; }
#app select:focus-visible, dialog select:focus-visible, .shared-page select:focus-visible { border-color: #d4bc82; outline: 2px solid #d4bc8244; outline-offset: 2px; }
input[type=checkbox] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  margin: 0;
  border: 1px solid #718361;
  border-radius: 5px;
  background: #14251c;
  cursor: pointer;
  vertical-align: middle;
}
input[type=checkbox]:checked { background: #c6b27b; border-color: #dac48d; }
input[type=checkbox]:checked::after { content: ''; position: absolute; left: 5px; top: 2px; width: 5px; height: 9px; border: solid #1b2d1d; border-width: 0 2px 2px 0; transform: rotate(45deg); }
input[type=checkbox]:focus-visible { outline: 2px solid #e3ce95; outline-offset: 3px; }
label.trade-check, #app label.trade-check {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid #4b6143;
  border-radius: 8px;
  background: #192d20;
  color: #bfccb5;
  font-size: 11px;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
label.trade-check:hover { border-color: #a1ad7b; }
label.trade-check:has(input:checked), #app label.trade-check:has(input:checked) { border-color: #af9f68; color: #f1dfac; background: #34462a; }
label.trade-check:focus-within { outline: 2px solid #b6aa7444; outline-offset: 2px; }
label.trade-check input[type=checkbox] {
  flex: 0 0 30px;
  width: 30px;
  height: 18px;
  min-width: 30px;
  padding: 0;
  margin: 0;
  border: 1px solid #728466;
  border-radius: 20px;
  background: #344a36;
  box-shadow: none;
}
label.trade-check input[type=checkbox]::after { content: ''; position: absolute; width: 10px; height: 10px; top: 3px; left: 3px; border: 0; border-radius: 50%; background: #bec9ac; transform: none; transition: transform .15s, background .15s; }
label.trade-check input[type=checkbox]:checked { background: #cdb67d; border-color: #e1cd96; }
label.trade-check input[type=checkbox]:checked::after { transform: translateX(12px); background: #243921; }
@media(max-width:760px) {
  #app .collection-filter-body .filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  #app .collection-filter-body .filters>select { width: 100%; max-width: none; padding: 10px 30px 10px 9px; font-size: 11px; }
  #app .collection-filter-body .filters>select:first-child { grid-column: 1/-1; }
  #app .sort-label select { padding-right: 28px; }
  #app label.trade-check { font-size: 10px; padding: 8px 9px; }
}
@media(prefers-reduced-motion:reduce) {
  label.trade-check, label.trade-check input[type=checkbox]::after { transition: none; }
}

@media(min-width:761px) and (max-width:960px) {
  #app .cards, #community-content.card-market { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(min-width:761px) and (max-width:1150px) {
  .collection-filter-bar { grid-template-columns: 1fr; padding-bottom: 0; }
  #app .collection-filter-options .filter-bottom { position: static; }
}
#deck-hover-preview {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  border-radius: 16px;
  background: #0c1611;
  box-shadow: 0 20px 65px #000c, 0 0 0 1px #d6bd7c88;
  animation: deck-preview-in .14s ease-out;
}
#deck-hover-preview img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
#app .deck-thumb { cursor: zoom-in; }
@keyframes deck-preview-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
@media(prefers-reduced-motion:reduce) { #deck-hover-preview { animation: none; } }

/* Public profile: three mutually exclusive card filters, in one segmented bar. */
.shared-page .profile-tabs { display: inline-grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: min(100%,510px); gap: 4px; }
.shared-page .profile-tabs .button { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 42px; padding: 9px 10px; line-height: 1.35; }
.profile-tab-count { padding: 2px 5px; border-radius: 5px; font-size: 10px; color: #aebe9f; background: #0c191466; }
.selected .profile-tab-count { color: #ead8a2; background: #18261a80; }
@media(max-width:600px) {
 .shared-page .profile-tabs { width: 100%; gap: 2px; padding: 3px; }
 .shared-page .profile-tabs .button { gap: 4px; padding: 8px 5px; font-size: 10px; min-height: 44px; }
 .profile-tab-count { flex-shrink: 0; padding: 2px 4px; font-size: 9px; }
}
.collection-navigation { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
#app .personal-collection-tabs { display: inline-grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: min(100%,510px); margin: 0; gap: 4px; }
#app .personal-collection-tabs button { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 12px; min-width: 0; min-height: 42px; line-height: 1.35; }
.personal-collection-tabs .active .profile-tab-count { color: #ead8a2; background: #18261a80; }
.collection-catalog { position: relative; flex-shrink: 0; }
.collection-catalog summary { cursor: pointer; list-style: none; padding: 13px 12px; color: #b1c0a9; font-size: 11px; border: 1px solid var(--sg-border); border-radius: 9px; background: #15271e; }
.collection-catalog summary::-webkit-details-marker { display: none; }
.collection-catalog>div { position: absolute; right: 0; top: calc(100% + 6px); z-index: 6; width: 210px; padding: 6px; background: #182b21; border: 1px solid #6b7f56; border-radius: 9px; box-shadow: 0 12px 30px #0009; }
.collection-catalog button { display: block; width: 100%; text-align: left; padding: 12px; border-radius: 6px; font-size: 12px; color: #d1dbc7; background: transparent; }
.collection-catalog button:hover, .collection-catalog button.active { color: #efdbab; background: #37492f; }
.collection-wanted-info { display: grid; gap: 5px; margin: 10px 3px 3px; padding-top: 9px; border-top: 1px solid #8c9d6733; }
.collection-wanted-info span { font-size: 10px; color: #e2d09c; line-height: 1.6; }
.card-catalog-note { margin: 18px 0; padding: 12px; border: 1px solid #7e85564d; border-radius: 8px; background: #2d3923; color: #d2d5b9; font-size: 12px; line-height: 1.7; }
body:is([data-view=wanted],[data-view=trade]) #collection-value { display: none; }
@media(max-width:760px) {
 .collection-navigation { flex-wrap: wrap; gap: 8px; }
 #app .personal-collection-tabs { width: 100%; gap: 2px; padding: 3px; }
 #app .personal-collection-tabs button { gap: 4px; padding: 8px 5px; min-height: 44px; font-size: 10px; }
 .collection-catalog { margin-left: auto; }
 .collection-catalog summary { font-size: 10px; padding: 8px 10px; }
}
@media(max-width:760px) {
 #app .library>.section-title { align-items: center; }
 #app .library>.section-title>div { flex: 1; min-width: 0; }
 #app .library>.section-title h2 { white-space: normal; line-height: 1.35; }
 #app .library>.section-title .sort-label { flex-shrink: 0; }
}
