/* Dragon Energy Finder — page-specific styles. shared stuff lives in /style.css */

.tool-hero { margin-bottom: 1.75rem; }
.tool-hero .kicker a { color: var(--accent); }
.tool-hero .lede { color: var(--muted); max-width: 62ch; margin-top: 0.75rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}
.hint { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 400; }
.control-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.control-block { min-width: 0; }
.control-block.grow { flex: 1 1 200px; }
.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

/* energy buttons */
.energy-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.energy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font: 500 14px var(--sans);
  cursor: pointer;
  transition: border-color .12s, background .12s, opacity .12s;
}
.energy-btn:hover { border-color: var(--line-hover); }
.energy-btn[aria-pressed="true"] {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 22%, var(--bg));
}
.energy-btn .pip { box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }

/* segmented controls */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button {
  background: var(--bg);
  color: var(--muted);
  border: 0;
  border-right: 1px solid var(--line-strong);
  padding: 7px 12px;
  font: 500 13px var(--sans);
  cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent-dim); color: #fff; }
.seg button:hover:not([aria-pressed="true"]) { background: var(--surface2); }
.seg.small button { padding: 5px 10px; font-size: 12px; }

input[type="search"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  font: 15px var(--sans);
  padding: 7px 12px;
}
input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.ghost-btn {
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 14px;
  font: 500 13px var(--sans);
  cursor: pointer;
}
.ghost-btn:hover { color: var(--text); border-color: var(--line-hover); }

/* pairing chart */
.matrix-panel summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}
.matrix-panel summary .hint { margin-left: 0.5rem; }
.matrix-scroll { overflow-x: auto; margin-top: 1rem; }
.matrix {
  display: grid;
  grid-template-columns: 34px repeat(9, minmax(34px, 1fr));
  gap: 3px;
  min-width: 360px;
  max-width: 560px;
}
.matrix .mx-head { display: grid; place-items: center; height: 30px; }
.matrix .mx-cell {
  aspect-ratio: 1;
  border: 0;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) calc(var(--t) * 100%), var(--surface));
  color: #fff;
  font: 700 12px var(--mono);
  cursor: pointer;
  padding: 0;
}
.matrix .mx-cell.zero { background: var(--surface); color: var(--line-strong); cursor: default; }
.matrix .mx-cell.empty { background: transparent; cursor: default; }
.matrix .mx-cell.diag { outline: 1px dashed var(--line-strong); outline-offset: -1px; }
.matrix .mx-cell:not(.zero):not(.empty):hover { outline: 2px solid #fff; outline-offset: -2px; }
.matrix .mx-cell.on { outline: 2px solid #fff; outline-offset: -2px; }

/* results */
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.75rem 0 1rem;
}
.summary { font-size: 15px; color: var(--muted); }
.summary strong { color: var(--text); font-weight: 600; }
.summary .pip { width: 18px; height: 18px; font-size: 10px; vertical-align: -3px; margin: 0 1px; }

.mon-list { display: flex; flex-direction: column; gap: 8px; }
.mon {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.mon > summary {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.8rem 1rem;
  cursor: pointer;
}
.mon > summary::-webkit-details-marker { display: none; }
.mon > summary:hover { background: var(--surface2); }
.mon[open] > summary { border-bottom: 1px solid var(--line); }
.mon-name { font-weight: 600; font-size: 1.02rem; }
.mon-name small { font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }
.mon-combos { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.combo {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px 3px 4px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  font: 12px var(--mono);
  color: var(--muted);
}
.combo.match { border-color: var(--accent); color: var(--text); }
.combo .pip { width: 18px; height: 18px; font-size: 10px; box-shadow: none; }
.combo .n { margin-left: 3px; }
.combo.none { padding-left: 8px; }
@media (max-width: 560px) {
  .mon > summary { grid-template-columns: 1fr; }
  .mon-combos { justify-content: flex-start; }
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  padding: 1rem;
}
.results > .card-grid { padding: 0; }
.dcard { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dcard button {
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  border-radius: 7px;
}
.dcard img, .dcard .img-fallback {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border-radius: 7px;
  display: block;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  transition: transform .15s;
}
.dcard button:hover img { transform: translateY(-3px); }
.dcard .img-fallback {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
  border: 1px dashed var(--line-strong);
  font: 12px var(--mono);
  color: var(--muted);
}
.dcard-name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.dcard-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font: 11px var(--mono); color: var(--muted); }
.dcard-meta .pip { width: 16px; height: 16px; font-size: 9px; box-shadow: none; }
.dcard-meta .leg { margin-left: auto; color: var(--accent); }

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}
.more-btn { display: block; margin: 1rem auto 0; }

/* layout: filters + chart side by side on wide screens */
.tool-hero h1 { max-width: none; }
.tool-top { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.tool-top .panel { margin-bottom: 0; }
@media (min-width: 960px) {
  .tool-top { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
}
.matrix { grid-template-columns: 24px repeat(9, minmax(26px, 1fr)); min-width: 290px; max-width: 100%; }
.matrix .mx-head { height: 24px; }
.matrix .mx-head .pip { width: 18px; height: 18px; font-size: 9px; box-shadow: none; }
.matrix .mx-cell { display: grid; place-items: center; font-size: 11px; }

/* show the whole card, never crop */
.card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.dcard img {
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 4.5% / 3.2%;
  background: none;
}
.dcard .img-fallback { aspect-ratio: 5 / 7; height: auto; }
.dcard-prints { font: 11px var(--mono); color: var(--muted); opacity: .75; }

/* regulation mark / era badge on each card */
.dcard-meta .mark {
  margin-left: auto;
  font: 700 11px var(--mono);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid currentColor;
}
.dcard-meta .mark.ok  { color: var(--green); background: rgba(79, 209, 122, .1); }
.dcard-meta .mark.out { color: var(--red); background: rgba(255, 74, 74, .1); }
.energy-btn[hidden] { display: none; }

/* "+N other printings" button + the row it opens */
.dcard .prints-btn {
  align-self: flex-start;
  background: none;
  border: 0;
  padding: 0;
  font: 11px var(--mono);
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.dcard .prints-btn:hover, .dcard .prints-btn[aria-expanded="true"] { color: var(--accent-hover); }
.dcard.expanded .zoom img { outline: 2px solid var(--accent); outline-offset: 3px; }

.prints-panel {
  grid-column: 1 / -1;
  background: var(--bg);
  border: 1px solid var(--accent-dim);
  border-radius: 10px;
  padding: 0.9rem 1rem 1rem;
  animation: prints-in .15s ease-out;
}
@keyframes prints-in { from { opacity: 0; transform: translateY(-4px); } }
.prints-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-size: 14px; color: var(--muted); margin-bottom: 0.75rem;
}
.prints-head strong { color: var(--text); font-weight: 600; }
.prints-close {
  background: none; border: 0; color: var(--muted); font-size: 1.4rem; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.prints-close:hover { color: var(--text); }
.prints-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.pcard { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pcard .zoom { padding: 0; border: 0; background: none; cursor: zoom-in; }
.pcard img { width: 100%; height: auto; display: block; border-radius: 4.5% / 3.2%; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.pcard .img-fallback { aspect-ratio: 5 / 7; display: grid; place-items: center; text-align: center; padding: 8px; border: 1px dashed var(--line-strong); border-radius: 7px; font: 11px var(--mono); color: var(--muted); }
