/* views.css — Tas, Codex, Bengkel Tempa, Peti Bahan (gacha), Sewa Bayangan, Kotak Surat.
   Isi datar; gerak hanya untuk kejadian (tempa, buka peti), tidak ada loop dekoratif tanpa henti. */
.view-root { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.gi.ghost { opacity: 0.25; filter: grayscale(1); }
.item-grid.gm-scroll, .merc-grid, .mail-list { flex: 1; min-height: 0; }
.panel-note { font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; margin-bottom: 12px; }

/* ---------- Tas: slot dipakai (tombol bila terisi: Enter/Spasi menampilkan detail) ---------- */
.eq-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 10px; }
.eq-slot { position: relative; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 10px; border-radius: 8px; text-align: left; font-family: var(--font-ui); color: var(--text); background: #252214; border: 2px solid var(--gold-2); }
button.eq-slot { width: 100%; -webkit-appearance: none; appearance: none; cursor: pointer; }
button.eq-slot:hover { background: #2f2a17; }
.eq-slot.is-empty { border: 2px dashed #3a4760; background: rgba(0, 0, 0, 0.2); }
.eq-art { width: 46px; height: 46px; flex: 0 0 46px; }
.eq-art .gi { width: 100%; height: 100%; }
.eq-txt { min-width: 0; display: flex; flex-direction: column; }
.eq-lbl { display: block; font-size: var(--fs-xs); font-weight: 800; color: var(--text-2); }
.eq-name { display: block; font-size: var(--fs-md); font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eq-name b { color: #ff8a80; }
.eq-stat { display: block; font-size: var(--fs-xs); color: var(--text-2); font-weight: 700; }
.qty-lg { position: absolute; top: -8px; right: -8px; padding: 2px 8px; border-radius: 6px; font-weight: 900; font-size: var(--fs-sm); color: #2a1a04; background: #e2b54a; border: 2px solid #0e131d; }
.codex-summary { margin-bottom: 10px; }
.codex-row { display: flex; gap: 14px; align-items: center; }
.codex-book { width: 64px; height: 64px; flex: 0 0 64px; }
.codex-book .gi { width: 100%; height: 100%; }

/* ---------- Bengkel Tempa: panggung paron (diam; bergerak hanya saat menempa) ---------- */
.anvil-panel { gap: 12px; }
.anvil-stage { position: relative; height: 176px; flex: 0 0 176px; border-radius: 10px; overflow: hidden; background: radial-gradient(ellipse at 50% 85%, rgba(255, 138, 42, 0.3), transparent 60%), #120e0a; border: 1px solid rgba(255, 166, 87, 0.3); }
.anvil-glow { position: absolute; left: 50%; bottom: 30px; width: 220px; height: 80px; transform: translateX(-50%); background: radial-gradient(ellipse, rgba(255, 160, 60, 0.4), transparent 70%); }
.anvil-base { position: absolute; left: 50%; bottom: 6px; width: 170px; height: 104px; transform: translateX(-50%); }
.anvil-base .gi { width: 100%; height: 100%; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.8)); }
.anvil-item { position: absolute; left: 50%; bottom: 74px; width: 84px; height: 84px; transform: translateX(-50%); }
.anvil-art { width: 100%; height: 100%; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.7)); }
.anvil-art .gi { width: 100%; height: 100%; }
.anvil-hammer { position: absolute; right: 16%; top: 8px; width: 86px; height: 86px; transform-origin: 18% 88%; transform: rotate(18deg); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.7)); }
.anvil-hammer .gi { width: 100%; height: 100%; }
.anvil-sparks i { position: absolute; left: 50%; bottom: 90px; width: 6px; height: 6px; border-radius: 50%; background: #ffe38a; opacity: 0; }
.anvil-result { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-title); font-size: 1.6rem; font-weight: 700; opacity: 0; pointer-events: none; text-shadow: 0 3px 0 #000; }
.anvil-stage.is-striking .anvil-hammer { animation: strike 0.26s 3 ease-in; }
.anvil-stage.is-striking .anvil-sparks i { animation: spark 0.26s 3 ease-out; }
@keyframes strike { 0% { transform: rotate(18deg); } 55% { transform: rotate(-42deg); } 100% { transform: rotate(18deg); } }
.anvil-sparks i:nth-child(1) { --tx: -60px; --ty: -40px; } .anvil-sparks i:nth-child(2) { --tx: 50px; --ty: -55px; } .anvil-sparks i:nth-child(3) { --tx: -30px; --ty: -70px; }
.anvil-sparks i:nth-child(4) { --tx: 70px; --ty: -20px; } .anvil-sparks i:nth-child(5) { --tx: -80px; --ty: -10px; } .anvil-sparks i:nth-child(6) { --tx: 20px; --ty: -80px; }
@keyframes spark { 0%, 55% { opacity: 0; transform: translate(0, 0); } 60% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.4); } }
.anvil-stage.is-success { animation: flashGold 1.2s ease-out; }
.anvil-stage.is-success .anvil-result { color: var(--gold-hi); animation: resultPop 1.6s ease-out; }
.anvil-stage.is-fail { animation: flashRed 0.9s ease-out, shake 0.4s; }
.anvil-stage.is-fail .anvil-result { color: var(--bad-hi); animation: resultPop 1.6s ease-out; }
@keyframes flashGold { 0% { box-shadow: inset 0 0 0 0 rgba(242, 204, 96, 0); } 15% { box-shadow: inset 0 0 120px 30px rgba(255, 233, 163, 0.85); } 100% { box-shadow: inset 0 0 0 0 rgba(242, 204, 96, 0); } }
@keyframes flashRed { 15% { box-shadow: inset 0 0 120px 30px rgba(248, 81, 73, 0.6); } }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
@keyframes resultPop { 0% { opacity: 0; transform: scale(0.5); } 18% { opacity: 1; transform: scale(1.15); } 30% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.lv-arrow { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.lv-arrow .arrow { color: var(--gold); font-weight: 900; }
.compare { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.cmp-col { padding: 10px; border-radius: 8px; text-align: center; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line-2); }
.cmp-col small { display: block; font-size: var(--fs-xs); font-weight: 800; color: var(--muted); }
.cmp-col b { font-size: 1.25rem; font-weight: 900; }
.cmp-col.next { border-color: rgba(63, 185, 80, 0.45); background: rgba(63, 185, 80, 0.08); }
.cmp-col em { display: block; font-style: normal; color: var(--good-hi); font-weight: 900; font-size: var(--fs-sm); }
.cmp-mid { color: var(--gold); font-weight: 900; font-size: 1.2rem; }
.chance-top { display: flex; justify-content: space-between; font-weight: 800; font-size: var(--fs-md); margin-bottom: 5px; }
.chance-top b { font-size: var(--fs-lg); }
.chance-bar { height: 12px; border-radius: 4px; background: #070a10; border: 1px solid #263248; overflow: hidden; }
.chance-bar i { display: block; height: 100%; transition: width 0.4s; }
.chance-note { font-size: var(--fs-sm); color: var(--muted); line-height: 1.4; margin-top: 5px; }
.reqs { display: grid; gap: 6px; }
.req { display: grid; grid-template-columns: 26px 1fr auto 18px; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; font-size: var(--fs-sm); font-weight: 800; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line-2); }
.req .gi { width: 24px; height: 24px; }
.req.ok i { color: var(--good-hi); font-style: normal; }
.req.no { border-color: rgba(248, 81, 73, 0.4); }
.req.no b, .req.no i { color: var(--bad-hi); font-style: normal; }
.forge-reason { text-align: center; font-size: var(--fs-sm); color: var(--bad-hi); font-weight: 800; margin-top: -4px; }

/* ---------- Peti Bahan & Gacha Emoji ---------- */
.gacha-layout { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(230px, 300px) 1fr; gap: 16px; }
.banner-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 10px; overflow-y: auto; background: #1a1630; border: 1px solid rgba(210, 168, 255, 0.35); }
.gacha-layout.em .banner-card { background: #11252a; border-color: rgba(126, 231, 255, 0.35); }
.banner-art { position: relative; height: 104px; display: flex; align-items: center; justify-content: center; }
.banner-art .gi { width: 92px; height: 92px; position: relative; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); }
.banner-emoji { font-size: 4rem; position: relative; }
.banner-glow { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner-card h3 { font-family: var(--font-title); color: var(--gold-hi); font-size: var(--fs-title); text-align: center; }
.banner-card p { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.45; text-align: center; }
.odds { display: grid; gap: 4px; }
/* Garis kiri = warna rarity peluang (informasi) */
.odd { display: flex; justify-content: space-between; align-items: center; padding: 5px 10px; border-radius: 6px; font-size: var(--fs-sm); font-weight: 800; background: rgba(0, 0, 0, 0.3); border-left: 3px solid var(--rc, #3a4760); }
.odd span { color: var(--rc, var(--text-2)); filter: brightness(1.4); }
.owned { font-size: var(--fs-sm); color: var(--text-2); text-align: center; }
.wheel-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 0; }
.wheel-wrap { position: relative; width: min(330px, 46vh, 60vw); aspect-ratio: 1; }
.wheel-wrap::before { content: ''; position: absolute; inset: -14px; border-radius: 50%; background: radial-gradient(circle, rgba(210, 168, 255, 0.3), transparent 70%); opacity: 0; transition: opacity 0.3s; }
.wheel-rot, .wheel-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.wheel-rot { will-change: transform; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.65)); }
.wheel-pointer { position: absolute; top: -10px; left: 50%; z-index: 3; width: 34px; height: 44px; transform: translateX(-50%); background: #e2b54a; clip-path: polygon(0 0, 100% 0, 50% 100%); filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.6)); }
.wheel-hub { position: absolute; left: 50%; top: 50%; z-index: 2; width: 22%; height: 22%; transform: translate(-50%, -50%); border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #141c2c; border: 3px solid var(--gold); }
.wheel-hub .gi { width: 64%; height: 64%; }
.wl.a { fill: #ffe9a3; } .wl.b { fill: #8a5a10; }
/* Lampu roda berkedip hanya selama memutar (kejadian beberapa detik, bukan loop diam) */
.wheel-wrap.is-spinning .wl, .wheel-wrap.is-charging .wl { animation: blink 0.16s infinite alternate; }
.wheel-wrap.is-spinning .wl.b { animation-delay: 0.08s; }
@keyframes blink { from { fill: #ffe9a3; } to { fill: #5a3a08; } }
.wheel-wrap.is-charging::before, .wheel-wrap.is-spinning::before { opacity: 1; }
.wheel-wrap.is-landed .wheel-hub { animation: bump 0.5s 2; }
.pull-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pull-row .btn { flex-direction: column; gap: 1px; min-width: 170px; }
.pull-row .btn small { font-size: var(--fs-xs); font-weight: 800; opacity: 0.9; }
.pull-note { min-height: 18px; font-size: var(--fs-sm); font-weight: 800; color: var(--violet); text-align: center; }
.reveal { position: absolute; inset: -14px -16px -16px; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; background: rgba(12, 9, 24, 0.96); animation: fadeIn 0.25s; overflow-y: auto; }
.reveal-title { font-family: var(--font-title); font-weight: 700; color: var(--gold-hi); font-size: var(--fs-title); }
.reveal-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 130px)); gap: 10px; perspective: 900px; }
.reveal-grid.n1 { grid-template-columns: 170px; }
.reveal .btn-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.flip-card { aspect-ratio: 3 / 4; perspective: 800px; }
.flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(0.3, 1.4, 0.5, 1); }
.flip-card.is-flipped .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; border-radius: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 8px; overflow: hidden; }
.flip-back { background: repeating-linear-gradient(45deg, #2a1a54 0 8px, #22154a 8px 16px); border: 2px solid var(--gold); }
.flip-back .gi { width: 46%; height: 46%; opacity: 0.85; }
.flip-front { transform: rotateY(180deg); background: color-mix(in srgb, var(--rc, #3a4760) 16%, #121927); border: 2px solid var(--rc); text-align: center; }
.fc-art { width: 56%; position: relative; z-index: 1; }
.fc-art .gi { width: 100%; height: auto; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.35)); }
.fc-emoji { font-size: 3rem; position: relative; z-index: 1; }
.fc-name { font-size: var(--fs-sm); font-weight: 900; line-height: 1.2; position: relative; z-index: 1; }
.fc-tags { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; position: relative; z-index: 1; }
.fc-pass { font-size: var(--fs-xs); color: #8cd4ff; font-weight: 800; position: relative; z-index: 1; }
/* Epic ke atas: sinar berputar SEKALI saat kartu terbuka. Pendar hanya Legendary/Mythic. */
.flip-card.is-epic.is-flipped { animation: epicShake 0.5s 0.45s; }
.flip-card.is-epic.r-LEGENDARY .flip-front, .flip-card.is-epic.r-MYTHIC .flip-front { box-shadow: 0 0 28px var(--rc), inset 0 0 18px var(--rg); }
.rays { position: absolute; left: 50%; top: 38%; width: 260%; aspect-ratio: 1; transform: translate(-50%, -50%); background: repeating-conic-gradient(from 0deg, var(--rg) 0 10deg, transparent 10deg 22deg); animation: raysOnce 5s ease-out 1 forwards; opacity: 0.9; }
@keyframes raysOnce { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(140deg); } }
@keyframes epicShake { 25% { transform: scale(1.08) rotate(-2deg); } 50% { transform: scale(1.05) rotate(2deg); } }

/* ---------- Pemilih item & harga (Pasar, Gift, Barter) ---------- */
.price { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; color: var(--gold-hi); font-size: var(--fs-md); white-space: nowrap; }
.price .gi { width: 18px; height: 18px; }
.picker { max-height: 210px; min-height: 120px; padding: 6px 8px 8px 4px; border-radius: 8px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line-2); }

/* ---------- Sewa Bayangan (ungu = identitas Bayangan) ---------- */
.merc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; align-content: start; overflow-y: auto; padding: 4px 4px 4px 2px; }
.icard.merc-card { align-items: stretch; text-align: left; gap: 9px; padding: 12px; background: #1b1830; }
.mc-top { display: flex; align-items: center; gap: 10px; }
.mc-ava { position: relative; width: 52px; height: 52px; flex: 0 0 52px; border-radius: 10px; padding: 2px; background: #4b2c8a; }
.mc-ava .gi { width: 100%; height: 100%; border-radius: 8px; background: #141026; }
.mc-lv { position: absolute; bottom: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: var(--fs-xs); font-weight: 900; color: #2a1a04; background: #e2b54a; border: 2px solid #0e131d; }
.mc-id { flex: 1; min-width: 0; }
.mc-name { font-weight: 900; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-class { font-size: var(--fs-xs); color: #d2a8ff; font-weight: 800; }
.mc-fee { display: inline-flex; align-items: center; gap: 3px; font-weight: 900; color: var(--gold-hi); }
.mc-fee .gi { width: 18px; height: 18px; }
.mc-gear { display: grid; gap: 5px; }
.mc-slot { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; font-size: var(--fs-sm); font-weight: 800; background: rgba(0, 0, 0, 0.3); }
.mc-slot .gi { width: 26px; height: 26px; flex: 0 0 26px; }
.mc-slot span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.mc-stats div { padding: 5px 2px; border-radius: 6px; text-align: center; background: rgba(0, 0, 0, 0.3); }
.mc-stats small { display: block; font-size: var(--fs-xs); font-weight: 800; color: var(--muted); }
.mc-stats b { font-size: var(--fs-sm); }
.merc-active { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 12px; border-radius: 8px; background: rgba(63, 185, 80, 0.1); border: 1px solid rgba(63, 185, 80, 0.45); }
.merc-meta { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); font-weight: 800; color: var(--text-2); }

/* ---------- Kotak Surat ---------- */
.claim-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 10px; border-radius: 8px; background: rgba(242, 204, 96, 0.08); border: 1px solid rgba(242, 204, 96, 0.4); }
.mail-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 2px 4px 2px 2px; }
.icard.mail-row { flex-direction: row; align-items: center; text-align: left; gap: 12px; padding: 10px 12px; --rc: var(--line-2); background: #172031; }
.icard.mail-row.is-new { --rc: rgba(242, 204, 96, 0.55); }
.mail-ic { width: 42px; height: 42px; flex: 0 0 42px; }
.mail-ic .gi { width: 100%; height: 100%; }
.mail-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mail-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: var(--fs-md); }
.mail-top span { color: var(--text-2); font-weight: 700; }
.mail-top em { margin-left: auto; font-style: normal; font-size: var(--fs-xs); color: var(--muted); }
.mail-msg { font-size: var(--fs-sm); color: var(--text-2); font-style: italic; }
.mail-att { display: flex; gap: 6px; flex-wrap: wrap; }
.att { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 4px; border-radius: 6px; font-size: var(--fs-sm); font-weight: 800; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--rc, var(--line-2)); }
.att .gi { width: 22px; height: 22px; }
.att.gold { color: var(--gold-hi); border-color: rgba(242, 204, 96, 0.45); }
.mail-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 760px), (max-height: 520px) {
  .gacha-layout { grid-template-columns: minmax(170px, 210px) 1fr; gap: 10px; }
  .banner-art { height: 70px; }
  .banner-art .gi { width: 64px; height: 64px; }
  .banner-card { gap: 6px; padding: 10px; }
  .banner-card p { display: none; }
  .banner-card h3 { font-size: 18px; }
  .odd { padding: 3px 8px; font-size: var(--fs-xs); }
  .wheel-wrap { width: min(250px, 52vh, 46vw); }
  .pull-row .btn { min-width: 130px; padding: 6px 12px; }
  .reveal-grid { grid-template-columns: repeat(5, minmax(0, 96px)); gap: 6px; }
  .anvil-stage { height: 140px; flex-basis: 140px; }
  .anvil-item { width: 64px; height: 64px; bottom: 62px; }
  .anvil-base { width: 130px; height: 80px; }
  .eq-slots { gap: 6px; margin-bottom: 8px; }
  .eq-slot { min-height: 52px; padding: 6px 8px; gap: 7px; }
  .eq-art { width: 34px; height: 34px; flex-basis: 34px; }
  .eq-name { font-size: var(--fs-sm); }
  .codex-book { width: 40px; height: 40px; flex-basis: 40px; }
  .codex-summary { padding: 8px 10px; }
}
/* HP landscape: 4 slot pakai menjadi strip ikon 44px di samping ringkasan status (detail saat diketuk),
   agar grid item mendapat ruang (temuan #5) */
@media (max-height: 520px) {
  .bag-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  .bag-top .eq-slots { display: flex; gap: 6px; margin: 0; flex: none; }
  .bag-top .eq-slot { width: 44px; min-height: 44px; height: 44px; padding: 4px; justify-content: center; }
  .bag-top .eq-slot > :not(.eq-art) { display: none; }
  .bag-top .eq-art { width: 32px; height: 32px; flex-basis: 32px; }
  .bag-top .stat-strip { flex: 1 1 auto; min-width: 0; margin: 0; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .bag-top .stat-strip::-webkit-scrollbar { display: none; }
}
