:root {
  --bg: #F7F4EB;
  --card: #FFFDF8;
  --ink: #111111;
  --muted: #5a554e;
  --line: #000000;
  --purple: #A855F7;
  --green: #70FF00;
  --cyan: #00F0FF;
  --red: #FF4B4B;
  --dark: #2C272E;
  --row-a: #FFFFFF;
  --row-b: #F1ECDD;
  --shadow: 4px 4px 0 #000;
  --border: 3px solid #000;
}

[data-theme="dark"] {
  --bg: #1d1a20;
  --card: #2C272E;
  --ink: #F5F1E8;
  --muted: #B9B2A8;
  --line: #000000;
  --row-a: #2C272E;
  --row-b: #352f38;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(rgba(0, 0, 0, 0.12) 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  font: 400 17px/1.7 "Space Grotesk", system-ui, sans-serif;
}

h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 {
  font-family: "Silkscreen", monospace;
  font-weight: 400;
  font-size: clamp(1.6rem, 4.6vw, 2.7rem);
  line-height: 1.35;
  max-width: 22ch;
  margin-bottom: 20px;
}
h2 { font-family: "Silkscreen", monospace; font-weight: 400; font-size: 1.4rem; margin-bottom: 16px; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 12px; max-width: 72ch; }
ul { margin: 0; padding: 0; list-style: none; }
b { font-weight: 700; }
a { color: inherit; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
section { padding: 40px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  font: 700 15px "Space Grotesk", sans-serif;
  color: #000;
  text-decoration: none;
  background: var(--card);
  border: var(--border);
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
}
.btn:hover { background: #fff; }
.btn:active { transform: translate(4px, 4px); box-shadow: none; }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: #b875f9; }
.btn-block { width: 100%; margin-top: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--dark);
  color: #fff;
  border-bottom: var(--border);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.brand { font-family: "Silkscreen", monospace; color: var(--green); text-decoration: none; font-size: 16px; }
.brand-sub { color: #fff; font-family: "Space Grotesk", sans-serif; font-size: 13px; margin-left: 8px; opacity: 0.8; }
.menu { display: flex; flex-wrap: wrap; gap: 4px; }
.menu a { color: #fff; text-decoration: none; font-size: 14px; font-weight: 500; padding: 6px 10px; border: 2px solid transparent; }
.menu a:hover { border-color: var(--cyan); color: var(--cyan); }
.lang-picker select {
  min-height: 40px;
  padding: 6px 10px;
  font: 500 14px "Space Grotesk", sans-serif;
  color: #000;
  background: #fff;
  border: var(--border);
  border-radius: 0;
  max-width: 220px;
}

/* ---------- Hero ---------- */
.hero { padding-top: 56px; padding-bottom: 32px; }
.eyebrow { font-weight: 500; color: var(--muted); margin-bottom: 10px; }
.badges { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 24px; }
.badge {
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 700;
  color: #000;
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  background: var(--card);
}
.badge-green { background: var(--green); }
.badge-cyan { background: var(--cyan); }
.badge-purple { background: var(--purple); color: #fff; }

/* ---------- Panels (About) ---------- */
.panel {
  background: var(--card);
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  margin-bottom: 18px;
}
.panel summary {
  cursor: pointer;
  font-family: "Silkscreen", monospace;
  font-size: 15px;
  padding: 4px 0;
}
.panel p { margin-top: 12px; }
.panel a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 22px;
  min-width: 0;
}
.card-head {
  font-family: "Silkscreen", monospace;
  font-size: 13px;
  color: #000;
  background: var(--green);
  margin: -22px -22px 18px;
  padding: 10px 14px;
  border-bottom: var(--border);
}
.section-title { margin-bottom: 16px; }

/* ---------- Calculator ---------- */
.calc-grid { display: grid; gap: 24px; }
.select-item {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  font: 500 16px "Space Grotesk", sans-serif;
  color: #000;
  background: #fff;
  border: var(--border);
  border-radius: 0;
}

.table-wrap { overflow-x: auto; margin: 18px 0 14px; border: var(--border); }
#enchants table { width: 100%; border-collapse: collapse; background: var(--row-a); }
#enchants td { padding: 8px 10px; border-bottom: 2px solid #000; vertical-align: middle; }
#enchants tr.group1 td { background: var(--row-a); }
#enchants tr.group2 td { background: var(--row-b); }
#enchants td:first-child { font-weight: 500; white-space: nowrap; min-width: 160px; }
#enchants td:not(:first-child) { text-align: center; }

button.level-button {
  min-width: 42px;
  min-height: 40px;
  padding: 6px 10px;
  font: 700 15px "Space Grotesk", sans-serif;
  color: var(--ink);
  background: var(--card);
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
}
button.level-button:active { transform: translate(2px, 2px); box-shadow: none; }
button.level-button.on { background: var(--green); color: #000; }
button.level-button.off { background: var(--card); color: var(--ink); }

.overrides { display: grid; gap: 10px; margin-bottom: 16px; }
.check, .radio { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; }
.check input, .radio input { width: 20px; height: 20px; margin: 0; accent-color: var(--purple); flex-shrink: 0; }

.mode { border: 2px dashed #000; padding: 12px 14px; margin: 0 0 18px; display: grid; gap: 8px; }
.mode legend { font-weight: 700; padding: 0 6px; }

.notice { border: var(--border); background: #FFE6C7; padding: 12px 14px; margin: 14px 0; font-weight: 500; color: #111; }
.lbl { display: block; }

.result-title { font-size: 1.05rem; margin-bottom: 8px; }
.cost { font-size: 17px; margin: 8px 0 14px; }
.steps-title { margin: 14px 0 8px; font-family: "Silkscreen", monospace; font-size: 14px; font-weight: 400; }
.steps { padding-left: 22px; list-style: decimal; }
.steps li { margin-bottom: 10px; }
.steps small { color: var(--muted); }
/* Item icons are not in the upload, so hide the broken image slots */
img.icon { display: none; }

/* ---------- Contact ---------- */
.contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 2px dashed #000;
}
.contact-label { font-size: 14px; color: var(--muted); margin: 0; }
.contact-value { font-weight: 700; font-size: 18px; margin: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--dark); color: #fff; border-top: var(--border); padding: 26px 0; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.footer-inner p { margin: 0; font-size: 15px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.footer-links a:not(.btn) { color: #fff; }
.footer .btn { background: var(--cyan); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 12px 18px;
  font-weight: 700;
  color: #000;
  background: var(--green);
  border: var(--border);
  box-shadow: 4px 4px 0 #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  white-space: nowrap;
  z-index: 100;
}
.toast.show { opacity: 1; }

/* ---------- Responsive ---------- */
@media (min-width: 900px) {
  .calc-grid { grid-template-columns: 1.25fr 1fr; align-items: start; }
  .hero { padding-top: 72px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .card { padding: 18px; }
  .card-head { margin: -18px -18px 16px; }
  .panel { padding: 16px; }
  .btn { min-height: 48px; }
  .btn-sm { min-height: 44px; }
  button.level-button { min-width: 44px; min-height: 44px; }
  #enchants td:first-child { white-space: normal; min-width: 120px; line-height: 1.35; }
  #enchants td { padding: 8px 6px; }
  .header-inner { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .toast { transition: none; }
}
