/* OLYMPUS: 300 - arena, personagens e HUD. Tudo em DOM + CSS, sem Canvas. */

.o3 {
  position: relative;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
  height: calc(100dvh - var(--nav-h)); min-height: 540px; max-height: 920px;
  max-width: 560px; margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  font-variant-numeric: tabular-nums;
}
.o3.is-embed { height: min(720px, 84dvh); border: 3px solid var(--yellow); border-radius: 24px; box-shadow: 0 0 0 6px rgba(255, 210, 63, 0.14), 0 30px 80px rgba(60, 40, 200, 0.45); }
[hidden] { display: none !important; }

/* ---------- HUD ---------- */
.o3-top, .o3-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--bg-2); }
.o3-top { border-bottom: 2px solid var(--line); }
.o3-bottom { border-top: 2px solid var(--line); min-height: 76px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.o3-stat { display: grid; gap: 3px; line-height: 1; }
.o3-stat small { font: 700 0.66rem/1 var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--mute); }
.o3-stat b { font: 800 1.3rem/1 var(--display); }
.o3-stat b i { color: var(--yellow); margin-right: 3px; font-size: 1.1rem; }
.o3-stat .is-empty { animation: o3empty 0.4s; }
#o3-tier { color: var(--yellow); white-space: nowrap; }
#o3-mult { color: var(--cyan); }
.o3-icon { width: 44px; height: 44px; display: grid; place-items: center; background: var(--card-2); border: 0; border-radius: var(--radius-sm); color: var(--text); font-size: 1.3rem; cursor: pointer; box-shadow: 0 4px 0 #0c1130; }
.o3-icon:active { transform: translateY(3px); box-shadow: 0 1px 0 #0c1130; }
.o3-group { display: flex; gap: 18px; align-items: center; }
.o3-actions { width: 100%; justify-content: space-between; }
.o3-sacbtn { background: var(--red); color: #fff; box-shadow: 0 5px 0 #9c1f2e; }
.o3-sacbtn:active { box-shadow: 0 1px 0 #9c1f2e; }
.o3-final { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.o3-final .btn { padding: 15px 4px; font-size: 0.9rem; }

/* ---------- arena ---------- */
.o3-arena { position: relative; overflow: hidden; touch-action: none; cursor: crosshair; }
.o3-arena.is-hit { animation: o3shake 0.32s; }
.o3-sky {
  position: absolute; inset: 0;
  background:
    repeating-radial-gradient(circle at 50% 50%, transparent 0 88px, rgba(150, 170, 255, 0.09) 88px 90px),
    radial-gradient(circle at 50% 50%, #3a34a8 0, #1d2168 34%, #0c0f30 78%);
}
.o3-sky::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, rgba(255, 90, 60, 0.15), rgba(200, 30, 40, 0.75) 85%); opacity: 0; transition: opacity 1s; }
[data-ruin="1"] .o3-sky::after { opacity: 0.2; }
[data-ruin="2"] .o3-sky::after { opacity: 0.45; }
[data-ruin="3"] .o3-sky::after { opacity: 0.75; }
[data-ruin="4"] .o3-sky::after { opacity: 1; animation: o3pulse 0.7s infinite alternate; }

.o3-arena::after { content: ""; position: absolute; inset: 0; border: 0 solid var(--yellow); pointer-events: none; transition: border-width 0.25s; }
.is-power .o3-arena::after { border-width: 4px; }
.is-god .o3-arena::after { border-width: 8px; border-color: #fff; }

/* Zeus no pico do Olimpo */
.o3-center { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.o3-aura { position: absolute; left: -110px; top: -130px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 228, 92, 0.9), rgba(255, 210, 63, 0.25) 45%, transparent 70%); opacity: calc(0.12 + var(--aura, 0) * 0.8); scale: calc(0.7 + var(--aura, 0) * 0.5); transition: opacity 0.6s, scale 0.6s; }
.o3-peak { position: absolute; left: -85px; top: 2px; width: 170px; max-width: none; }
.o3-zeus { position: absolute; left: -44px; top: -86px; width: 88px; max-width: none; transform-origin: 50% 90%; animation: o3idle 2.2s ease-in-out infinite alternate; }
.o3-zeus.is-flip { transform: scaleX(-1); }
.o3-zeus.is-cast { animation: o3cast 0.22s; }
.is-god .o3-zeus { filter: brightness(1.5) drop-shadow(0 0 10px #fff); }
.o3-core { position: absolute; left: -70px; top: 74px; width: 140px; text-align: center; font-family: var(--display); }
.o3-core b { font-size: 1.35rem; font-weight: 800; text-shadow: 0 2px 0 var(--ink); }
.o3-core span { color: var(--mute); font-size: 0.78rem; font-weight: 700; }
.o3-corebar { height: 10px; background: var(--ink); border: 2px solid var(--ink); border-radius: 999px; margin-top: 4px; overflow: hidden; }
.o3-corebar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(180deg, #8cf06a, #3fbf4a); transform-origin: 0 50%; transition: transform 0.3s; }
[data-ruin="1"] .o3-corebar i, [data-ruin="2"] .o3-corebar i { background: linear-gradient(180deg, #ffe45c, #ffb02e); }
[data-ruin="3"] .o3-corebar i, [data-ruin="4"] .o3-corebar i { background: linear-gradient(180deg, #ff7a6a, #e02c3c); }
.o3-ward { position: absolute; left: -96px; top: -110px; width: 192px; height: 192px; border-radius: 50%; border: 4px solid var(--cyan); background: rgba(92, 225, 255, 0.12); opacity: 0; transition: opacity 0.4s; }
.o3-ward.is-on { opacity: 1; }
.o3-layer { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }

.o3-banner { position: absolute; left: 0; right: 0; top: 9%; text-align: center; pointer-events: none; opacity: 0; transform: translateY(10px) scale(0.92); transition: opacity 0.3s, transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); padding: 0 14px; }
.o3-banner.is-on { opacity: 1; transform: none; }
.o3-banner strong { display: block; font: 800 clamp(1.6rem, 7.4vw, 2.3rem) / 1.05 var(--display); color: var(--yellow); text-shadow: 0 4px 0 var(--ink), 0 0 18px rgba(0, 0, 0, 0.8); }
.o3-banner span { display: inline-block; margin-top: 8px; font: 700 0.9rem/1 var(--body); background: var(--ink); padding: 7px 12px; border-radius: 999px; }
.o3-alarm { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font: 800 1.1rem/1 var(--display); letter-spacing: 0.08em; color: #fff; text-shadow: 0 3px 0 #9c1f2e; pointer-events: none; animation: o3pulse 0.6s infinite alternate; }

/* ---------- titãs ---------- */
.o3-ent, .o3-item, .o3-float, .o3-flash, .o3-bolt { position: absolute; left: 0; top: 0; will-change: transform; }
.o3-ent { width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2); pointer-events: none; }
.o3-body { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; transform-origin: 50% 100%; animation: o3walk 0.5s ease-in-out infinite alternate; -webkit-user-drag: none; }
.t-fire .o3-body { animation-duration: 0.22s; }
.is-boss .o3-body { animation-duration: 0.9s; }
.t-lord .o3-body { filter: hue-rotate(300deg) saturate(1.3); }
.t-olympian .o3-body { filter: hue-rotate(170deg) saturate(1.4) brightness(1.1); }
.t-cronus .o3-body { animation: o3idle 1.6s ease-in-out infinite alternate; }
.t-cronus.is-winding .o3-body { animation: o3wind 0.2s infinite alternate; }
.o3-ehp { position: absolute; left: 10%; right: 10%; top: -10px; height: 7px; background: var(--ink); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.o3-ehp b { display: block; height: 100%; background: var(--red); transform-origin: 0 50%; }
.is-boss .o3-ehp { height: 11px; top: -14px; }
.is-boss .o3-ehp b { background: var(--yellow); }
.o3-ent.is-hurt .o3-body { animation: o3hurt 0.18s; }
.o3-ent.is-dead { animation: o3die 0.3s forwards; }
.o3-ent::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 4px solid var(--yellow); opacity: 0; }
.o3-ent.is-charging::after { animation: o3charge 0.2s forwards; }

/* ---------- itens e efeitos ---------- */
.o3-item { width: 46px; height: 46px; margin: -23px 0 0 -23px; display: grid; place-items: center; border-radius: 50%; border: 3px solid var(--ink); color: var(--ink); background: var(--yellow); font-size: 1.4rem; pointer-events: none; box-shadow: 0 0 0 4px rgba(255, 210, 63, 0.3); animation: o3item 0.7s ease-in-out infinite alternate; }
.o3-item.is-spring { background: var(--cyan); box-shadow: 0 0 0 4px rgba(92, 225, 255, 0.3); }
.o3-float { font: 800 1.05rem/1 var(--display); color: #fff; white-space: nowrap; margin-left: -50px; width: 100px; text-align: center; text-shadow: 0 2px 0 var(--ink), 0 0 6px var(--ink); pointer-events: none; animation: o3float 0.8s forwards; }
.o3-float.is-bad { color: #ff8f8f; }
.o3-float.is-good { color: var(--yellow); }
.o3-bolt { height: 14px; margin-top: -7px; transform-origin: 0 50%; pointer-events: none; background: linear-gradient(90deg, #fff, #ffe45c); filter: drop-shadow(0 0 6px #ffe45c); clip-path: polygon(0 40%, 16% 0, 30% 55%, 48% 5%, 66% 60%, 84% 12%, 100% 50%, 84% 62%, 66% 100%, 48% 50%, 30% 100%, 16% 46%, 0 60%); animation: o3bolt 0.24s forwards; }
.o3-bolt.is-heavy { height: 30px; margin-top: -15px; }
.o3-flash { width: 80px; height: 80px; margin: -40px 0 0 -40px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, #fff, rgba(255, 228, 92, 0.6) 40%, transparent 70%); animation: o3flash 0.3s forwards; }
.o3-flash.is-heavy { width: 170px; height: 170px; margin: -85px 0 0 -85px; }

/* ---------- telas sobrepostas ---------- */
.o3-over { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 20px; background: rgba(8, 11, 31, 0.92); text-align: center; overflow-y: auto; }
.o3-over > div { width: 100%; max-width: 360px; display: grid; gap: 14px; justify-items: stretch; }
.o3-over h2 { font-size: clamp(2rem, 9vw, 2.7rem); }
.o3-over h2 b { color: var(--yellow); text-shadow: 0 4px 0 var(--yellow-dark); }
.o3-over p { color: var(--mute); font-size: 0.98rem; }
.o3-hero { width: 120px; margin: 0 auto -6px; animation: o3idle 2.2s ease-in-out infinite alternate; }
.o3-over ul { list-style: none; padding: 14px 16px; margin: 0; display: grid; gap: 9px; text-align: left; font-size: 0.93rem; color: var(--mute); background: var(--card); border-radius: var(--radius-sm); }
.o3-over li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; }
.o3-over li i { color: var(--yellow); font-size: 1.2rem; margin-top: 2px; }
.o3-over li strong { color: var(--text); }
.o3-sac { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: center; text-align: left; padding: 13px 16px; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius-sm); color: var(--text); font: inherit; cursor: pointer; }
.o3-sac b { grid-row: span 2; font: 800 1.3rem/1 var(--display); color: var(--red); min-width: 92px; }
.o3-sac span { font: 800 1.05rem/1.2 var(--display); }
.o3-sac small { color: var(--mute); }
.o3-sac:disabled { opacity: 0.35; cursor: not-allowed; }
.o3-sac.is-god { border-color: var(--yellow); background: var(--card-2); }
.o3-sac.is-god b { color: var(--yellow); }
.o3-sac:not(:disabled):active { transform: scale(0.98); }

@keyframes o3bolt { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes o3flash { from { opacity: 1; scale: 0.4; } to { opacity: 0; scale: 1.2; } }
@keyframes o3float { to { opacity: 0; translate: 0 -40px; } }
@keyframes o3hurt { 50% { filter: brightness(3) saturate(0); scale: 0.9; } }
@keyframes o3die { to { opacity: 0; scale: 0.3; rotate: 40deg; } }
@keyframes o3charge { from { opacity: 0.2; scale: 1.5; } to { opacity: 1; scale: 1; } }
@keyframes o3walk { from { rotate: -6deg; translate: 0 0; } to { rotate: 6deg; translate: 0 -3px; } }
@keyframes o3idle { to { translate: 0 -4px; } }
@keyframes o3wind { from { rotate: -6deg; filter: brightness(1); } to { rotate: 6deg; filter: brightness(1.8); } }
@keyframes o3cast { 40% { scale: 1.15; rotate: -8deg; } }
@keyframes o3item { to { scale: 1.15; } }
@keyframes o3pulse { to { opacity: 0.45; } }
@keyframes o3empty { 50% { color: var(--red); scale: 1.2; } }
@keyframes o3shake { 20% { translate: -7px 3px; } 40% { translate: 6px -4px; } 60% { translate: -4px 2px; } 80% { translate: 3px -2px; } }

/* ---------- guia abaixo do jogo ---------- */
.bestiary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.beast { display: grid; grid-template-columns: 84px 1fr; gap: 18px; align-items: center; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; }
.beast img { width: 84px; }
.beast h3 { font-size: 1.2rem; }
.beast p { color: var(--mute); font-size: 0.95rem; margin-top: 4px; }
.beast:last-child { grid-column: 1 / -1; }
.howto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.howto > div { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 22px; }
.howto i { font-size: 2rem; color: var(--yellow); }
.howto h3 { font-size: 1.2rem; margin-top: 10px; }
.howto p { color: var(--mute); font-size: 0.95rem; margin-top: 6px; }
.timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.timeline div { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; }
.timeline div:last-child { border-color: var(--red); }
.timeline b { display: block; font: 800 2.2rem/1 var(--display); color: var(--yellow); }
.timeline span { display: block; font: 800 1.05rem/1.2 var(--display); margin-top: 8px; }
.timeline small { color: var(--mute); display: block; margin-top: 6px; line-height: 1.45; }
@media (max-width: 960px) {
  .o3.is-embed { height: calc(100dvh - var(--nav-h) - 26px); min-height: 560px; border-radius: 20px; }
}
@media (max-height: 760px), (max-width: 400px) {
  .o3-hero { width: 84px; }
  .o3-over > div { gap: 10px; }
  .o3-over ul { padding: 12px 14px; gap: 7px; font-size: 0.88rem; }
}
@media (max-width: 760px) {
  .bestiary, .howto { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr 1fr; }
}
