:root {
  --bg: #0B1220;
  --surface: #111C33;
  --elevated: #16233E;
  --border: #1E293B;
  --text: #F8FAFC;
  --muted: #94A3B8;
  --accent: #38BDF8;
  --cta: #0369A1;
  --cta-hover: #075985;
  --r-common: #94A3B8;
  --r-uncommon: #22C55E;
  --r-rare: #38BDF8;
  --r-epic: #A855F7;
  --r-legendary: #F59E0B;
  --r-divine: #EC4899;
  --r-secret: #F43F5E;
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}
img, canvas, svg { max-width: 100%; display: block; }
a { color: var(--accent); }
a:hover { color: #7DD3FC; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container { padding: 0 24px; } }

.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--cta); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

.site-header { position: sticky; top: 0; z-index: 50; background: rgba(11, 18, 32, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; min-height: 44px; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-mark { font-size: 22px; }
.brand-accent { color: var(--accent); }
.site-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.site-nav a:hover { color: var(--text); background: var(--elevated); }

.sim-hero { padding: 10px 0 24px; background: radial-gradient(120% 60% at 50% 0%, #10264A 0%, var(--bg) 70%); }
.sim-head h1, .page-head h1 { font-size: 28px; line-height: 1.2; margin: 8px 0; letter-spacing: -.01em; }
.lead { color: var(--muted); font-size: 16px; margin: 0 0 16px; max-width: 70ch; }
@media (min-width: 768px) {
  .sim-head h1, .page-head h1 { font-size: 36px; }
  .lead { font-size: 18px; }
}

.sim-app { display: grid; gap: 12px; }
.sim-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 768px) { .sim-stats { grid-template-columns: 1fr 1fr 1.3fr 2fr; } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; min-width: 0; }
.stat-wide { grid-column: 1 / -1; }
@media (min-width: 768px) { .stat-wide { grid-column: auto; } }
.stat-label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { display: block; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

.sim-stage { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #0A1B36; box-shadow: var(--shadow-2); }
#sim-canvas { width: 100%; aspect-ratio: 16 / 9; max-height: 250px; height: auto; touch-action: manipulation; cursor: pointer; }
.sim-toast { position: absolute; left: 8px; right: 8px; bottom: 8px; margin: 0; padding: 8px 12px; border-radius: 8px; background: rgba(11, 18, 32, .78); color: var(--text); font-size: 14px; text-align: center; pointer-events: none; }

.meter-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.meter-label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
#meter-text { font-weight: 800; letter-spacing: .06em; color: var(--accent); }
.meter-label.is-perfect #meter-text { color: var(--r-legendary); }
.meter-hint { font-size: 12px; color: var(--muted); }
.meter { position: relative; height: 28px; border-radius: 999px; background: linear-gradient(90deg, #3B1220 0%, #3B2A12 30%, #12351F 42%, #12351F 58%, #3B2A12 70%, #3B1220 100%); border: 1px solid var(--border); overflow: hidden; cursor: pointer; }
.meter-zone { position: absolute; top: 0; bottom: 0; left: 42%; width: 16%; background: linear-gradient(90deg, #22C55E, #F59E0B 50%, #22C55E); opacity: .9; display: flex; align-items: center; justify-content: center; }
.meter-zone span { font-size: 12px; font-weight: 800; color: #0B1220; letter-spacing: .04em; white-space: nowrap; }
.meter-needle { position: absolute; top: -2px; bottom: -2px; left: 0; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 8px #fff; border-radius: 2px; will-change: transform; }

.sim-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 640px) { .sim-actions { grid-template-columns: 1fr 1fr; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; transition: background-color .15s, transform .05s, border-color .15s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--cta); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--cta-hover); }
.btn-cast.is-aiming { background: var(--r-legendary); color: #0B1220; }
.btn-demo { background: var(--elevated); color: var(--text); border-color: var(--accent); }
.btn-demo:hover:not(:disabled) { background: #1B2C4D; }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--border); min-height: 44px; font-size: 14px; }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); }
.btn-block { width: 100%; }

.sim-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 860px) { .sim-grid { grid-template-columns: 1fr 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.panel-title { font-size: 18px; margin: 0 0 12px; line-height: 1.2; }

.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
select { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--elevated); color: var(--text); font: inherit; font-size: 16px; }
#rod-buy-btn { margin: -4px 0 12px; }

.toggle { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-ui { flex: none; width: 44px; height: 24px; border-radius: 999px; background: var(--border); position: relative; transition: background-color .15s; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .15s, background-color .15s; }
.toggle input:checked + .toggle-ui { background: var(--cta); }
.toggle input:checked + .toggle-ui::after { transform: translateX(20px); background: #fff; }
.toggle input:focus-visible + .toggle-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

.odds { background: var(--elevated); border-radius: 8px; padding: 12px; }
.odds-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.odds-row:last-of-type { border-bottom: 0; }
.odds-row span { color: var(--muted); }
.odds-row strong { font-variant-numeric: tabular-nums; text-align: right; }
.odds-row.r-secret strong { color: var(--r-secret); }
.odds-row.r-divine strong { color: var(--r-divine); }
.odds-row.r-legendary strong { color: var(--r-legendary); }
.odds-row.r-epic strong { color: var(--r-epic); }
.odds-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.catch-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 360px; overflow-y: auto; }
.feed-empty { color: var(--muted); font-size: 14px; }
.feed-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; background: var(--elevated); border-left: 4px solid var(--rc, var(--r-common)); animation: feedIn .3s ease-out; }
.feed-emoji { font-size: 24px; text-align: center; line-height: 1; }
.feed-main { min-width: 0; }
.feed-name { display: block; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-meta { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12px; color: var(--muted); }
.feed-value { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--r-uncommon); }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 800; letter-spacing: .03em; color: #0B1220; background: var(--rc, var(--r-common)); }
.tag-demo { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
@keyframes feedIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.index-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.index-head .panel-title { margin: 0; }
.btn-reset { min-height: 44px; padding: 0 12px; background: transparent; border: 0; color: var(--muted); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
.btn-reset:hover { color: var(--r-secret); }
.index-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .index-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.index-cell { background: var(--elevated); border: 1px solid var(--border); border-top: 3px solid var(--rc, var(--r-common)); border-radius: 8px; padding: 8px 4px; text-align: center; min-height: 84px; min-width: 0; }
.index-cell.is-locked { opacity: .5; border-top-color: var(--border); }
.index-emoji { font-size: 26px; line-height: 1.2; }
.index-name { display: block; font-size: 12px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.index-rarity { display: block; font-size: 12px; color: var(--rc, var(--muted)); font-weight: 700; }
.index-cell.is-new { animation: pop .6s ease-out; }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.08); } 100% { transform: none; } }
.mutation-key { margin: 12px 0 0; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mut { padding: 0 6px; border-radius: 4px; font-weight: 700; font-size: 12px; border: 1px solid currentColor; }
.m-shiny { color: #E2E8F0; }
.m-golden { color: #FACC15; }
.m-abyssal { color: #818CF8; }
.m-rainbow { color: #F472B6; }

.rc-common { --rc: var(--r-common); }
.rc-uncommon { --rc: var(--r-uncommon); }
.rc-rare { --rc: var(--r-rare); }
.rc-epic { --rc: var(--r-epic); }
.rc-legendary { --rc: var(--r-legendary); }
.rc-divine { --rc: var(--r-divine); }
.rc-secret { --rc: var(--r-secret); }

.page-wrap { padding: 16px 16px 48px; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--muted); padding-top: 8px; }
.breadcrumb a { color: var(--muted); }
.page-head { margin-bottom: 24px; }
.prose { padding: 24px 0 16px; max-width: 760px; }
.prose > * { max-width: 70ch; }
.prose h2 { font-size: 22px; line-height: 1.2; margin: 40px 0 12px; }
.prose h3 { font-size: 18px; line-height: 1.2; margin: 28px 0 8px; }
.prose p, .prose li { color: #CBD5E1; }
.prose strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin: 4px 0; }
.prose code { font-family: var(--mono); background: var(--elevated); padding: 2px 6px; border-radius: 4px; font-size: .9em; }
.prose blockquote { margin: 16px 0; padding: 8px 16px; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 8px 8px 0; }
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); margin: 16px 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose > table { display: block; overflow-x: auto; max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius); margin: 16px 0; }
.table-wrap table { min-width: 520px; }
.prose th, .prose td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { background: var(--elevated); color: var(--text); font-weight: 700; white-space: nowrap; }
.prose tr:nth-child(even) td { background: rgba(17, 28, 51, .6); }
.prose tr:last-child td { border-bottom: 0; }

.copy-code-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 88px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.copy-code-btn:hover { background: var(--cta); color: #fff; border-color: var(--cta); }
.copy-code-btn.is-copied { background: var(--r-uncommon); border-color: var(--r-uncommon); color: #0B1220; }

.related-tools { margin: 24px 0 32px; }
.related-tools h2 { font-size: 22px; margin: 0 0 12px; }
.related-list { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .related-list { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
.related-card { display: flex; align-items: center; gap: 12px; padding: 16px; min-height: 64px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s, background-color .15s; }
.related-card:hover { border-color: var(--accent); background: var(--elevated); color: var(--text); }
.related-card small { display: block; color: var(--muted); font-size: 14px; }
.related-emoji { font-size: 28px; flex: none; }

.site-footer { border-top: 1px solid var(--border); background: #080E1A; padding: 32px 0 16px; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 1.6fr 1fr; } }
.brand-sm { font-size: 16px; min-height: 44px; }
.footer-disclaimer { color: var(--muted); font-size: 14px; margin: 8px 0 0; max-width: 60ch; overflow-wrap: anywhere; }
.footer-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.footer-nav a { display: flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; font-size: 14px; }
.footer-nav a:hover { color: var(--text); }
.footer-bottom { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

@media (max-width: 640px) {
  .brand-name { font-size: 16px; }
  .site-nav a { padding: 0 8px; font-size: 13px; }
  .btn { width: 100%; }
  .copy-code-btn { width: auto; }
}
@media (max-width: 380px) {
  .brand-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}