/* ======================================================================
   DeckForge — synergy-aware deck builder + matchup simulator
   Apple Liquid Glass system: translucent panels, backdrop-blur, specular
   edges. Uses the site --cc-* tokens. Light + dark + reduced-motion safe.
   ====================================================================== */

.df { --df-pad: clamp(14px, 2.4vw, 26px); max-width: 1320px; }
.cc-page-pad.df { padding-left: clamp(12px,3vw,28px); padding-right: clamp(12px,3vw,28px); }

/* ---- shared glass panel (self-contained so the feature is portable) ---- */
.df .cc-glass-panel {
  position: relative;
  background: var(--cc-glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--cc-glass-line);
  border-radius: var(--cc-r-lg, 20px);
  box-shadow: var(--cc-shadow-md);
}
.df .cc-glass-panel::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0) 38%);
  opacity: .9;
}
:root.dark .df .cc-glass-panel::before,
.tb-dark .df .cc-glass-panel::before,
.dark .df .cc-glass-panel::before { opacity: .42; }

/* ---------------------------------- Hero ---------------------------------- */
.df-hero {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  padding: clamp(20px,3vw,34px); margin-bottom: 18px; overflow: hidden;
}
.df-title {
  font-size: clamp(26px, 3.6vw, 40px); line-height: 1.05; letter-spacing: -.02em;
  margin: 0 0 10px; font-weight: 700; color: var(--cc-ink);
}
.df-sub { color: var(--cc-ink-2); max-width: 64ch; line-height: 1.5; margin: 0; font-size: 15px; }
.df-sub strong { color: var(--cc-ink); font-weight: 600; }
.df-est { color: var(--cc-ink-3); font-style: italic; font-size: .92em; }
.df-hero-stats { display: flex; gap: 10px; }
.df-hero-stat {
  min-width: 92px; text-align: center; padding: 14px 12px; border-radius: var(--cc-r-md);
  background: var(--cc-surface-2); border: 1px solid var(--cc-line-soft);
}
.df-hero-num { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--cc-ink); }
.df-hero-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--cc-ink-3); margin-top: 4px; }
.df-hero-grade .df-hero-num { color: var(--cc-accent); }

/* -------------------------------- Workbench ------------------------------- */
.df-bench {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(300px, 360px);
  gap: 16px; align-items: start;
}
@media (max-width: 1100px) { .df-bench { grid-template-columns: minmax(0,1fr) minmax(280px,340px); } .df-rail { grid-column: 1 / -1; } }
@media (max-width: 760px)  { .df-bench { grid-template-columns: 1fr; } }

/* ----- left rail ----- */
.df-rail { display: flex; flex-direction: column; max-height: calc(100vh - 120px); position: sticky; top: 88px; overflow: hidden; }
@media (max-width: 1100px) { .df-rail { position: static; max-height: none; } }
.df-rail-head { padding: 16px 16px 10px; border-bottom: 1px solid var(--cc-line-soft); }
.df-search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 44px;
  background: var(--cc-surface-2); border: 1px solid var(--cc-line); border-radius: var(--cc-r-pill);
  transition: border-color var(--cc-dur-fast) var(--cc-ease), box-shadow var(--cc-dur-fast) var(--cc-ease);
}
.df-search:focus-within { border-color: var(--cc-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cc-accent) 16%, transparent); }
.df-search-ic { color: var(--cc-ink-3); font-size: 18px; }
.df-search input { flex: 1; border: 0; background: transparent; color: var(--cc-ink); font-size: 15px; outline: none; font-family: var(--cc-font); }
.df-search input::placeholder { color: var(--cc-ink-mute); }
.df-search-clear { border: 0; background: transparent; color: var(--cc-ink-3); cursor: pointer; display: grid; place-items: center; padding: 4px; border-radius: 50%; }
.df-search-clear:hover { background: var(--cc-surface-3); color: var(--cc-ink); }
.df-rail-hint { font-size: 12px; color: var(--cc-ink-3); margin: 8px 2px 0; }
.df-rail-hint kbd { font-family: var(--cc-font-mono); background: var(--cc-surface-3); border-radius: 5px; padding: 0 5px; font-size: 11px; }

.df-results { flex: 1; overflow-y: auto; padding: 8px; scrollbar-width: thin; }
.df-results-empty { text-align: center; color: var(--cc-ink-3); padding: 34px 16px; }
.df-results-orb { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; color: var(--cc-accent); background: color-mix(in srgb, var(--cc-accent) 12%, transparent); }
.df-seed, .df-results-empty button { border: 0; background: none; color: var(--cc-accent); cursor: pointer; font-weight: 600; padding: 0; font-size: inherit; }
.df-seed:hover { text-decoration: underline; }

/* result card row */
.df-res {
  display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center;
  padding: 8px; border-radius: var(--cc-r-md); cursor: grab; position: relative;
  border: 1px solid transparent; transition: background var(--cc-dur-fast) var(--cc-ease), transform var(--cc-dur-fast) var(--cc-ease-glass), border-color var(--cc-dur-fast) var(--cc-ease);
  user-select: none;
}
.df-res:hover { background: var(--cc-surface-2); border-color: var(--cc-line-soft); }
.df-res:active { cursor: grabbing; }
.df-res.df-dragging { opacity: .5; }
.df-res-thumb { width: 42px; height: 58px; border-radius: 6px; object-fit: cover; background: var(--cc-surface-3); box-shadow: var(--cc-shadow-sm); }
.df-res-body { min-width: 0; }
.df-res-name { font-weight: 600; font-size: 13.5px; color: var(--cc-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.df-res-meta { font-size: 11.5px; color: var(--cc-ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.df-res-price { font-variant-numeric: tabular-nums; color: var(--cc-ink-2); font-weight: 600; }
.df-add { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--cc-line); background: var(--cc-surface); color: var(--cc-accent); cursor: pointer; display: grid; place-items: center; font-size: 16px; font-weight: 700; transition: transform var(--cc-dur-fast) var(--cc-ease-glass), background var(--cc-dur-fast); }
.df-add:hover { background: var(--cc-accent); color: #fff; transform: scale(1.08); }
.df-add:active { transform: scale(.92); }

/* type chips reuse the site energy palette */
.df-type { display: inline-block; width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); vertical-align: middle; }
.df-energy--grass{background:#5fbd58}.df-energy--fire{background:#ee8130}.df-energy--water{background:#5ea4ee}
.df-energy--lightning{background:#f6c93f}.df-energy--psychic{background:#c068b6}.df-energy--fighting{background:#cc6e54}
.df-energy--darkness{background:#4a3a30}.df-energy--metal{background:#8da0b2}.df-energy--dragon{background:#6f57e0}
.df-energy--fairy{background:#ed98c9}.df-energy--colorless{background:#b9b6a8}

/* ----- center deck ----- */
.df-deck { display: flex; flex-direction: column; min-height: 520px; }
.df-deck-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--cc-line-soft); flex-wrap: wrap; }
.df-deck-head h2 { font-size: 17px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; color: var(--cc-ink); }
.df-deck-count { font-size: 13px; font-weight: 700; background: var(--cc-accent); color: #fff; border-radius: var(--cc-r-pill); padding: 2px 10px; font-variant-numeric: tabular-nums; }
.df-deck-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.df-mix { display: inline-flex; width: 110px; height: 8px; border-radius: var(--cc-r-pill); overflow: hidden; background: var(--cc-surface-3); }
.df-mix-seg { height: 100%; width: var(--w); transition: width var(--cc-dur) var(--cc-ease-glass); }
.df-mix--pk { background: var(--cc-accent); }
.df-mix--tr { background: #b25e09; }
.df-mix--en { background: var(--cc-success); }

.df-dropzone { flex: 1; padding: 14px; transition: background var(--cc-dur) var(--cc-ease); border-radius: 0 0 var(--cc-r-lg) var(--cc-r-lg); }
.df-dropzone.df-drop-hot { background: color-mix(in srgb, var(--cc-accent) 10%, transparent); box-shadow: inset 0 0 0 2px var(--cc-accent); }

.df-deck-empty { text-align: center; padding: 40px 20px; color: var(--cc-ink-3); }
.df-deck-empty h3 { color: var(--cc-ink); font-size: 18px; margin: 6px 0; }
.df-deck-empty p { margin: 0 0 18px; }
.df-deck-empty-art { display: flex; justify-content: center; gap: -10px; margin-bottom: 18px; height: 84px; }
.df-ghost-card { width: 58px; height: 80px; border-radius: 8px; border: 2px dashed var(--cc-line); margin: 0 -8px; transform: rotate(var(--r,0deg)); background: var(--cc-surface-2); }
.df-ghost-card:nth-child(1){--r:-9deg}.df-ghost-card:nth-child(2){--r:0deg; margin-top:-6px}.df-ghost-card:nth-child(3){--r:9deg}

.df-deck-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.df-slot {
  position: relative; border-radius: var(--cc-r-md); overflow: hidden; background: var(--cc-surface-2);
  border: 1px solid var(--cc-line-soft); box-shadow: var(--cc-shadow-sm);
  transition: transform var(--cc-dur) var(--cc-ease-glass), box-shadow var(--cc-dur) var(--cc-ease);
  animation: df-pop var(--cc-dur) var(--cc-ease-glass) both;
}
.df-slot:hover { transform: translateY(-3px); box-shadow: var(--cc-shadow-md); }
@keyframes df-pop { from { opacity: 0; transform: translateY(10px) scale(.9); } to { opacity: 1; transform: none; } }
.df-slot.df-removing { animation: df-out 220ms var(--cc-ease-exit) both; }
@keyframes df-out { to { opacity: 0; transform: scale(.85); } }
.df-slot-img { width: 100%; aspect-ratio: 245/342; object-fit: cover; display: block; background: var(--cc-surface-3); }
.df-slot-noimg { width: 100%; aspect-ratio: 245/342; display: grid; place-items: center; color: var(--cc-ink-mute); font-size: 22px; }
.df-slot-foot { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; gap: 6px; }
.df-slot-name { font-size: 11.5px; font-weight: 600; color: var(--cc-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.df-qty { display: inline-flex; align-items: center; gap: 4px; }
.df-qty button { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--cc-line); background: var(--cc-surface); color: var(--cc-ink); cursor: pointer; font-size: 14px; line-height: 1; display: grid; place-items: center; }
.df-qty button:hover { background: var(--cc-accent); color: #fff; border-color: var(--cc-accent); }
.df-qty-n { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; min-width: 16px; text-align: center; color: var(--cc-ink); }
.df-slot-badge { position: absolute; top: 6px; left: 6px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: var(--cc-r-pill); background: rgba(0,0,0,.6); color: #fff; backdrop-filter: blur(4px); }
.df-slot-rm { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity var(--cc-dur-fast); }
.df-slot:hover .df-slot-rm { opacity: 1; }
.df-slot-rm:hover { background: var(--cc-danger); }

/* ----- right HUD ----- */
.df-hud { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 88px; }
@media (max-width: 1100px) { .df-hud { position: static; } }
.df-hud-card { padding: 16px; }
.df-hud-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.df-hud-head h3 { font-size: 14px; font-weight: 600; margin: 0; color: var(--cc-ink); }
.df-hud-note { font-size: 11px; color: var(--cc-ink-3); text-transform: uppercase; letter-spacing: .06em; }

/* synergy ring */
.df-synergy-card { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.df-synergy { position: relative; width: 140px; height: 140px; }
.df-synergy-svg { width: 140px; height: 140px; transform: rotate(-90deg); }
.df-ring-track { fill: none; stroke: var(--cc-surface-3); stroke-width: 12; }
.df-ring-fill {
  fill: none; stroke: var(--cc-accent); stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 364.4; stroke-dashoffset: 364.4;
  transition: stroke-dashoffset var(--cc-dur-slow) var(--cc-ease-glass), stroke var(--cc-dur) var(--cc-ease);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--cc-accent) 50%, transparent));
}
.df-synergy-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.df-synergy-score { font-size: 38px; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--cc-ink); }
.df-synergy-grade { font-size: 13px; font-weight: 700; color: var(--cc-accent); letter-spacing: .04em; }
.df-synergy-cap { font-size: 12px; color: var(--cc-ink-3); margin: 0; }

/* radar */
.df-radar-wrap { display: grid; place-items: center; }
#df-radar { max-width: 100%; height: auto; }

/* weakness heat strip */
.df-heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 6px; }
.df-heat-cell { border-radius: 8px; padding: 6px 2px 5px; text-align: center; position: relative; transition: transform var(--cc-dur-fast) var(--cc-ease-glass); cursor: default; }
.df-heat-cell:hover { transform: translateY(-2px); }
.df-heat-dot { width: 12px; height: 12px; border-radius: 50%; margin: 0 auto 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.df-heat-n { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--cc-ink); }
.df-heat-lbl { font-size: 8.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--cc-ink-3); }

/* energy curve */
.df-curve { display: flex; align-items: flex-end; gap: 6px; height: 110px; padding-top: 6px; }
.df-curve-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.df-curve-bar { width: 100%; max-width: 30px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--cc-accent), color-mix(in srgb, var(--cc-accent) 55%, transparent)); min-height: 2px; transition: height var(--cc-dur) var(--cc-ease-glass); position: relative; }
.df-curve-bar span { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: var(--cc-ink-2); font-variant-numeric: tabular-nums; }
.df-curve-x { font-size: 10px; color: var(--cc-ink-3); font-variant-numeric: tabular-nums; }

/* signals + matchups */
.df-signals, .df-matchups { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.df-signal { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.4; color: var(--cc-ink-2); padding: 8px 10px; border-radius: var(--cc-r-sm); background: var(--cc-surface-2); border-left: 3px solid var(--cc-ink-mute); animation: df-fade var(--cc-dur) var(--cc-ease) both; }
.df-signal.is-good { border-left-color: var(--cc-success); }
.df-signal.is-bad { border-left-color: var(--cc-warning); }
.df-signal-ic { font-size: 14px; line-height: 1.3; }
.df-signal-empty { font-size: 12.5px; color: var(--cc-ink-3); text-align: center; padding: 12px; }
@keyframes df-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.df-match { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 9px 10px; border-radius: var(--cc-r-sm); background: var(--cc-surface-2); animation: df-fade var(--cc-dur) var(--cc-ease) both; }
.df-match-name { font-size: 13px; font-weight: 600; color: var(--cc-ink); display: flex; align-items: center; gap: 7px; }
.df-match-verdict { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: var(--cc-r-pill); }
.df-match-verdict.fav { background: color-mix(in srgb, var(--cc-success) 18%, transparent); color: var(--cc-success); }
.df-match-verdict.even { background: var(--cc-surface-3); color: var(--cc-ink-2); }
.df-match-verdict.unfav { background: color-mix(in srgb, var(--cc-danger) 16%, transparent); color: var(--cc-danger); }
.df-match-bar { grid-column: 1 / -1; height: 6px; border-radius: var(--cc-r-pill); background: var(--cc-surface-3); overflow: hidden; position: relative; }
.df-match-bar i { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: 2px; background: var(--cc-ink-mute); z-index: 2; }
.df-match-bar b { display: block; height: 100%; border-radius: var(--cc-r-pill); transition: width var(--cc-dur) var(--cc-ease-glass), margin var(--cc-dur) var(--cc-ease-glass); }
.df-match-bar b.fav { background: var(--cc-success); }
.df-match-bar b.even { background: var(--cc-ink-mute); }
.df-match-bar b.unfav { background: var(--cc-danger); }
.df-match-why { grid-column: 1 / -1; font-size: 11px; color: var(--cc-ink-3); }

/* floating card peek */
.df-peek { position: fixed; z-index: 9000; pointer-events: none; transform: translateY(-50%); filter: drop-shadow(0 18px 40px rgba(0,0,0,.4)); transition: opacity 120ms var(--cc-ease); }
.df-peek img { width: 220px; border-radius: 12px; display: block; }

/* loading shimmer for results */
.df-res-skel { height: 74px; border-radius: var(--cc-r-md); background: linear-gradient(100deg, var(--cc-surface-2) 30%, var(--cc-surface-3) 50%, var(--cc-surface-2) 70%); background-size: 200% 100%; animation: df-shimmer 1.2s linear infinite; margin: 8px; }
@keyframes df-shimmer { to { background-position: -200% 0; } }

/* toast-ish inline notice */
.df-flash { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(16px); z-index: 9100; background: var(--cc-ink); color: var(--cc-bg); padding: 10px 18px; border-radius: var(--cc-r-pill); font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity var(--cc-dur) var(--cc-ease), transform var(--cc-dur) var(--cc-ease-glass); box-shadow: var(--cc-shadow-lg); }
.df-flash.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------ reduced motion ----------------------------- */
@media (prefers-reduced-motion: reduce) {
  .df *, .df-slot, .df-ring-fill, .df-curve-bar, .df-mix-seg, .df-match-bar b { animation: none !important; transition: none !important; }
}
