:root {
  --primary-color: #333;
  --bg-color: #f4f4f9;
  --card-bg: #fff;
  --darkness: #4b0082;
  --flame: #ff4500;
  --electric: #ffd700;
  --wind: #32cd32;
  --chaos: #800000;
  --neutral: #808080;
}

@font-face {
  font-family: "ZTMY Moji";
  src: url("/assets/ZTMY_MOJI-R-7077261e.otf") format("opentype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

.ztmy-font-enabled .ztmy-ui-text {
  font-family: "ZTMY Moji", sans-serif;
  font-weight: 400;
}

.ztmy-font-enabled .ztmy-ui-dynamic {
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--primary-color);
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  letter-spacing: 2px;
}

/* Filters */
.filters {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-row { display: grid; grid-template-columns: 90px 1fr; gap: 12px; align-items: start; margin-bottom: 12px; }
.filter-label { padding-top: 7px; font-size: .85rem; font-weight: 700; color: #4b5563; }
.filter-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-button { padding: 6px 11px; border: 1px solid #d1d5db; border-radius: 999px; background: #fff; color: #4b5563; text-decoration: none; font-size: .85rem; }
.filter-button:hover { border-color: #7c3aed; color: #6d28d9; }
.filter-button.active { border-color: #6d28d9; background: #6d28d9; color: #fff; }
.filter-summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 12px; border-top: 1px solid #e5e7eb; }
.card-search-form { display: grid; gap: 12px; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid #e5e7eb; }
.search-main { display: grid; grid-template-columns: 90px minmax(180px, 1fr) auto; gap: 10px; align-items: center; }
.search-main input, .search-details input { box-sizing: border-box; width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 7px; }
.search-main input:focus, .search-details input:focus { border-color: #7c3aed; outline: 2px solid rgba(124,58,237,.15); }
.search-main input[type="submit"] { width: auto; padding-inline: 18px; border-color: #6d28d9; background: #6d28d9; color: #fff; cursor: pointer; }
.search-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-left: 102px; }
.search-details div { display: grid; gap: 5px; }
.search-details label { font-size: .78rem; color: #4b5563; }

.reset-link {
  color: #666;
  text-decoration: none;
  font-size: 0.9rem;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card-item {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  border-left: 8px solid var(--neutral);
  transition: transform 0.2s;
}

.card-item:hover {
  transform: translateY(-5px);
}

.card-item.collection-item-muted {
  filter: grayscale(1);
  opacity: .45;
  transition: filter .2s ease, opacity .2s ease, transform .2s;
}

.card-item.collection-item-muted:hover {
  opacity: .62;
}

.card-image-container {
  position: relative;
  margin: -15px -15px 15px -15px;
  overflow: hidden;
  border-radius: 4px 4px 0 0;
  background: #eee;
  aspect-ratio: 1 / 1.4;
}

.favorite-control { position: absolute; top: 7px; right: 7px; }
.favorite-control form { margin: 0; }
.favorite-control .favorite-button { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.wishlist-control { position: absolute; top: 7px; left: 7px; }
.wishlist-control form { margin: 0; }
.wishlist-control .wishlist-button { width: 32px; height: 32px; min-height: 32px; padding: 0; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 2px 6px rgba(0,0,0,.2); }

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

.card-item.element-闇 { border-left-color: var(--darkness); }
.card-item.element-炎 { border-left-color: var(--flame); }
.card-item.element-電気 { border-left-color: var(--electric); }
.card-item.element-風 { border-left-color: var(--wind); }
.card-item.element-カオス { border-left-color: var(--chaos); }

.card-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 10px;
}

.card-name {
  margin: 5px 0;
}

.card-name a {
  text-decoration: none;
  color: #333;
}

.card-type {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 15px;
}

.card-stats {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 15px;
  font-weight: bold;
}

.collection-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9f9f9;
  padding: 10px;
  border-radius: 8px;
}

.btn-count {
  background: #eee;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.btn-count:hover {
  background: #ddd;
}

.quantity {
  font-weight: bold;
}

/* Compact card list */
.cards-page { max-width: 1200px; }
.compact-card-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.compact-card-grid turbo-frame { min-width: 0; }
.compact-card-grid .card-item { height: 100%; box-sizing: border-box; display: flex; flex-direction: column; padding: 8px; border-left-width: 4px; border-radius: 9px; }
.compact-card-grid .card-image-container { margin: -8px -8px 8px; }
.compact-card-grid .card-header { margin-bottom: 5px; font-size: .72rem; }
.compact-card-grid .card-body { flex: 1; }
.compact-card-grid .card-name { min-height: 2.5em; margin: 3px 0; font-size: .9rem; line-height: 1.25; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.compact-card-grid .card-type { min-height: 1.2em; margin-bottom: 7px; font-size: .75rem; }
.compact-card-grid .collection-controls { padding: 6px; font-size: .78rem; }
.compact-card-grid .btn-count { width: 26px; height: 26px; font-size: 1rem; }

@media (max-width: 1200px) {
  .compact-card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 950px) {
  .compact-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
  .compact-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filter-row { grid-template-columns: 1fr; gap: 5px; }
  .filter-label { padding-top: 0; }
  .search-main { grid-template-columns: 1fr auto; }
  .search-main .filter-label { grid-column: 1 / -1; }
  .search-details { grid-template-columns: 1fr; margin-left: 0; }
}

/* Pagination */
.pagination-wrapper {
  margin-top: 40px;
  display: flex;
  justify-content: center;
}

.pagination {
  display: flex;
  gap: 5px;
  list-style: none;
  padding: 0;
}

.pagination span, .pagination a {
  padding: 8px 12px;
  background: #fff;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  border: 1px solid #ddd;
}

.pagination .current {
  background: #333;
  color: #fff;
  border-color: #333;
}

/* Detail Page */
.card-detail-page {
  --detail-accent-a: #ff4fb4;
  --detail-accent-b: #6b4eff;
  --detail-accent-c: #40e0c0;
  --detail-glow-a: rgba(255, 79, 180, .18);
  --detail-glow-b: rgba(107, 78, 255, .18);
  min-height: 100vh;
  padding: 32px;
  box-sizing: border-box;
  background: radial-gradient(circle at 10% 10%, var(--detail-glow-a), transparent 30%), radial-gradient(circle at 90% 20%, var(--detail-glow-b), transparent 35%), linear-gradient(135deg, #f8f7ff, #eefcff);
}
.card-detail-page.element-炎 { --detail-accent-a: #ff8a00; --detail-accent-b: #ff3d64; --detail-accent-c: #ffd166; --detail-glow-a: rgba(255,138,0,.2); --detail-glow-b: rgba(255,61,100,.18); }
.card-detail-page.element-風 { --detail-accent-a: #20c997; --detail-accent-b: #32cd32; --detail-accent-c: #8ce99a; --detail-glow-a: rgba(32,201,151,.2); --detail-glow-b: rgba(50,205,50,.16); }
.card-detail-page.element-電気 { --detail-accent-a: #ffd43b; --detail-accent-b: #f59f00; --detail-accent-c: #fff3bf; --detail-glow-a: rgba(255,212,59,.24); --detail-glow-b: rgba(245,159,0,.16); }
.card-detail-page.element-闇 { --detail-accent-a: #8b5cf6; --detail-accent-b: #db2777; --detail-accent-c: #312e81; --detail-glow-a: rgba(139,92,246,.2); --detail-glow-b: rgba(219,39,119,.16); }
.card-detail-page.element-カオス { --detail-accent-a: #ef4444; --detail-accent-b: #7f1d1d; --detail-accent-c: #f97316; --detail-glow-a: rgba(239,68,68,.2); --detail-glow-b: rgba(127,29,29,.16); }
.detail-page-inner { max-width: 1180px; margin: 0 auto; }
.detail-card-navigation { position: fixed; inset: 50% 18px auto 258px; z-index: 15; display: flex; justify-content: space-between; pointer-events: none; transform: translateY(-50%); }
.detail-nav-button { display: grid; width: 46px; height: 46px; border: 1px solid rgba(107,78,255,.2); border-radius: 50%; place-items: center; background: rgba(255,255,255,.9); box-shadow: 0 8px 24px rgba(40,28,100,.16); color: var(--detail-accent-b); text-decoration: none; font-size: 1.5rem; font-weight: 900; pointer-events: auto; backdrop-filter: blur(8px); }
.detail-nav-button:hover { color: #fff; background: var(--detail-accent-b); transform: scale(1.06); }
.detail-nav-button.disabled { opacity: .3; pointer-events: none; }
.detail-page-actions { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 24px; }
.detail-back-link { color: var(--detail-accent-b); font-weight: 700; text-decoration: none; }
.detail-admin-edit-link { padding: 10px 16px; border-radius: 999px; background: linear-gradient(135deg, var(--detail-accent-a), var(--detail-accent-b)); box-shadow: 0 8px 20px var(--detail-glow-b); color: #fff; text-decoration: none; font-size: .9rem; font-weight: 900; }
.detail-admin-edit-link:hover { filter: brightness(1.08); transform: translateY(-1px); }
.detail-card-shell { display: grid; grid-template-columns: minmax(320px, 42%) 1fr; gap: 36px; padding: 32px; border: 1px solid rgba(255,255,255,.72); border-radius: 28px; background: rgba(255,255,255,.78); backdrop-filter: blur(18px); box-shadow: 0 24px 70px rgba(40,28,100,.14); }
.detail-visual { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 20px; }
.card-image-frame { position: sticky; top: 24px; padding: 14px; border-radius: 24px; background: linear-gradient(135deg, var(--detail-accent-a), var(--detail-accent-b), var(--detail-accent-c)); box-shadow: 0 24px 50px var(--detail-glow-b); }
.detail-image { display: block; width: 100%; max-width: 430px; border-radius: 18px; }
.detail-info { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.detail-header { padding-bottom: 20px; border-bottom: 1px solid rgba(80,70,120,.14); }
.detail-badges { display: flex; gap: 10px; margin-bottom: 14px; }
.detail-number, .detail-rarity { padding: 6px 12px; border-radius: 999px; background: #17152a; color: #fff; font-size: 13px; font-weight: 800; }
.detail-rarity { background: linear-gradient(135deg, var(--detail-accent-a), var(--detail-accent-b)); }
.detail-header h1 { margin: 0 0 6px; color: #17152a; font-size: clamp(28px, 4vw, 44px); line-height: 1.15; }
.detail-english-name { margin: 0 0 14px; color: #746b88; font-weight: 600; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-tags span { padding: 6px 10px; border-radius: 999px; background: color-mix(in srgb, var(--detail-accent-a) 12%, white); color: #554b6c; font-size: .82rem; font-weight: 700; }
.detail-stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.detail-stat-item { padding: 16px; border-radius: 18px; background: #fff; box-shadow: 0 10px 26px rgba(40,28,100,.08); }
.detail-stat-item span { display: block; margin-bottom: 8px; color: #867d9d; font-size: 12px; font-weight: 700; }
.detail-stat-item strong { color: #17152a; font-size: 24px; font-weight: 900; }
.detail-panel { padding: 22px; border-radius: 22px; background: #fff; box-shadow: 0 10px 26px rgba(40,28,100,.08); }
.detail-panel h2 { margin: 0 0 12px; color: #17152a; font-size: 1rem; font-weight: 900; }
.related-panel dl { display: grid; gap: 12px; margin: 0; }
.detail-visual .related-panel { width: 100%; box-sizing: border-box; }
.related-panel dl div { display: grid; grid-template-columns: 130px 1fr; gap: 14px; }
.related-panel dt { color: #867d9d; font-size: .8rem; font-weight: 700; }
.related-panel dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: 800; }
.related-panel a { color: var(--detail-accent-b); text-decoration: none; }
.related-panel a:hover { text-decoration: underline; }
.effect-text { color: #2a2638; line-height: 1.8; font-weight: 600; }
.effect-text p { margin: 0; }
.detail-collection-actions { display: grid; grid-template-columns: minmax(190px, 1fr) repeat(2, auto); gap: 14px; align-items: center; }
.detail-collection-actions turbo-frame { min-width: 0; }
.detail-collection-actions .collection-controls { margin: 0; }
.detail-favorite-button { min-height: 46px; padding: 10px 16px; border: 1px solid var(--detail-accent-b); border-radius: 999px; background: #fff; color: var(--detail-accent-b); font-weight: 800; cursor: pointer; }
.detail-favorite-button.active { background: var(--detail-accent-b); color: #fff; }
.wishlist-button { min-height: 46px; padding: 10px 16px; border: 1px solid #d97706; border-radius: 999px; background: #fff; color: #b45309; font-weight: 800; cursor: pointer; }
.wishlist-button.active { background: #f59e0b; color: #fff; }

@media (max-width: 860px) {
  .card-detail-page { padding: 18px; }
  .detail-card-shell { grid-template-columns: 1fr; padding: 20px; }
  .card-image-frame { position: static; }
  .detail-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-card-navigation { right: 10px; left: 10px; }
}

@media (max-width: 520px) {
  .detail-stats-grid { grid-template-columns: 1fr; }
  .related-panel dl div { grid-template-columns: 1fr; gap: 4px; }
  .detail-collection-actions { grid-template-columns: 1fr; }
  .detail-favorite-button { width: 100%; }
  .wishlist-button { width: 100%; }
}

/* Card extraction review */
.extraction-admin { max-width: 1200px; margin: 0 auto; padding: 24px; }
.run-summary, .review-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 20px 0; }
.extraction-admin table { width: 100%; border-collapse: collapse; background: #fff; }
.extraction-admin th, .extraction-admin td { padding: 10px; border: 1px solid #ddd; text-align: left; vertical-align: middle; }
.card-thumb { width: 70px; height: 98px; object-fit: cover; }
.review-grid { display: grid; grid-template-columns: minmax(300px, 520px) 1fr; gap: 28px; align-items: start; }
.card-preview { width: 100%; height: auto; }
.extraction-edit .field { display: grid; gap: 5px; margin-bottom: 12px; }
.extraction-edit .field-changed { border-left: 4px solid #d97706; padding-left: 10px; }
.api-value { padding: 7px 9px; background: #f3f4f6; color: #374151; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-help { padding: 10px 12px; background: #eff6ff; color: #1e3a8a; }
.extraction-edit input, .extraction-edit textarea { width: 100%; box-sizing: border-box; padding: 8px; }
.validation-errors, .flash.alert { color: #8b0000; background: #ffe8e8; padding: 12px 28px; }
.flash.notice { color: #14532d; background: #dcfce7; padding: 12px; }
@media (max-width: 800px) { .review-grid { grid-template-columns: 1fr; } }

/* Card master administration */
.admin-page-header { display: flex; justify-content: space-between; gap: 20px; align-items: start; margin-bottom: 20px; }
.admin-page-header h1 { margin-bottom: 6px; }
.admin-page-header p { margin: 0; color: #6b7280; }
.admin-result-count { flex: none; padding: 8px 13px; border-radius: 999px; background: #ede9fe; color: #6d28d9; font-weight: 800; }
.admin-card-search { display: grid; grid-template-columns: auto minmax(220px, 1fr) auto auto auto; gap: 10px; align-items: center; margin-bottom: 20px; padding: 16px; border-radius: 10px; background: #fff; box-shadow: 0 2px 8px rgba(40,28,100,.08); }
.admin-card-search label { font-weight: 800; }
.admin-card-search input[type="search"] { box-sizing: border-box; width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 7px; }
.admin-card-search select { padding: 10px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff; }
.admin-card-search input[type="submit"], .admin-form-actions input[type="submit"] { padding: 10px 18px; border: 0; border-radius: 7px; background: #6d28d9; color: #fff; font-weight: 800; cursor: pointer; }
.admin-card-table-wrapper { overflow-x: auto; border-radius: 10px; box-shadow: 0 2px 8px rgba(40,28,100,.08); }
.admin-edit-link { display: inline-block; padding: 7px 12px; border-radius: 7px; background: #ede9fe; color: #6d28d9; text-decoration: none; font-weight: 800; }
.admin-empty-state { padding: 32px; border: 1px dashed #9ca3af; border-radius: 10px; background: #fff; color: #6b7280; text-align: center; }
.admin-back-link { color: #6d28d9; text-decoration: none; font-weight: 800; }
.admin-card-edit-layout { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 28px; align-items: start; }
.admin-card-identity { margin: 14px 0 0; padding: 14px; border-radius: 10px; background: #fff; }
.admin-card-identity div { display: grid; grid-template-columns: 90px 1fr; gap: 10px; padding: 6px 0; }
.admin-card-identity dt { color: #6b7280; font-weight: 700; }
.admin-card-identity dd { margin: 0; overflow-wrap: anywhere; }
.admin-card-form { padding: 22px; border-radius: 12px; background: #fff; box-shadow: 0 4px 16px rgba(40,28,100,.1); }
.admin-card-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-card-form .field { display: grid; gap: 6px; }
.admin-card-form .field label { color: #4b5563; font-size: .85rem; font-weight: 800; }
.admin-card-form input, .admin-card-form select, .admin-card-form textarea { box-sizing: border-box; width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 7px; font: inherit; }
.admin-card-form textarea { line-height: 1.6; resize: vertical; }
.admin-card-form .full-width { grid-column: 1 / -1; }
.admin-form-actions { display: flex; gap: 14px; align-items: center; margin-top: 22px; }
.admin-form-actions a { color: #6b7280; }
.ground-truth-progress { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto auto; gap: 16px; align-items: center; margin-bottom: 18px; padding: 16px; border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgba(40,28,100,.08); }
.ground-truth-progress div:first-child { display: grid; }
.ground-truth-progress strong { color: #17152a; font-size: 1.3rem; }
.ground-truth-progress span { color: #6b7280; font-size: .85rem; }
.ground-truth-progress progress { width: 100%; height: 12px; accent-color: #16a34a; }
.ground-truth-downloads { display: flex; gap: 8px; }
.ground-truth-downloads a { padding: 8px 11px; border-radius: 7px; background: #111827; color: #fff; text-decoration: none; font-size: .8rem; font-weight: 800; }
.verification-badge { display: inline-block; padding: 5px 8px; border-radius: 999px; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.verification-badge.verified { background: #dcfce7; color: #166534; }
.verification-badge.unverified { background: #f3f4f6; color: #6b7280; }
.ground-truth-verification-panel { display: flex; justify-content: space-between; gap: 20px; align-items: center; border: 2px solid #ddd6fe; }
.ground-truth-verification-panel h2, .ground-truth-verification-panel p { margin: 0; }
.ground-truth-verification-panel p { margin-top: 7px; color: #6b7280; }
.ground-truth-verification-panel form { flex: none; margin: 0; }
.verification-button { padding: 11px 16px; border: 0; border-radius: 999px; background: #16a34a; color: #fff; font-weight: 900; cursor: pointer; }
.verification-button.secondary { background: #e5e7eb; color: #4b5563; }

@media (max-width: 800px) {
  .admin-card-search { grid-template-columns: 1fr auto; }
  .admin-card-search label { grid-column: 1 / -1; }
  .admin-card-edit-layout, .admin-card-form-grid { grid-template-columns: 1fr; }
  .admin-card-form .full-width { grid-column: auto; }
  .ground-truth-progress { grid-template-columns: 1fr; }
  .ground-truth-verification-panel { align-items: stretch; flex-direction: column; }
  .ground-truth-verification-panel form, .verification-button { width: 100%; }
}

/* Authentication */
.account-nav { display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding: 10px 24px; background: #111827; color: #fff; }
.account-nav a { color: #fff; }
.account-nav form { margin: 0; }
.auth-container { max-width: 420px; margin: 60px auto; padding: 28px; background: #fff; border-radius: 10px; }
.auth-form { display: grid; gap: 10px; }
.auth-form input { box-sizing: border-box; width: 100%; padding: 10px; }

/* Authenticated application shell */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 240px; box-sizing: border-box; display: flex; flex-direction: column; padding: 24px 16px; background: #111827; color: #fff; }
.sidebar-brand { margin-bottom: 28px; font-weight: 800; letter-spacing: .08em; }
.sidebar-nav { display: grid; gap: 8px; }
.sidebar-link { padding: 11px 12px; border-radius: 8px; color: #d1d5db; text-decoration: none; }
.sidebar-link:hover, .sidebar-link.active { background: #374151; color: #fff; }
.sidebar-account { margin-top: auto; display: grid; gap: 10px; padding-top: 18px; border-top: 1px solid #374151; }
.sidebar-logout { width: 100%; padding: 8px; cursor: pointer; }
.sidebar-font-toggle { width: 100%; padding: 8px; border: 1px solid #6b7280; background: #1f2937; color: #fff; cursor: pointer; }
.app-content { min-height: 100vh; margin-left: 240px; }
.app-flashes { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.app-flashes .flash { margin: 0; }
.sidebar-toggle, .sidebar-overlay { display: none; }

/* Dashboard */
.dashboard-page { max-width: 1200px; margin: 0 auto; padding: 28px; }
.page-header { text-align: left; margin-bottom: 28px; }
.page-header h1 { margin-bottom: 4px; }
.dashboard-page section { margin-bottom: 34px; }
.progress-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.rarity-progress-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.progress-card { display: block; padding: 18px; border-radius: 12px; background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.08); color: inherit; text-decoration: none; }
.progress-card:hover { transform: translateY(-2px); }
.progress-card-heading { display: flex; justify-content: space-between; gap: 12px; font-size: 1.15rem; }
.progress-card-heading div { display: grid; }
.progress-card-heading small { margin-top: 3px; color: #6b7280; font-size: .75rem; }
.progress-count { margin: 10px 0 8px; color: #4b5563; }
.progress-track { height: 10px; overflow: hidden; border-radius: 999px; background: #e5e7eb; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7c3aed, #ec4899); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.showcase-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 16px; }
.showcase-card { overflow: hidden; border-radius: 10px; background: #fff; color: inherit; text-decoration: none; box-shadow: 0 3px 10px rgba(0,0,0,.1); }
.showcase-card img { width: 100%; aspect-ratio: 5 / 7; object-fit: cover; display: block; }
.showcase-card span { display: block; padding: 10px; font-size: .85rem; }
.empty-state { padding: 28px; border: 1px dashed #9ca3af; border-radius: 10px; background: #fff; text-align: center; color: #6b7280; }

.dashboard-index-page {
  max-width: 1180px;
  padding: 34px;
  color: #182033;
}
.dashboard-index-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 24px;
  margin-bottom: 28px;
  text-align: left;
}
.dashboard-index-header h1 {
  margin: 0 0 8px;
  color: #182033;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  letter-spacing: 0;
}
.dashboard-index-header p {
  margin: 0 0 6px;
  color: #182033;
  font-size: 1.15rem;
  font-weight: 900;
}
.dashboard-index-header span {
  color: #7b8498;
  font-weight: 700;
}
.dashboard-header-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}
.dashboard-notification-button {
  position: relative;
  display: grid;
  width: 52px;
  height: 52px;
  border: 1px solid #eef0f6;
  border-radius: 14px;
  place-items: center;
  background: #fff;
  box-shadow: 0 8px 24px rgba(44,34,88,.08);
  color: #182033;
  cursor: pointer;
}
.dashboard-notification-button span {
  position: absolute;
  top: -7px;
  right: -5px;
  display: grid;
  min-width: 21px;
  height: 21px;
  border-radius: 999px;
  place-items: center;
  background: #7c3aed;
  color: #fff;
  font-size: .75rem;
}
.dashboard-add-card-link {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed, #5b3ce6);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(124,58,237,.24);
}
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
.dashboard-kpi-card {
  display: grid;
  gap: 14px;
  min-height: 204px;
  padding: 24px;
  border: 1px solid #eef0f6;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(44,34,88,.08);
  color: inherit;
  text-decoration: none;
}
.dashboard-kpi-card > span {
  color: #182033;
  font-size: .92rem;
  font-weight: 900;
}
.dashboard-kpi-card strong {
  color: #182033;
  font-size: 1.65rem;
  line-height: 1;
}
.dashboard-kpi-card small {
  color: #7b8498;
  font-weight: 700;
}
.dashboard-kpi-card em {
  align-self: end;
  display: block;
  margin: 0 -24px -24px;
  padding: 15px 24px;
  border-radius: 0 0 16px 16px;
  background: #f8f5ff;
  color: #7c3aed;
  font-style: normal;
  font-weight: 900;
  text-align: right;
}
.dashboard-kpi-card.pink em { background: #fff0f6; color: #ec4899; }
.dashboard-kpi-card.amber em { background: #fff7ed; color: #f59e0b; }
.dashboard-kpi-card.green em { background: #ecfdf5; color: #10b981; }
.dashboard-completion-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.dashboard-completion-body strong {
  color: #6d28d9;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
}
.dashboard-completion-ring {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 52%, transparent 54%),
    conic-gradient(#7c3aed calc(var(--percentage) * 1%), #ede9fe 0);
}
.dashboard-middle-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .9fr);
  align-items: stretch;
  gap: 20px;
  margin-bottom: 28px;
}
.dashboard-panel {
  padding: 24px;
  border: 1px solid #eef0f6;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(44,34,88,.08);
}
.dashboard-pack-panel, .dashboard-rarity-panel {
  display: flex;
  flex-direction: column;
}
.dashboard-side-stack {
  display: grid;
  gap: 20px;
}
.dashboard-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 20px;
}
.dashboard-section-heading h2 {
  margin: 0;
  color: #182033;
  font-size: 1.1rem;
}
.dashboard-section-heading p {
  margin: 0 0 4px;
  color: #ec4899;
  font-weight: 900;
}
.dashboard-section-heading a {
  color: #6d28d9;
  font-size: .82rem;
  font-weight: 900;
  text-decoration: none;
}
.dashboard-pack-list, .dashboard-rarity-list {
  display: grid;
  gap: 15px;
}
.dashboard-pack-list { flex: 1; align-content: stretch; }
.dashboard-pack-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 56px;
  gap: 18px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.dashboard-pack-image {
  width: 76px;
  height: 100%;
  min-height: 100px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(44,34,88,.14);
}
.dashboard-pack-image.placeholder {
  display: grid;
  place-items: center;
  background: #f3f4f6;
  color: #6d28d9;
  font-weight: 900;
  text-align: center;
}
.dashboard-pack-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.dashboard-pack-copy strong {
  overflow: hidden;
  color: #182033;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-pack-copy small {
  color: #7b8498;
  font-weight: 700;
}
.dashboard-progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}
.dashboard-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #6d5dfc);
}
.dashboard-pack-rate {
  color: #6d28d9;
  font-size: 1.35rem;
  text-align: right;
}
.dashboard-rarity-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 16px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.dashboard-rarity-badge {
  display: grid;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  place-items: center;
  background: #111827;
  color: #fff;
  font-size: .74rem;
  font-weight: 900;
}
.dashboard-rarity-badge.rarity-r { background: #10b981; }
.dashboard-rarity-badge.rarity-sr { background: #06b6d4; }
.dashboard-rarity-badge.rarity-ur { background: #8b5cf6; }
.dashboard-rarity-badge.rarity-se { background: #f59e0b; }
.dashboard-rarity-meter {
  display: grid;
  gap: 8px;
}
.dashboard-rarity-meter > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #182033;
}
.dashboard-rarity-meter small {
  color: #7b8498;
  font-weight: 800;
}
.dashboard-achievement-progress {
  display: grid;
  gap: 14px;
}
.dashboard-achievement-summary {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}
.dashboard-achievement-count {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 62px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #f5f3ff;
  color: #6d28d9;
}
.dashboard-achievement-count strong {
  color: #6d28d9;
  font-size: 2.5rem;
  line-height: 1;
  font-weight: 900;
}
.dashboard-achievement-count span {
  color: #7b8498;
  font-size: 1.1rem;
  font-weight: 900;
}
.dashboard-achievement-meter {
  display: grid;
  gap: 12px;
}
.dashboard-achievement-meter strong {
  color: #182033;
  font-weight: 900;
}
.dashboard-achievement-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
}
.dashboard-achievement-heading span {
  font-weight: 900;
}
.dashboard-achievement-heading strong {
  font-size: 2rem;
  line-height: 1;
}
.dashboard-near-achievement {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f5f3ff, #faf5ff);
  color: inherit;
  text-decoration: none;
}
.dashboard-near-icon {
  display: grid;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  place-items: center;
  background: #ede9fe;
  color: #6d28d9;
  font-size: 1.25rem;
}
.dashboard-near-achievement span {
  display: block;
  color: #6d28d9;
  font-size: .75rem;
  font-weight: 900;
}
.dashboard-near-achievement strong {
  display: block;
  margin-top: 4px;
  color: #182033;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-near-achievement small {
  display: block;
  margin-top: 6px;
  color: #6d28d9;
  font-weight: 900;
}
.dashboard-favorites-panel {
  margin-bottom: 0 !important;
}
.dashboard-favorite-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 20px;
}
.dashboard-favorite-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #f3f4f6;
  box-shadow: 0 10px 24px rgba(44,34,88,.12);
}
.dashboard-favorite-card img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
}
.dashboard-favorite-card span {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  place-items: center;
  background: #fff;
  color: #ec4899;
  box-shadow: 0 5px 14px rgba(44,34,88,.18);
}
.dashboard-empty-state {
  padding: 28px;
  border: 1px dashed #c4b5fd;
  border-radius: 14px;
  background: #f8f7ff;
  color: #7b8498;
  text-align: center;
}
.dashboard-empty-state a {
  color: #6d28d9;
  font-weight: 900;
}

/* Favorites */
.favorite-entry { display: grid; gap: 10px; }
.favorite-button { padding: 0 4px; border: 0; background: transparent; color: #9ca3af; cursor: pointer; font-size: 1.3rem; }
.favorite-button.active { color: #e11d48; }
.showcase-controls { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; background: #fff; }

/* Wishlist and pack recommendation */
.wishlist-page { max-width: 1200px; }
.wishlist-page section { margin-bottom: 36px; }
.acquired-wishlist-item { position: relative; min-width: 0; }
.acquired-badge { position: absolute; z-index: 3; top: 46px; left: 50%; padding: 5px 10px; border-radius: 999px; transform: translateX(-50%); background: rgba(17,24,39,.88); color: #fff; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.acquired-wishlist-item .card-item { opacity: .78; }
.recommendation-page { max-width: 1200px; margin: 0 auto; padding: 28px; }
.recommendation-page section { margin-bottom: 34px; }
.recommendation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.recommendation-card { display: grid; gap: 8px; padding: 20px; border-radius: 16px; background: linear-gradient(145deg, #fff, #f5f3ff); box-shadow: 0 5px 18px rgba(40,28,100,.1); }
.recommendation-card h3, .pack-result-heading h3 { margin: 0; }
.recommendation-card strong { color: #6d28d9; font-size: 1.45rem; }
.recommendation-card span { color: #6b7280; }
.recommendation-empty { margin: 0; color: #6b7280; line-height: 1.6; }
.pack-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.pack-result-card { padding: 20px; border-radius: 16px; background: #fff; box-shadow: 0 3px 12px rgba(0,0,0,.08); }
.pack-result-card.incomplete { border: 1px solid #f59e0b; }
.pack-result-heading { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.pack-result-heading small { color: #6b7280; }
.data-warning { padding: 5px 8px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: .72rem; font-weight: 800; }
.expectation-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.expectation-list div { padding: 10px; border-radius: 9px; background: #f9fafb; }
.expectation-list dt { min-height: 2.5em; color: #6b7280; font-size: .75rem; }
.expectation-list dd { margin: 5px 0 0; font-size: 1.25rem; font-weight: 900; }
.rarity-breakdown { width: 100%; border-collapse: collapse; text-align: right; }
.rarity-breakdown th, .rarity-breakdown td { padding: 7px; border-top: 1px solid #e5e7eb; }
.rarity-breakdown th:first-child { text-align: left; }
.calculation-note { padding: 16px 20px; border-radius: 12px; background: #fff; color: #4b5563; }
.calculation-note summary { cursor: pointer; font-weight: 800; }

/* Decks */
.decks-page { max-width: 1200px; margin: 0 auto; padding: 28px; }
.deck-primary-link, .deck-secondary-link, .deck-primary-button, .deck-small-button, .deck-danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.deck-primary-link, .deck-primary-button, .deck-small-button { background: #6d28d9; color: #fff; }
.deck-secondary-link { background: #ede9fe; color: #6d28d9; }
.deck-danger-button { background: #fee2e2; color: #991b1b; }
.deck-list-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.deck-list-card { display: grid; gap: 16px; padding: 20px; border-radius: 20px; background: #fff; box-shadow: 0 8px 24px rgba(40,28,100,.09); }
.deck-list-card.compact-preview { grid-template-columns: minmax(0, 1fr) 266px; align-items: center; }
.deck-list-main { display: grid; gap: 12px; min-width: 0; }
.deck-list-card h2 { margin: 0 0 4px; }
.deck-list-card p { margin: 0; color: #6b7280; }
.deck-list-card strong { font-size: 1.3rem; }
.deck-list-card strong.complete { color: #059669; }
.deck-list-card strong.draft { color: #d97706; }
.deck-list-representatives { display: flex; align-items: stretch; justify-content: flex-end; gap: 10px; min-height: 116px; }
.deck-list-representatives.compact { width: 266px; justify-self: end; }
.deck-list-representative-card { position: relative; flex: 0 0 82px; overflow: hidden; border: 1px solid #ede9fe; border-radius: 12px; background: #f3f4f6; box-shadow: 0 6px 16px rgba(40,28,100,.12); }
.deck-list-representative-card img { display: block; width: 82px; height: 116px; object-fit: cover; }
.deck-list-representative-card span { position: absolute; right: 5px; bottom: 5px; padding: 3px 7px; border-radius: 999px; background: rgba(17,24,39,.86); color: #fff; font-size: .68rem; font-weight: 900; }
.deck-list-empty-preview { display: grid; width: 100%; min-height: 116px; border: 1px dashed #c4b5fd; border-radius: 12px; place-items: center; background: #f8f7ff; color: #6b7280; font-weight: 800; text-align: center; }
.deck-list-actions { display: flex; gap: 10px; align-items: center; }
.deck-list-actions form { margin: 0; }
.deck-form-card { display: grid; gap: 18px; max-width: 560px; padding: 24px; border-radius: 20px; background: #fff; box-shadow: 0 8px 24px rgba(40,28,100,.09); }
.deck-form-card .field { display: grid; gap: 6px; }
.deck-form-card input, .deck-form-card select { box-sizing: border-box; width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 10px; }
.deck-form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.deck-builder-page { display: flex; flex-direction: column; height: 100vh; box-sizing: border-box; padding: 18px; overflow: hidden; background: radial-gradient(circle at 0 0, rgba(124,58,237,.12), transparent 28%), #f4f4f9; }
.deck-builder-fixed { flex: 0 0 auto; display: grid; gap: 12px; }
.deck-builder-header { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.deck-back-link { color: #6d28d9; font-weight: 800; text-decoration: none; }
.deck-title-form { display: flex; gap: 8px; margin-top: 8px; }
.deck-title-form input[type="text"] { min-width: min(420px, 56vw); padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 12px; font-size: 1.1rem; font-weight: 900; }
.deck-rule-note { padding: 10px 14px; border-radius: 999px; background: #fff; color: #4b5563; font-weight: 800; box-shadow: 0 5px 16px rgba(40,28,100,.08); }
.deck-selected-area { display: grid; grid-template-columns: 160px 1fr; gap: 14px; align-items: stretch; padding: 14px; border-radius: 20px; background: linear-gradient(135deg, #17152a, #6d28d9); color: #fff; box-shadow: 0 12px 30px rgba(40,28,100,.18); }
.deck-selected-summary { display: grid; align-content: center; gap: 8px; }
.deck-selected-summary span { color: rgba(255,255,255,.72); font-size: .82rem; font-weight: 800; }
.deck-selected-summary strong { display: block; margin-top: 3px; font-size: 1.8rem; }
.deck-selected-summary p { margin: 0; }
.deck-selected-grid { display: flex; gap: 8px; min-height: 112px; overflow-x: auto; padding-bottom: 4px; }
.deck-selected-card { position: relative; flex: 0 0 72px; }
.deck-selected-card img { display: block; width: 72px; aspect-ratio: 5 / 7; border-radius: 10px; object-fit: cover; box-shadow: 0 6px 16px rgba(0,0,0,.28); }
.deck-selected-card span { position: absolute; right: 4px; bottom: 4px; padding: 2px 6px; border-radius: 999px; background: rgba(17,24,39,.86); font-size: .75rem; font-weight: 900; }
.deck-remove-button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: #fee2e2; color: #991b1b; font-weight: 900; cursor: pointer; }
.deck-selected-empty { display: grid; min-width: 260px; border: 1px dashed rgba(255,255,255,.4); border-radius: 14px; place-items: center; color: rgba(255,255,255,.78); }
.deck-builder-filters { display: grid; gap: 9px; max-height: 260px; overflow-y: auto; padding: 12px; border-radius: 18px; background: rgba(255,255,255,.96); box-shadow: 0 8px 24px rgba(40,28,100,.08); }
.deck-mode-form, .deck-search-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.deck-mode-form label, .deck-search-form label { color: #4b5563; font-weight: 800; }
.deck-mode-form select, .deck-search-form input { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 10px; }
.deck-search-form input[type="search"] { min-width: min(360px, 100%); flex: 1; }
.deck-filter-row { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: start; }
.deck-filter-row > span { padding-top: 7px; color: #4b5563; font-weight: 800; font-size: .85rem; }
.deck-filter-row > div { display: flex; flex-wrap: wrap; gap: 7px; }
.deck-filter-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 8px; border-top: 1px solid #e5e7eb; }
.deck-candidate-scroll { flex: 1 1 auto; min-height: 0; margin-top: 12px; overflow-y: auto; padding-right: 4px; }
.deck-candidate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.deck-candidate-card { overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 6px 18px rgba(40,28,100,.08); }
.deck-candidate-image-wrap { position: relative; background: #eee; }
.deck-preview-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.deck-preview-button img { display: block; width: 100%; aspect-ratio: 5 / 7; object-fit: cover; }
.deck-add-form { position: absolute; top: 7px; right: 7px; margin: 0; }
.deck-add-button { display: grid; width: 34px; height: 34px; border: 0; border-radius: 50%; place-items: center; background: #6d28d9; color: #fff; font-size: 1.3rem; font-weight: 900; box-shadow: 0 4px 12px rgba(0,0,0,.22); cursor: pointer; }
.deck-add-button:disabled, .deck-primary-button:disabled { background: #9ca3af; cursor: not-allowed; }
.deck-candidate-meta { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px 0; color: #6b7280; font-size: .75rem; font-weight: 800; }
.deck-candidate-card p { min-height: 2.6em; margin: 5px 10px; font-size: .9rem; font-weight: 800; line-height: 1.3; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.deck-candidate-card small { display: block; padding: 0 10px 10px; color: #6b7280; font-weight: 700; }
.deck-preview-modal[hidden] { display: none; }
.deck-preview-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; }
.deck-preview-backdrop { position: absolute; inset: 0; background: rgba(17,24,39,.68); backdrop-filter: blur(6px); }
.deck-preview-panel { position: relative; z-index: 1; display: grid; gap: 14px; width: min(420px, 92vw); padding: 18px; border-radius: 24px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.deck-preview-panel img { width: 100%; max-height: 72vh; border-radius: 16px; object-fit: contain; }
.deck-preview-close { position: absolute; top: -12px; right: -12px; display: grid; width: 36px; height: 36px; border: 0; border-radius: 50%; place-items: center; background: #111827; color: #fff; font-size: 1.4rem; cursor: pointer; }
.deck-preview-add-form { display: grid; }
.deck-preview-panel p { margin: 0; color: #991b1b; font-weight: 800; text-align: center; }

@media (max-width: 800px) {
  .app-content { margin-left: 0; padding-top: 52px; }
  .sidebar { width: min(82vw, 280px); transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-toggle { position: fixed; top: 10px; left: 12px; z-index: 25; display: block; padding: 8px 11px; border: 0; border-radius: 7px; background: #111827; color: #fff; font-size: 1.2rem; }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 20; border: 0; background: rgba(0,0,0,.45); }
  .sidebar-open .sidebar-overlay { display: block; }
  .showcase-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .dashboard-page { padding: 18px; }
  .dashboard-index-header { flex-direction: column; }
  .dashboard-header-actions { width: 100%; justify-content: space-between; }
  .dashboard-kpi-grid, .dashboard-middle-grid { grid-template-columns: 1fr; }
  .dashboard-kpi-card { min-height: 0; }
  .dashboard-favorite-card-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .dashboard-pack-row { grid-template-columns: 64px minmax(0, 1fr) 48px; gap: 12px; }
  .dashboard-pack-image { width: 64px; height: 84px; min-height: 84px; }
  .recommendation-page { padding: 18px; }
  .recommendation-grid, .pack-result-grid { grid-template-columns: 1fr; }
  .expectation-list { grid-template-columns: 1fr; }
  .decks-page { padding: 18px; }
  .deck-list-grid { grid-template-columns: 1fr; }
  .deck-list-card.compact-preview { grid-template-columns: minmax(0, 1fr) 206px; }
  .deck-list-representatives { min-height: 92px; gap: 8px; }
  .deck-list-representatives.compact { width: 206px; }
  .deck-list-representative-card { flex-basis: 62px; }
  .deck-list-representative-card img { width: 62px; height: 88px; }
  .deck-list-empty-preview { min-height: 88px; }
  .deck-builder-page { height: calc(100vh - 52px); padding: 12px; }
  .deck-builder-header { align-items: stretch; flex-direction: column; }
  .deck-title-form { flex-wrap: wrap; }
  .deck-title-form input[type="text"] { min-width: 0; flex: 1 1 220px; }
  .deck-selected-area { grid-template-columns: 1fr; }
  .deck-builder-filters { max-height: 300px; }
  .deck-filter-row { grid-template-columns: 1fr; }
  .deck-filter-row > span { padding-top: 0; }
  .deck-candidate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

/* Achievements */
.achievements-page { max-width: 1200px; margin: 0 auto; padding: 28px; }
.achievement-tabs { display: inline-flex; gap: 8px; margin-bottom: 22px; padding: 6px; border-radius: 999px; background: #ede9fe; }
.achievement-tab { min-width: 110px; padding: 10px 16px; border-radius: 999px; color: #6d28d9; text-align: center; text-decoration: none; font-weight: 900; }
.achievement-tab.active { background: #6d28d9; color: #fff; box-shadow: 0 8px 18px rgba(109,40,217,.22); }
.achievement-list { display: grid; gap: 16px; }
.achievement-list-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 42%); gap: 18px; align-items: center; padding: 20px; overflow: hidden; border: 1px solid #ede9fe; border-radius: 22px; background: linear-gradient(145deg, #fff, #f8f7ff); box-shadow: 0 8px 24px rgba(40,28,100,.09); color: inherit; text-decoration: none; }
.achievement-list-card:hover { border-color: #8b5cf6; box-shadow: 0 16px 38px rgba(40,28,100,.14); transform: translateY(-2px); }
.achievement-list-main { display: grid; gap: 14px; min-width: 0; }
.achievement-list-main h2 { margin: 0 0 7px; color: #17152a; }
.achievement-list-main p { margin: 0; color: #6b7280; line-height: 1.7; }
.achievement-progress-summary { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; }
.achievement-progress-summary strong { font-size: 1.45rem; }
.achievement-progress-summary strong.complete, .achievement-detail-status.complete strong { color: #059669; }
.achievement-progress-summary strong.incomplete, .achievement-detail-status.incomplete strong { color: #d97706; }
.achievement-progress-summary span { color: #4b5563; font-weight: 800; }
.achievement-card-stack { display: flex; align-items: center; justify-content: flex-end; min-height: 124px; padding-left: 24px; }
.achievement-preview-card { position: relative; flex: 0 0 76px; margin-left: -22px; overflow: hidden; border: 2px solid #fff; border-radius: 12px; background: #f3f4f6; box-shadow: 0 8px 18px rgba(40,28,100,.18); }
.achievement-preview-card:first-child { margin-left: 0; }
.achievement-preview-card img { display: block; width: 76px; height: 106px; object-fit: cover; }
.achievement-preview-card.missing img, .achievement-card-missing .card-image-container img { filter: grayscale(1); opacity: .42; }
.achievement-preview-card small { position: absolute; right: 5px; bottom: 5px; padding: 2px 6px; border-radius: 999px; background: rgba(17,24,39,.88); color: #fff; font-size: .68rem; font-weight: 900; }
.achievement-more-count, .achievement-no-cards { display: grid; min-width: 54px; height: 54px; margin-left: 10px; border-radius: 999px; place-items: center; background: #111827; color: #fff; font-weight: 900; }
.achievement-no-cards { min-width: 140px; border-radius: 14px; background: #f3f4f6; color: #6b7280; }
.achievement-back-link { display: inline-block; margin-bottom: 12px; color: #6d28d9; font-weight: 900; text-decoration: none; }
.achievement-detail-status { display: inline-flex; gap: 12px; align-items: baseline; margin-top: 14px; padding: 12px 16px; border-radius: 999px; background: #fff; box-shadow: 0 8px 24px rgba(40,28,100,.08); }
.achievement-detail-status strong { font-size: 1.4rem; }
.achievement-detail-status span { color: #4b5563; font-weight: 900; }
.achievement-card-grid > div { min-width: 0; }
.achievement-required-quantity { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #fff7ed; color: #9a3412; text-align: center; font-weight: 900; }

@media (max-width: 800px) {
  .achievements-page { padding: 18px; }
  .achievement-list-card { grid-template-columns: 1fr; }
  .achievement-card-stack { justify-content: flex-start; padding-left: 20px; }
  .achievement-preview-card { flex-basis: 64px; margin-left: -18px; }
  .achievement-preview-card img { width: 64px; height: 90px; }
}

/* Song quiz */
.quiz-index-page { max-width: 980px; margin: 0 auto; padding: 28px; }
.quiz-index-header { text-align: center; }
.quiz-index-header p { margin-top: 8px; color: #6b7280; }
.quiz-selection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-top: 44px; }
.quiz-selection-card { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; min-height: 150px; padding: 28px; border: 1px solid #ede9fe; border-radius: 22px; background: linear-gradient(145deg, #fff, #f5f3ff); box-shadow: 0 10px 30px rgba(40,28,100,.1); color: inherit; text-decoration: none; }
.quiz-selection-card:hover { border-color: #8b5cf6; box-shadow: 0 16px 38px rgba(40,28,100,.16); transform: translateY(-3px); }
.quiz-selection-card h2 { margin: 0 0 8px; color: #17152a; font-size: 1.3rem; }
.quiz-selection-card p { margin: 0; color: #6b7280; line-height: 1.65; }
.quiz-selection-icon { display: grid; width: 54px; height: 54px; border-radius: 16px; place-items: center; background: linear-gradient(135deg, #7c3aed, #db2777); color: #fff; font-size: 1.8rem; font-weight: 900; }
.quiz-selection-icon.illustrator { background: linear-gradient(135deg, #0891b2, #2563eb); }
.quiz-selection-arrow { color: #7c3aed; font-size: 1.6rem; font-weight: 900; }
.song-quiz-page { max-width: 980px; margin: 0 auto; padding: 28px; }
.song-quiz-header { text-align: center; }
.song-quiz-header p { margin-top: 8px; color: #6b7280; }
.quiz-start-panel, .quiz-result-panel { max-width: 560px; margin: 64px auto 0; padding: 42px; border-radius: 24px; background: #fff; box-shadow: 0 16px 45px rgba(40,28,100,.12); text-align: center; }
.quiz-start-icon { display: grid; width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%; place-items: center; background: linear-gradient(135deg, #7c3aed, #ec4899); color: #fff; font-size: 2.2rem; font-weight: 900; }
.quiz-start-panel h2 { margin-bottom: 8px; }
.quiz-start-panel p { color: #6b7280; line-height: 1.7; }
.quiz-unavailable { padding: 12px; border-radius: 8px; background: #fef3c7; color: #92400e !important; }
.quiz-primary-button { min-width: 190px; padding: 13px 22px; border: 0; border-radius: 999px; background: linear-gradient(135deg, #6d28d9, #db2777); color: #fff; font-size: 1rem; font-weight: 800; cursor: pointer; }
.quiz-primary-button:hover { filter: brightness(1.08); }
.quiz-progress-row { display: flex; justify-content: space-between; margin-bottom: 8px; color: #4b5563; }
.quiz-progress-row strong { color: #6d28d9; }
.quiz-progress-track { height: 9px; margin-bottom: 24px; overflow: hidden; border-radius: 999px; background: #e5e7eb; }
.quiz-progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7c3aed, #ec4899); }
.quiz-question-panel { display: grid; grid-template-columns: minmax(260px, 42%) 1fr; gap: 34px; align-items: center; padding: 30px; border-radius: 26px; background: #fff; box-shadow: 0 16px 45px rgba(40,28,100,.12); }
.quiz-card-frame { position: relative; overflow: hidden; padding: 12px; border-radius: 20px; background: linear-gradient(135deg, #7c3aed, #ec4899, #f59e0b); }
.quiz-card-frame.concealed::after { position: absolute; inset: 65% 12px 12px; border-radius: 0 0 14px 14px; background: rgba(245,243,255,.38); box-shadow: inset 0 0 32px rgba(255,255,255,.35); content: ""; pointer-events: none; backdrop-filter: blur(22px) saturate(.65); }
.quiz-card-image { display: block; width: 100%; border-radius: 14px; }
.quiz-answer-area h2 { margin: 0 0 22px; color: #17152a; }
.quiz-options { display: grid; gap: 12px; }
.quiz-option-button { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: center; width: 100%; padding: 12px 16px; border: 1px solid #ddd6fe; border-radius: 12px; background: #fafafa; color: #28233b; text-align: left; font-size: .96rem; font-weight: 700; cursor: pointer; }
.quiz-option-button span { display: grid; width: 30px; height: 30px; border-radius: 50%; place-items: center; background: #ede9fe; color: #6d28d9; }
.quiz-option-button:hover { border-color: #7c3aed; background: #f5f3ff; transform: translateY(-1px); }
.quiz-feedback { display: grid; gap: 8px; margin-bottom: 22px; padding: 20px; border-radius: 14px; }
.quiz-feedback.correct { background: #dcfce7; color: #166534; }
.quiz-feedback.incorrect { background: #fee2e2; color: #991b1b; }
.quiz-feedback strong { font-size: 1.35rem; }
.quiz-feedback small { padding-top: 8px; border-top: 1px solid currentColor; opacity: .8; }
.quiz-result-label { margin: 0; color: #7c3aed; font-size: .82rem; font-weight: 900; letter-spacing: .2em; }
.quiz-result-score { margin: 12px 0 0; font-size: 2rem; }
.quiz-result-score strong { color: #6d28d9; font-size: 5rem; line-height: 1; }
.quiz-result-rate { margin-bottom: 28px; color: #6b7280; font-weight: 700; }

@media (max-width: 720px) {
  .quiz-index-page { padding: 18px; }
  .quiz-selection-grid { grid-template-columns: 1fr; margin-top: 24px; }
  .quiz-selection-card { min-height: 0; padding: 20px; }
  .song-quiz-page { padding: 18px; }
  .quiz-question-panel { grid-template-columns: 1fr; padding: 18px; }
  .quiz-card-frame { max-width: 340px; margin: 0 auto; }
  .quiz-start-panel, .quiz-result-panel { margin-top: 24px; padding: 28px 18px; }
}
