/* Minecraft EXP Calculator, VOL.01 theme.
   Palette + chrome come from theme.css; this sheet styles the app.
   Class names are the contract with minecraft-exp.js. */

/* The site has no global box-sizing reset; scope one here so width:100%
   inputs include their padding/border and stop overflowing their fields. */
#mc-exp, #mc-exp *, #mc-exp *::before, #mc-exp *::after { box-sizing: border-box; }

#mc-exp {
  --card: var(--panel-solid);
  --grass: #6aa84f;
  --grass-2: #7abd6c;
  --xp-mob: #d24b4b;
  --xp-ore: #46c2b8;
  --xp-smelt: #e0913c;
  --xp-other: #7abd6c;
  color: var(--text);
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(10px, 2.2vmin, 22px) 16px 20px;
}

/* ---------- Hero ---------- */
#mc-exp .xp-hero { text-align: center; margin-bottom: clamp(12px, 2.6vmin, 22px); }
#mc-exp .xp-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 5.4vmin, 2.9rem);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ededed;
  text-shadow: -0.7px 0 rgba(255, 0, 70, 0.5), 0.7px 0 rgba(0, 235, 220, 0.45);
}
#mc-exp .lead-answer {
  color: var(--muted);
  font-size: clamp(0.82rem, 1.6vmin, 0.98rem);
  line-height: 1.55;
  max-width: 660px;
  margin: 0 auto;
}

/* ---------- Mode switch ---------- */
#mc-exp .xp-modes {
  display: flex;
  gap: 6px;
  max-width: 460px;
  margin: clamp(14px, 2.8vmin, 22px) auto 0;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
}
#mc-exp .xp-mode-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
#mc-exp .xp-mode-btn:hover { color: var(--text); }
#mc-exp .xp-mode-btn.on {
  background: linear-gradient(135deg, var(--grass), #4f8a3d);
  color: #06120a;
}

#mc-exp .xp-mode { margin-top: clamp(16px, 3vmin, 26px); animation: mt-fade 0.28s ease; }

/* ---------- Inputs ---------- */
#mc-exp .xp-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}
#mc-exp .xp-field {
  flex: 1 1 200px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#mc-exp .xp-field > span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
#mc-exp .xp-field input,
#mc-exp .xp-picker select,
#mc-exp .xp-picker input {
  width: 100%;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
#mc-exp .xp-field input:focus,
#mc-exp .xp-picker select:focus,
#mc-exp .xp-picker input:focus { border-color: var(--grass-2); }

/* ---------- Themed native <select> ----------
   Selector specificity matches the base .xp-picker select rule (and comes
   later) so the custom arrow + padding win over the base `background`/`padding`
   shorthands. */
#mc-exp .xp-picker select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  color-scheme: dark;                 /* dark native option popup */
  cursor: pointer;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237abd6c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 15px;
}
#mc-exp .xp-picker select:hover { border-color: var(--line-hover); }
#mc-exp .xp-picker select option,
#mc-exp .xp-picker select optgroup { background: #0d0d0d; color: var(--text); }
#mc-exp .xp-picker select optgroup { color: var(--grass-2); font-weight: 700; }

/* ---------- Themed number stepper (replaces native spinners) ---------- */
#mc-exp input[type="number"] { -moz-appearance: textfield; }
#mc-exp input[type="number"]::-webkit-outer-spin-button,
#mc-exp input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

#mc-exp .xp-num { position: relative; width: 100%; }
#mc-exp .xp-num > input { width: 100%; padding-right: 44px; }
#mc-exp .xp-stepper {
  position: absolute;
  top: 5px; bottom: 5px; right: 5px;
  width: 32px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;               /* let clicks fall to the buttons */
}
#mc-exp .xp-step {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  transition: background 0.13s ease, color 0.13s ease, border-color 0.13s ease;
}
#mc-exp .xp-step:hover { background: var(--grass); border-color: var(--grass); color: #06120a; }
#mc-exp .xp-step:active { background: #4f8a3d; border-color: #4f8a3d; color: #06120a; }
#mc-exp .xp-step svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Reach-a-level result ---------- */
#mc-exp .xp-result {
  margin: clamp(18px, 3.4vmin, 30px) auto 0;
  max-width: 560px;
  text-align: center;
  background: linear-gradient(160deg, rgba(106, 168, 79, 0.12), rgba(106, 168, 79, 0.02));
  border: 1px solid rgba(122, 189, 108, 0.35);
  border-radius: 16px;
  padding: clamp(18px, 3.4vmin, 28px) 20px;
}
#mc-exp .xp-big {
  font-size: clamp(2.4rem, 8vmin, 3.8rem);
  font-weight: 800;
  line-height: 1;
  color: #f2f2f2;
  letter-spacing: -0.01em;
}
#mc-exp .xp-big small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--grass-2);
}
#mc-exp .xp-result-sub {
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
}
#mc-exp .xp-result-sub b { color: var(--text); }

/* ---------- Collapsible sections (Ways / How / Curve / Reference) ----------
   Clean divider-separated rows (like the FAQ accordion), not boxed cards. */
#mc-exp .xp-sec {
  max-width: 720px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
#mc-exp .xp-sec:first-of-type {
  margin-top: clamp(20px, 3.6vmin, 30px);
  border-top: 1px solid var(--line);
}
#mc-exp .xp-sec-head {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding: 16px 2px;
  user-select: none;
}
#mc-exp .xp-sec-head::-webkit-details-marker { display: none; }
#mc-exp .xp-sec-title {
  margin-right: auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grass-2);
  transition: color 0.15s ease;
}
#mc-exp .xp-sec-title b { color: #fff; }
#mc-exp .xp-sec-head:hover .xp-sec-title { color: #a6dd93; }
#mc-exp .xp-chev {
  flex: none;
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
#mc-exp .xp-sec[open] .xp-chev { transform: rotate(-135deg); }
#mc-exp .xp-sec-head:hover .xp-chev { border-color: var(--grass-2); }
#mc-exp .xp-sec-body { padding: 0 2px 20px; }
#mc-exp .xp-sec[open] .xp-sec-body { animation: mt-fade 0.24s ease; }
@media (prefers-reduced-motion: reduce) {
  #mc-exp .xp-sec[open] .xp-sec-body { animation: none; }
  #mc-exp .xp-chev { transition: none; }
}

/* ---------- Breakdown ---------- */
#mc-exp .xp-breakdown {
  margin-top: 18px;
  padding-top: 4px;
  text-align: left;
  border-top: 1px solid var(--line);
}
#mc-exp .xp-bd-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 2px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
}
#mc-exp .xp-bd-row span:last-child { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
#mc-exp .xp-bd-row b { color: var(--grass-2); font-weight: 700; }
#mc-exp .xp-bd-total {
  border-bottom: none;
  margin-top: 4px;
  padding-top: 11px;
  border-top: 2px solid rgba(122, 189, 108, 0.4);
  font-size: 14px;
}
#mc-exp .xp-bd-total span { color: #f2f2f2 !important; font-weight: 800 !important; }

/* ---------- Shared info panel (how-it-works / curve / reference) ---------- */
#mc-exp .xp-panel {
  max-width: 720px;
  margin: clamp(20px, 3.6vmin, 30px) auto 0;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(16px, 2.6vmin, 22px);
}
#mc-exp .xp-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
#mc-exp .xp-panel-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grass-2);
}
#mc-exp .xp-panel-head .xp-panel-title { margin: 0; }
#mc-exp .xp-panel-lead { margin: 0 0 14px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
#mc-exp .xp-panel-foot { margin: 14px 0 0; font-size: 12.5px; line-height: 1.65; color: var(--muted); }
#mc-exp .xp-panel-foot em, #mc-exp .xp-panel-lead em { color: var(--text); font-style: normal; font-weight: 600; }

/* formulas */
#mc-exp .xp-formulas { display: flex; flex-direction: column; gap: 8px; }
#mc-exp .xp-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-left: 3px solid var(--grass);
  border-radius: 8px;
}
#mc-exp .xp-formula span { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
#mc-exp .xp-formula code {
  font-family: "JetBrains Mono", ui-monospace, "Consolas", monospace;
  font-size: 13px;
  color: #ededed;
}

/* legend (sits in the summary, before the chevron) */
#mc-exp .xp-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
#mc-exp .xp-lg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
#mc-exp .xp-lg::before { content: ""; width: 10px; height: 10px; border-radius: 50%; }
#mc-exp .xp-lg-line::before { background: var(--grass); }
#mc-exp .xp-lg-from::before { background: #ece7d6; }
#mc-exp .xp-lg-to::before { background: #f2b64a; }

/* filter chips now sit above the source grid inside the collapsible body */
#mc-exp .xp-sec-body > .xp-filter { margin-bottom: 14px; }

/* chart */
#mc-exp .xp-chart-wrap { position: relative; width: 100%; height: 240px; }
#mc-exp .xp-chart-wrap canvas { display: block; width: 100%; height: 240px; touch-action: none; }

/* hover tooltip on the curve */
#mc-exp .xp-tip {
  position: absolute;
  left: 0; top: 0;
  transform: translate(-50%, calc(-100% - 14px));
  padding: 7px 10px;
  background: #0b0b0b;
  border: 1px solid rgba(122, 189, 108, 0.5);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  text-align: center;
  z-index: 3;
}
#mc-exp .xp-tip b { display: block; font-size: 12px; color: #fff; letter-spacing: 0.02em; }
#mc-exp .xp-tip span { display: block; margin-top: 1px; font-size: 12px; font-weight: 700; color: var(--grass-2); font-variant-numeric: tabular-nums; }
#mc-exp .xp-tip::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px;
  background: #0b0b0b; border-right: 1px solid rgba(122, 189, 108, 0.5); border-bottom: 1px solid rgba(122, 189, 108, 0.5);
  transform: translateX(-50%) rotate(45deg);
}

/* quick-reference table */
#mc-exp .xp-ref-scroll {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
#mc-exp .xp-ref-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#mc-exp .xp-ref-table th,
#mc-exp .xp-ref-table td {
  text-align: right;
  padding: 8px 14px;
  font-variant-numeric: tabular-nums;
}
#mc-exp .xp-ref-table th:first-child,
#mc-exp .xp-ref-table td:first-child { text-align: left; }
#mc-exp .xp-ref-table thead th {
  position: sticky;
  top: 0;
  background: #121212;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
#mc-exp .xp-ref-table tbody td { color: var(--text); border-bottom: 1px solid rgba(255, 255, 255, 0.045); }
#mc-exp .xp-ref-table tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }
#mc-exp .xp-ref-table tr.xp-ref-from td { background: rgba(236, 231, 214, 0.14); color: #fff; }
#mc-exp .xp-ref-table tr.xp-ref-to td { background: rgba(242, 182, 74, 0.16); color: #fff; }
#mc-exp .xp-ref-table tr.xp-ref-from td:first-child { box-shadow: inset 3px 0 0 #ece7d6; }
#mc-exp .xp-ref-table tr.xp-ref-to td:first-child { box-shadow: inset 3px 0 0 #f2b64a; }

/* ---------- Ways to earn ---------- */
#mc-exp .xp-ways { margin-top: clamp(22px, 4vmin, 34px); }
#mc-exp .xp-ways-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}
#mc-exp .xp-ways-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #ededed;
}
#mc-exp .xp-ways-head h3 b { color: var(--grass-2); }
#mc-exp .xp-filter { display: flex; flex-wrap: wrap; gap: 6px; }
#mc-exp .xp-chip {
  border: 1px solid var(--line);
  background: var(--tile);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
#mc-exp .xp-chip:hover { color: var(--text); border-color: var(--line-hover); }
#mc-exp .xp-chip.on {
  background: var(--grass);
  border-color: var(--grass);
  color: #06120a;
}

#mc-exp .xp-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 10px;
}
#mc-exp .xp-src {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: var(--tile);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
}
#mc-exp .xp-src-mob   { border-left-color: var(--xp-mob); }
#mc-exp .xp-src-ore   { border-left-color: var(--xp-ore); }
#mc-exp .xp-src-smelt { border-left-color: var(--xp-smelt); }
#mc-exp .xp-src-other { border-left-color: var(--xp-other); }
#mc-exp .xp-src-ic {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  overflow: hidden;
}
#mc-exp .xp-src-ic img {
  width: 32px; height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
/* mob renders are tall; let them fill more of the tile */
#mc-exp .xp-src-mob .xp-src-ic img { width: 34px; height: 34px; }
#mc-exp .xp-src-ic img.mc-icon-missing { opacity: 0.5; }
#mc-exp .xp-src-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#mc-exp .xp-src-count {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f2f2f2;
  letter-spacing: -0.01em;
}
#mc-exp .xp-src-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
#mc-exp .xp-src-per { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ---------- XP-to-levels ---------- */
#mc-exp .xp-picker {
  margin: clamp(16px, 3vmin, 24px) auto 0;
  max-width: 560px;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
#mc-exp .xp-picker-title {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
#mc-exp .xp-picker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
#mc-exp .xp-picker-row select { flex: 1 1 200px; }
#mc-exp .xp-picker-row .xp-num {
  flex: none;
  width: 118px;
}
#mc-exp .xp-src-xp {
  font-size: 13px;
  font-weight: 700;
  color: var(--grass-2);
  white-space: nowrap;
}
#mc-exp .xp-add {
  flex: none;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--grass), #4f8a3d);
  color: #06120a;
  font-weight: 700;
  font-size: 13px;
  padding: 11px 16px;
  cursor: pointer;
  transition: filter 0.15s ease;
}
#mc-exp .xp-add:hover { filter: brightness(1.08); }

/* level bar */
#mc-exp .xp-levelcard {
  margin: clamp(18px, 3.4vmin, 28px) auto 0;
  max-width: 560px;
  text-align: center;
  background: linear-gradient(160deg, rgba(106, 168, 79, 0.12), rgba(106, 168, 79, 0.02));
  border: 1px solid rgba(122, 189, 108, 0.35);
  border-radius: 16px;
  padding: clamp(18px, 3.4vmin, 28px) 20px;
}
#mc-exp .xp-endlevel {
  font-size: clamp(2.6rem, 9vmin, 4.2rem);
  font-weight: 800;
  line-height: 1;
  color: var(--grass-2);
  text-shadow: 0 0 22px rgba(106, 168, 79, 0.35);
}
#mc-exp .xp-endlevel small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
#mc-exp .xp-end-gained { margin: 12px 0 0; font-size: 14px; color: var(--text); }
#mc-exp .xp-bar {
  position: relative;
  height: 16px;
  margin: 18px auto 6px;
  max-width: 420px;
  background: #05100a;
  border: 1px solid rgba(122, 189, 108, 0.4);
  border-radius: 999px;
  overflow: hidden;
}
#mc-exp .xp-bar-fill {
  position: absolute; inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, #4f8a3d, #7abd6c);
  transition: width 0.35s ease;
}
#mc-exp .xp-bar-text { font-size: 11.5px; color: var(--muted); }

@media (max-width: 480px) {
  #mc-exp .xp-picker-row .xp-num { width: 100%; flex: 1 1 100%; }
  #mc-exp .xp-add { flex: 1 1 100%; }
}
