:root {
  color-scheme: dark;
  --bg: #080808;
  --panel: #101010;
  --panel-2: #151515;
  --line: rgba(255,255,255,.12);
  --muted: #8b8b8b;
  --text: #f4f1eb;
  --red: #ff3b30;
  --red-dark: #8c100b;
  --bone: #d9d2c7;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 20%, rgba(148, 20, 14, .16), transparent 34rem),
    linear-gradient(180deg, #0b0b0b 0%, #050505 100%);
  font-family: var(--sans);
  font-size: 16px;
  overflow-x: hidden;
}

button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 30; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.topbar {
  position: relative; z-index: 10; height: 68px; padding: 0 max(20px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: rgba(8,8,8,.76); backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(255,59,48,.5);
  color: var(--red); font: 700 11px/1 var(--mono); letter-spacing: -.08em; transform: rotate(45deg);
}
.brand-mark::first-line { transform: rotate(-45deg); }
.brand-name { font: 650 14px/1 var(--mono); letter-spacing: .08em; }
.brand-name b { color: var(--red); }
.network { color: #aaa; font: 500 12px/1 var(--mono); text-transform: uppercase; }
.network i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 12px var(--red); animation: blink 2s infinite; }

main { width: min(100%, 760px); margin: 0 auto; padding: 0 18px 80px; }
.arena { text-align: center; padding: 48px 0 30px; }
.eyebrow { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--red); font: 700 12px/1 var(--mono); letter-spacing: .18em; }
.eyebrow span + span { padding-left: 12px; border-left: 1px solid rgba(255,59,48,.35); color: #777; }
h1 { margin: 15px 0 6px; font-size: clamp(2rem, 8vw, 4.4rem); line-height: .98; letter-spacing: -.055em; font-weight: 850; }
.boss-line { margin: 0; color: #8c8984; font-family: var(--mono); font-size: 13px; }

.boss-stage { position: relative; width: min(88vw, 470px); aspect-ratio: 1; margin: 8px auto -12px; display: grid; place-items: center; }
.boss-image { position: relative; z-index: 3; width: 76%; height: 76%; border-radius: 50%; object-fit: cover; filter: saturate(.8) contrast(1.12); -webkit-mask-image: radial-gradient(circle at center, #000 57%, transparent 73%); mask-image: radial-gradient(circle at center, #000 57%, transparent 73%); }
.boss-halo { position: absolute; z-index: 2; width: 67%; height: 67%; border-radius: 50%; background: rgba(255,36,20,.13); box-shadow: 0 0 75px rgba(255,30,20,.3), inset 0 0 40px rgba(255,255,255,.08); animation: breathe 4s ease-in-out infinite; }
.orbit { position: absolute; border: 1px solid rgba(255,59,48,.19); border-radius: 50%; }
.orbit::after { content: ""; position: absolute; top: 50%; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 16px var(--red); }
.orbit-a { inset: 9%; animation: spin 14s linear infinite; }
.orbit-b { inset: 1%; border-color: rgba(255,255,255,.08); animation: spin 24s linear infinite reverse; }
.scanline { position: absolute; z-index: 4; width: 72%; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,59,48,.75), transparent); box-shadow: 0 0 8px var(--red); animation: scan 4.8s ease-in-out infinite; }
.boss-stage.hit { animation: shake .44s both; }
.boss-stage.hit::after { content: ""; position: absolute; inset: 11%; z-index: 8; border-radius: 50%; background: white; animation: flash .48s both; }

.vitals { position: relative; z-index: 5; width: min(100%, 580px); margin: 0 auto; text-align: left; }
.hp-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 10px; color: #999; font: 600 12px/1 var(--mono); letter-spacing: .08em; }
.hp-heading strong { color: var(--text); font-size: clamp(16px, 5vw, 23px); letter-spacing: -.04em; }
.hp-heading small { color: #6b6b6b; font-size: .58em; }
.hp-track { position: relative; height: 13px; overflow: hidden; background: #21110f; border: 1px solid rgba(255,59,48,.28); }
.hp-fill { width: 100%; height: 100%; transform-origin: left center; background: linear-gradient(90deg, #8f150f, var(--red)); transition: width 1.25s cubic-bezier(.2,.8,.2,1); }
.hp-glow { position: absolute; top: -2px; bottom: -2px; width: 70px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); filter: blur(4px); animation: hpSweep 3.8s linear infinite; }
.global-stats { display: flex; justify-content: space-between; margin-top: 11px; color: #747474; font: 500 12px/1.4 var(--mono); }
.global-stats b { color: #c5c1ba; font-weight: 650; }

.attack-panel { position: relative; margin-top: 18px; padding: 28px; text-align: left; background: linear-gradient(145deg, rgba(24,24,24,.96), rgba(12,12,12,.96)); border: 1px solid rgba(255,255,255,.13); box-shadow: 0 28px 80px rgba(0,0,0,.42); }
.attack-panel::before { content: ""; position: absolute; top: -1px; left: 28px; right: 28px; height: 1px; background: linear-gradient(90deg, transparent, var(--red), transparent); }
.chance { display: flex; justify-content: space-between; color: var(--red); font: 700 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.chance b { color: #d5d0c8; }
.attack-panel h2 { margin: 17px 0 7px; font-size: clamp(1.55rem, 6vw, 2.25rem); letter-spacing: -.04em; }
.attack-panel > p { margin: 0 0 19px; color: #888; line-height: 1.6; font-size: 14px; }
.attack-box { display: block; border: 1px solid #3b3937; background: #080808; transition: border-color .2s, box-shadow .2s; }
.attack-box:focus-within { border-color: rgba(255,59,48,.75); box-shadow: 0 0 0 3px rgba(255,59,48,.1); }
.attack-box textarea { display: block; width: 100%; min-height: 110px; resize: vertical; padding: 17px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 16px; line-height: 1.6; }
.attack-box textarea::placeholder { color: #4f4e4b; }
.attack-box span { display: block; padding: 0 14px 10px; text-align: right; color: #5f5d59; font: 11px/1 var(--mono); }
.suggestions { display: flex; gap: 8px; padding: 12px 0 16px; overflow-x: auto; scrollbar-width: none; }
.suggestions::-webkit-scrollbar { display: none; }
.suggestions button { flex: 0 0 auto; padding: 8px 11px; border: 1px solid #333; color: #8e8b86; background: transparent; border-radius: 99px; font-size: 12px; cursor: pointer; }
.suggestions button:hover { border-color: #666; color: var(--text); }
.attack-button, .share-button { width: 100%; min-height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border: 0; color: white; background: var(--red); font-weight: 800; letter-spacing: .05em; cursor: pointer; box-shadow: 0 10px 36px rgba(255,59,48,.2); transition: transform .15s, filter .15s; }
.attack-button em { font: 500 11px/1 var(--mono); font-style: normal; opacity: .7; }
.attack-button:hover, .share-button:hover { filter: brightness(1.08); }
.attack-button:active, .share-button:active { transform: scale(.985); }
.attack-button:disabled { cursor: not-allowed; background: #292929; color: #696969; box-shadow: none; }
.attack-button.loading span::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 10px; border: 2px solid rgba(255,255,255,.3); border-top-color: white; border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -2px; }
.fine-print { margin: 12px 0 0 !important; text-align: center; color: #535353 !important; font-size: 11px !important; }
.form-error { min-height: 0; margin: 10px 0 0 !important; color: #ff6b63 !important; font-size: 13px !important; }

.signal { margin-top: 50px; }
.section-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; font-size: 15px; letter-spacing: .02em; }
.section-head span { color: var(--red); font: 700 10px/1 var(--mono); letter-spacing: .17em; }
.feed article { display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; padding: 17px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.feed p { margin: 0; color: #bbb7b0; line-height: 1.45; font-size: 14px; }
.feed strong { grid-row: span 2; align-self: center; color: var(--text); font: 700 13px/1 var(--mono); }
.feed small { color: #5f5d59; font: 11px/1 var(--mono); }
.feed-empty { padding: 28px 0; color: #575757; text-align: center; font: 12px/1 var(--mono); }

footer { min-height: 92px; padding: 0 22px max(18px, env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: #4f4f4f; font: 10px/1.5 var(--mono); letter-spacing: .08em; }
footer a { color: inherit; text-decoration: none; }
footer a:hover { color: #8a8a8a; }

.result-dialog { width: 100%; max-width: 620px; max-height: 100dvh; margin: auto; padding: 0; border: 0; color: var(--text); background: transparent; overflow: visible; }
.result-dialog::backdrop { background: rgba(0,0,0,.84); backdrop-filter: blur(14px); }
.result-shell { position: relative; margin: 12px; padding: 40px 24px 28px; max-height: calc(100dvh - 24px); overflow-y: auto; background: radial-gradient(circle at 50% 3%, rgba(180,20,12,.26), transparent 18rem), #0d0d0d; border: 1px solid rgba(255,255,255,.15); text-align: center; box-shadow: 0 0 100px rgba(255,30,20,.12); }
.close-result { position: absolute; right: 12px; top: 10px; width: 42px; height: 42px; border: 0; color: #888; background: transparent; font-size: 30px; cursor: pointer; }
.result-kicker { color: var(--red); font: 700 11px/1 var(--mono); letter-spacing: .17em; text-transform: uppercase; }
.impact-icon { margin: 20px 0 8px; color: var(--red); font-size: 46px; text-shadow: 0 0 32px var(--red); }
.result-shell h2 { margin: 0; font-size: clamp(1.75rem, 8vw, 3rem); letter-spacing: -.05em; }
.damage { margin: 7px 0 18px; }
.damage strong { display: block; color: #fff; font: 850 clamp(3rem, 16vw, 6.2rem)/.95 var(--mono); letter-spacing: -.08em; }
.damage span { color: var(--red); font: 700 11px/1 var(--mono); letter-spacing: .26em; }
.result-shell blockquote { margin: 22px 0; padding: 18px; border-block: 1px solid rgba(255,255,255,.11); color: #d7d2ca; font: 500 15px/1.7 var(--mono); }
.score-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.score-grid div { padding: 13px 4px; border-right: 1px solid var(--line); }
.score-grid div:last-child { border-right: 0; }
.score-grid span, .score-grid b { display: block; }
.score-grid span { color: #666; font-size: 10px; }
.score-grid b { margin-top: 7px; font: 700 14px/1 var(--mono); }
.discovery { margin: 18px 0 0; padding: 13px; border: 1px solid rgba(255,59,48,.4); background: rgba(255,59,48,.07); }
.discovery span, .discovery b { display: block; }
.discovery span { color: var(--red); font: 700 10px/1 var(--mono); letter-spacing: .18em; }
.discovery b { margin-top: 7px; font-size: 13px; }
.verdict { min-height: 40px; margin: 17px auto; max-width: 470px; color: #898681; font-size: 13px; line-height: 1.55; }
.result-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 9px; }
.share-button { justify-content: center; }
.card-button { border: 1px solid #444; color: #d2cec7; background: #171717; font-weight: 700; cursor: pointer; }
.share-note { margin: 12px 0 0; color: #595959; font-size: 11px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 30px); padding: 12px 16px; color: #111; background: #f2eee6; opacity: 0; pointer-events: none; font-weight: 650; font-size: 13px; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes blink { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.06); opacity: .72; } }
@keyframes scan { 0%,100% { transform: translateY(-110px); opacity: 0; } 20%,80% { opacity: 1; } 50% { transform: translateY(110px); } }
@keyframes hpSweep { from { left: -100px; } to { left: calc(100% + 80px); } }
@keyframes shake { 0%,100% { transform: translate(0); } 18% { transform: translate(-9px,3px); } 35% { transform: translate(8px,-3px); } 55% { transform: translate(-5px,-2px); } 75% { transform: translate(4px,2px); } }
@keyframes flash { 0% { opacity: 0; } 20% { opacity: .9; } 100% { opacity: 0; transform: scale(1.15); } }

@media (max-width: 560px) {
  .brand-name { display: none; }
  .arena { padding-top: 34px; }
  .boss-stage { margin-top: 2px; margin-bottom: -22px; }
  .attack-panel { padding: 23px 18px; margin-inline: -4px; }
  .score-grid { grid-template-columns: repeat(2, 1fr); }
  .score-grid div:nth-child(2) { border-right: 0; }
  .score-grid div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .result-actions { grid-template-columns: 1fr; }
  footer { flex-direction: column; justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}


/* Viral loop v4 */
.core-rule {
  width: min(100%, 580px); margin: 18px auto 0; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 5px;
  border-left: 2px solid var(--red); background: rgba(255,59,48,.055); text-align: left;
}
.core-rule b { color: #eeeae3; font-size: 14px; line-height: 1.35; }
.core-rule span { color: #8d8983; font-size: 13px; line-height: 1.4; }
.challenge-banner {
  margin: 22px 0 0; padding: 18px 20px; border: 1px solid rgba(255,59,48,.42);
  background: linear-gradient(110deg, rgba(255,59,48,.12), rgba(15,15,15,.97));
  box-shadow: 0 16px 50px rgba(0,0,0,.28);
}
.challenge-label { color: var(--red); font: 700 11px/1 var(--mono); letter-spacing: .13em; text-transform: uppercase; }
.challenge-banner p { margin: 10px 0 7px; color: #aaa6a0; font-size: 14px; line-height: 1.5; }
.challenge-banner p b { color: #fff; font-family: var(--mono); }
.challenge-banner strong { color: #f4f1eb; font-size: 15px; line-height: 1.45; }
.attack-panel.has-result { padding: 0; }
.attack-panel.has-result > :not(.owned-result) { display: none !important; }
.owned-result { padding: 28px; text-align: center; }
.owned-kicker { color: var(--red); font: 700 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.owned-damage { margin: 15px 0 4px; }
.owned-damage b { display: block; font: 850 clamp(2.7rem, 12vw, 5rem)/.95 var(--mono); letter-spacing: -.07em; }
.owned-damage span { color: var(--red); font: 700 10px/1 var(--mono); letter-spacing: .24em; }
.owned-result > p { margin: 9px 0 18px; color: #8e8a83; font: 12px/1.4 var(--mono); }
.owned-result blockquote { margin: 0 0 18px; padding: 15px; border-block: 1px solid var(--line); color: #d9d4cc; font-size: 14px; line-height: 1.55; }
.owned-actions { display: grid; grid-template-columns: 1.1fr 1.3fr 1fr; gap: 8px; }
.owned-actions button { min-height: 48px; padding: 8px 10px; border: 1px solid #3b3937; color: #ccc7bf; background: #111; font-size: 12px; font-weight: 700; cursor: pointer; }
.owned-actions button:nth-child(2) { border-color: var(--red); color: #fff; background: var(--red); }
.share-note { color: #aaa39b; font-size: 12px; font-weight: 650; }

@media (max-width: 560px) {
  .topbar { height: 56px; }
  main { padding-inline: 14px; }
  .arena { padding-top: 24px; padding-bottom: 18px; }
  .arena h1 { margin-top: 10px; font-size: 2.25rem; }
  .boss-line { font-size: 12px; }
  .core-rule { margin-top: 12px; padding: 10px 12px; gap: 3px; }
  .core-rule b { font-size: 13px; }
  .core-rule span { font-size: 12px; }
  .boss-stage { width: 250px; margin-top: -4px; margin-bottom: -27px; }
  .vitals { padding-inline: 3px; }
  .attack-panel { margin-top: 8px; }
  .challenge-banner { margin: 12px -2px 0; padding: 14px 15px; }
  .challenge-banner p { margin-block: 7px 5px; font-size: 13px; }
  .challenge-banner strong { font-size: 14px; }
  .challenge-mode .arena { padding-top: 17px; }
  .challenge-mode .boss-stage { width: 218px; margin-bottom: -30px; }
  .owned-result { padding: 24px 17px; }
  .owned-actions { grid-template-columns: 1fr; }
  .owned-actions button { min-height: 46px; }
}
