:root {
  --bg: #0e0c1a;
  --panel: #1a1730cc;
  --panel-2: #24203f;
  --line: #342e5a;
  --text: #f0eeff;
  --muted: #a9a3cc;
  --accent: #8f74ff;
  --accent-2: #5fd0ff;
  --accent-grad: linear-gradient(135deg, #a07cff 0%, #7c5cff 50%, #4f8dff 100%);
  --shadow: 0 10px 30px -12px #0009, 0 1px 0 #ffffff0a inset;
  --good: #4fd18b;
  --warn: #ffbf47;
  --bad: #ff5f6d;
  --radius: 18px;

  --t-normal: #9fa19f; --t-fighting: #ff8000; --t-flying: #81b9ef; --t-poison: #9141cb;
  --t-ground: #915121; --t-rock: #afa981; --t-bug: #91a119; --t-ghost: #704170;
  --t-steel: #60a1b8; --t-fire: #e62829; --t-water: #2980ef; --t-grass: #3fa129;
  --t-electric: #fac000; --t-psychic: #ef4179; --t-ice: #3dcef3; --t-dragon: #5060e1;
  --t-dark: #624d4e; --t-fairy: #ef70ef;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 15% -10%, #4b2fa833, transparent 70%),
    radial-gradient(700px 420px at 100% 0%, #1f7bd022, transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main, .top, footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

.top { padding-top: max(22px, env(safe-area-inset-top)); padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 6px 20px -6px #7c5cffaa; }
h1 {
  margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em;
  background: linear-gradient(90deg, #ffffff 0%, #d9ccff 55%, #9fdcff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { margin: 2px 0 0; color: var(--muted); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }

h2 { margin: 0 0 14px; font-size: 1.08rem; font-weight: 700; letter-spacing: -.005em; }
h3 { margin: 18px 0 8px; font-size: .95rem; }

.panel {
  background: linear-gradient(180deg, #ffffff08, #ffffff00 40%), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 14px 0;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: rise .25s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } * { transition: none !important; } }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }

main { counter-reset: step; }
/* Numbers come from a counter so hidden steps (e.g. a raid with a fixed Tera type) never leave a gap. */
.step { display: flex; align-items: center; gap: 10px; counter-increment: step; }
.step span::before { content: counter(step); }
.step span {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 9px;
  background: var(--accent-grad); color: #fff; font-size: .82rem; font-weight: 800;
  box-shadow: 0 4px 12px -4px #7c5cffcc;
}

button { font: inherit; color: inherit; cursor: pointer; transition: background-color .15s, border-color .15s, transform .1s, box-shadow .15s; }
button:active:not(:disabled) { transform: scale(.97); }
button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.stars { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.stars button, .segmented button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  min-height: 38px;
  font-weight: 600;
}
.stars button:hover:not(:disabled):not([aria-pressed="true"]),
.segmented button:hover:not([aria-pressed="true"]) { border-color: #5a4f95; background: #2c2750; }
.stars button[aria-pressed="true"], .segmented button[aria-pressed="true"] {
  background: var(--accent-grad); border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px -6px #7c5cffdd;
}
.stars button:disabled { opacity: .35; cursor: default; }

.segmented { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: #00000033; border: 1px solid var(--line); border-radius: 999px; }
.segmented button { border-color: transparent; background: transparent; }
.segmented button { flex: 1; min-width: 56px; }
.segmented.small button { flex: none; padding: 4px 12px; min-height: 32px; font-size: .85rem; }

.search { position: relative; }
.search input {
  width: 100%;
  background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23a9a3cc' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") no-repeat 14px 50%;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px 13px 42px;
  font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: #8a84b0; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #8f74ff40; }

.suggestions {
  list-style: none; margin: 6px 0 0; padding: 4px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  max-height: 320px; overflow-y: auto; box-shadow: var(--shadow);
}
.suggestions li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 10px; border-radius: 8px; cursor: pointer;
}
.suggestions li:hover, .suggestions li[aria-selected="true"] { background: var(--line); }
.suggestions .meta { color: var(--muted); font-size: .85rem; white-space: nowrap; }

.variants { display: grid; gap: 8px; margin-top: 12px; }
.variant {
  text-align: left; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.variant:hover { border-color: #5a4f95; }
.variant[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, 0 6px 18px -10px #8f74ff; background: #2b2550; }
.variant .moves { color: var(--muted); font-size: .85rem; }

.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.type-grid button {
  border: 2px solid transparent; border-radius: 10px; padding: 9px 4px;
  color: #fff; font-weight: 700; font-size: .85rem; text-shadow: 0 1px 2px #0008;
  background-image: linear-gradient(180deg, #ffffff2e, #ffffff00 55%, #0000001f);
  box-shadow: 0 1px 0 #ffffff26 inset;
}
.type-grid button:hover { filter: brightness(1.08); }
.type-grid:has(button[aria-pressed="true"]) button:not([aria-pressed="true"]) { opacity: .72; }
.type-grid button[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 3px #8f74ff88, 0 6px 18px -6px #000; opacity: 1; }

.type {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  background-image: linear-gradient(180deg, #ffffff26, #ffffff00);
  color: #fff; font-size: .78rem; font-weight: 600; text-shadow: 0 1px 2px #0008;
  vertical-align: middle;
}

.boss-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.boss { border-color: #4a3d8a; background: radial-gradient(500px 200px at 100% 0%, #7c5cff2e, transparent 70%), var(--panel); }
.boss-title h2 { margin: 0; font-size: 1.45rem; font-weight: 800; }
.boss .row { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.boss .label { color: var(--muted); font-size: .85rem; min-width: 76px; }
.move-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.move-list li { background: var(--panel-2); border: 1px solid #ffffff0a; border-radius: 10px; padding: 8px 10px; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.move-list .cat { color: var(--muted); font-size: .75rem; }

.tier-note { color: var(--muted); font-size: .85rem; margin: 0 0 8px; }
.banner { border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-size: .9rem; }
.banner.warn { background: #ffbf4722; border: 1px solid #ffbf4766; }

.counter-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.counter {
  background: linear-gradient(90deg, #4fd18b14, transparent 45%), var(--panel-2);
  border-radius: 12px; padding: 12px 14px;
  border: 1px solid #ffffff0a; border-left: 4px solid var(--good);
}
.counter.risky { background: linear-gradient(90deg, #ffbf4714, transparent 45%), var(--panel-2); }
.counter.danger { background: linear-gradient(90deg, #ff5f6d14, transparent 45%), var(--panel-2); }
.counter.neutral { background: var(--panel-2); }
.counter.risky { border-left-color: var(--warn); }
.counter.danger { border-left-color: var(--bad); }
.counter.neutral { border-left-color: var(--muted); }
.counter-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.counter-name { font-weight: 700; font-size: 1.02rem; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.badge { font-size: .76rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--line); }
.badge.good { background: #4fd18b26; color: var(--good); }
.badge.warn { background: #ffbf4726; color: var(--warn); }
.badge.bad { background: #ff5f6d26; color: var(--bad); }
.counter .build { color: var(--muted); font-size: .85rem; margin-top: 6px; }

details.more { margin-top: 10px; }
details.more summary { cursor: pointer; color: var(--muted); font-size: .9rem; font-weight: 600; padding: 6px 0; }
details.more summary:hover { color: var(--text); }

.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .9rem; margin-bottom: 10px; }

.lineup { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.lineup li { background: var(--panel-2); border: 1px solid #ffffff0a; border-radius: 12px; padding: 12px 14px; }
.lineup .who { color: #b49fff; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.lineup .detail { color: var(--muted); font-size: .88rem; }
.tips { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.tips li::marker { color: var(--accent); }

.share {
  width: 100%; margin: 4px 0 12px; min-height: 44px;
  background: var(--accent-grad); border: 0; border-radius: 14px; color: #fff; font-weight: 700;
  box-shadow: 0 8px 22px -10px #7c5cff;
}
.share:hover { filter: brightness(1.08); }

footer { text-align: center; padding-top: 8px; padding-bottom: max(24px, env(safe-area-inset-bottom)); color: var(--muted); font-size: .8rem; }
footer p { margin: 4px 0; }
footer p:first-child { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .72rem; }
footer .fine { opacity: .75; }

.empty { color: var(--muted); font-size: .9rem; margin: 0; }
.boss .row .tier-note { margin: 0; }
