/* Fruit Battles: how everything looks. Colours are at the top in :root.
   The layout is for phones first; the @media blocks near the end widen it
   for tablets and computers. */

:root {
  --bg: #0b1626;
  --bg2: #10223a;
  --panel: #152a45;
  --panel2: #1c3556;
  --line: #2a4a73;
  --text: #eef3fb;
  --dim: #9fb3cf;
  --gold: #ffc93c;
  --gold-dark: #d99a0b;
  --good: #3ddc84;
  --bad: #ff5a5f;
  --haki: #b48cff;
  --cats: #ff8a3d;
  --dogs: #4ea8ff;
  --team: var(--gold);
  --rc: var(--line); /* the colour of a fruit's rarity, set by the .r-* classes below */
  --radius: 14px;
  --display: "Bangers", "Impact", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabbar: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 50% -200px, #1d3d66 0%, transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, #08111e 100%) fixed;
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; }
h2, .logo, .turn-title, .vs-mid { font-family: var(--display); letter-spacing: 1px; font-weight: 400; }
h2 { font-size: 28px; }
h3 { font-size: 15px; margin: 4px 0 10px; display: flex; align-items: center; gap: 8px; }
h3:not(:first-child) { margin-top: 18px; }
h4 { font-size: 14px; margin: 12px 0 6px; }
ul { margin: 0; padding: 0; list-style: none; }
.hidden { display: none !important; }
.center { text-align: center; justify-content: center; }
.team-cats { --team: var(--cats); }
.team-dogs { --team: var(--dogs); }

/* ---------- buttons ---------- */
.btn {
  border: 2px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .08s, background .15s, border-color .15s;
  min-height: 44px;
}
.btn:hover:not(:disabled) { border-color: #4b77ad; background: #23426a; }
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #ffd65e, var(--gold)); border-color: var(--gold-dark); color: #2b1a00; box-shadow: 0 4px 0 var(--gold-dark); }
.btn.primary:hover:not(:disabled) { background: #ffdf7a; border-color: var(--gold-dark); }
.btn.primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--gold-dark); transform: translateY(3px); }
.btn.danger { background: var(--bad); border-color: #c73a3f; color: #fff; }
.btn.danger-outline { border-color: #7a3540; color: #ffb3b6; background: transparent; }
.btn.danger-outline:hover:not(:disabled) { background: #3a1d27; border-color: var(--bad); }
.btn.haki { border-color: var(--haki); color: #e3d4ff; }
.btn.big { font-size: 18px; padding: 14px 22px; min-height: 54px; }
.btn.wide { width: 100%; }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 13px; margin-left: 8px; }
.link-btn { background: none; border: 0; color: var(--dim); text-decoration: underline; cursor: pointer; padding: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); font-weight: 800; cursor: pointer; font-size: 17px; }

/* ---------- shared bits ---------- */
.card {
  background: linear-gradient(180deg, var(--panel) 0%, #12253d 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 10px 30px -15px #000;
}
.grid { display: grid; gap: 14px; }
.chip, .pill, .tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 800;
  padding: 3px 9px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.dim { color: var(--dim); }
.pill.good { background: #0f3b29; border-color: #1f7a4f; color: #7ff0b1; }
.tag.cat-logia { background: #3a1f48; border-color: #6c3d86; }
.tag.cat-paramecia { background: #1f3a48; border-color: #3d6c86; }
.tag.cat-zoan { background: #3f3018; border-color: #7a5b2a; }
/* One colour per rarity. Everything that shows a rarity uses var(--rc). */
.r-common    { --rc: #9fb3cf; }
.r-uncommon  { --rc: #3ddc84; }
.r-rare      { --rc: #4ea8ff; }
.r-epic      { --rc: #b48cff; }
.r-legendary { --rc: #ffc93c; }
.r-mythical  { --rc: #ff5a8a; }
.tag[class*="r-"] { color: var(--rc); border-color: var(--rc); }
.tag.r-legendary { color: #2b1a00; background: var(--rc); }
.tag.r-mythical { color: #fff; background: linear-gradient(90deg, #ff5a8a, #b48cff, #4ea8ff); border-color: #fff; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.hint { color: var(--dim); font-size: 13px; margin: 10px 0; }
.warn { color: #ffd58a; background: #3a2a10; border: 1px solid #7a5a1f; border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.big-note { font-weight: 800; color: var(--gold); text-align: center; font-size: 17px; }
.gem { font-size: .9em; }
.cap { font-size: 12px; font-weight: 800; color: var(--dim); background: var(--bg2); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; }
.cap.big { font-size: 14px; padding: 4px 12px; color: var(--text); }
.badge { font-weight: 800; color: var(--team); white-space: nowrap; }
.fruit-art { display: block; flex-shrink: 0; filter: drop-shadow(0 6px 8px rgba(0,0,0,.4)); }

/* Health bar */
.hp { display: flex; align-items: center; gap: 8px; width: 100%; }
.hp span { font-weight: 800; font-size: 13px; min-width: 34px; text-align: right; }
.hp-bar { flex: 1; height: 10px; background: #0a1424; border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.hp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #2bc46f, var(--good)); border-radius: 99px; transition: width .45s ease; }
.hp-bar.mid i { background: linear-gradient(90deg, #e0a414, #ffcf3c); }
.hp-bar.low i { background: linear-gradient(90deg, #d93b40, var(--bad)); }

/* ---------- title screen ---------- */
.title-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px calc(32px + env(safe-area-inset-bottom));
  text-align: center; gap: 14px;
}
.title-fruits { display: flex; gap: 6px; }
.title-fruits svg { animation: bob 3s ease-in-out infinite; }
.title-fruits svg:nth-child(2) { animation-delay: -1s; transform: scale(1.2); }
.title-fruits svg:nth-child(3) { animation-delay: -2s; }
@keyframes bob { 50% { translate: 0 -10px; } }
.logo {
  font-size: clamp(54px, 15vw, 96px); line-height: .9;
  color: var(--gold);
  text-shadow: 0 4px 0 #b36b00, 0 8px 0 #5a2f00, 0 14px 24px rgba(0,0,0,.6);
  transform: rotate(-3deg);
}
.tagline { color: var(--dim); margin: 6px 0 4px; font-weight: 700; }
.title-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.title-card form { display: flex; flex-direction: column; gap: 12px; }
.or { text-align: center; color: var(--dim); font-size: 13px; }
.field-label { font-weight: 800; font-size: 13px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 10px 6px; min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg2); font-weight: 800;
}
.seg span small { font-weight: 600; color: var(--dim); font-size: 12px; }
.seg input:checked + span { border-color: var(--gold); background: #2b2a1e; box-shadow: 0 0 0 3px rgba(255,201,60,.15); }
.seg input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); flex-shrink: 0; margin-top: 1px; }
.home-link { color: var(--dim); font-size: 13px; }

/* ---------- dashboard ---------- */
.dash { max-width: 1100px; margin: 0 auto; padding: 0 16px calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; gap: 8px; padding: 12px 0; flex-wrap: wrap; }
.top .grow { flex: 1; }
.brand { font-family: var(--display); font-size: 24px; letter-spacing: 1px; color: var(--gold); background: none; border: 0; cursor: pointer; padding: 0 4px 0 0; }
.turnbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--team) 30%, var(--panel)), var(--panel));
  border: 2px solid var(--team); border-radius: var(--radius); padding: 10px 12px;
}
.turn-who { display: flex; align-items: center; gap: 10px; }
.big-emoji { font-size: 34px; line-height: 1; }
.turn-title { font-size: 26px; color: var(--team); line-height: 1; }
.turn-sub { color: var(--dim); font-size: 13px; font-weight: 700; }
.score { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.pchip { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; opacity: .75; }
.pchip.on { opacity: 1; border-color: var(--team); }
.pchip-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 4px; }
.rec { font-size: 12px; color: var(--dim); font-weight: 800; }
.pchip-gems { font-size: 13px; font-weight: 800; margin-top: 4px; color: var(--dim); }

/* Tabs sit along the bottom on phones */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: rgba(11, 22, 38, .96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabbar); border: 0; background: none; color: var(--dim);
  font-size: 12px; font-weight: 800; cursor: pointer;
}
.tab span { font-size: 22px; line-height: 1; transition: transform .15s; }
.tab.on { color: var(--gold); }
.tab.on span { transform: scale(1.15); }
.panel { margin-top: 6px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0 8px; }

/* Home */
.stats li { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #24405f; gap: 8px; }
.stats li:last-child { border-bottom: 0; }
.stats li > span:first-child { flex: 1; }
.stats li.col { flex-direction: column; align-items: stretch; }
.stats strong { font-size: 17px; }
.stats strong.glow { color: var(--gold); text-shadow: 0 0 12px rgba(255,201,60,.6); }
.mini-fruits { display: grid; gap: 8px; }
.mini-fruit { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; text-align: left; font-weight: 800; }
.mini-fruit.on { border-color: var(--gold); }
.mini-fruit small { display: block; color: var(--dim); font-weight: 600; }
.log li { padding: 6px 0; border-bottom: 1px solid #1d3352; font-size: 14px; color: #cfdbee; }
.log li:first-child { color: var(--text); font-weight: 700; }

/* Fruit cards */
.fruit-grid { display: grid; gap: 14px; }
.fruit-card {
  background: linear-gradient(180deg, var(--panel) 0%, #12253d 100%);
  border: 2px solid var(--line); border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.fruit-card:not(.r-common):not(.empty) { border-color: color-mix(in srgb, var(--rc) 55%, var(--line)); }
.fruit-card.r-legendary, .fruit-card.r-mythical { box-shadow: 0 0 24px -8px var(--rc); }
.fruit-card.r-mythical { animation: mythic 3s linear infinite; }
@keyframes mythic { 33% { border-color: #b48cff; } 66% { border-color: #4ea8ff; } }
.fruit-card.equipped { outline: 3px solid var(--gold); outline-offset: 2px; }
.fruit-card.empty {
  border-style: dashed; align-items: center; justify-content: center; min-height: 180px;
  color: var(--dim); font-weight: 800; cursor: pointer; background: transparent;
}
.fruit-card.empty span { font-size: 40px; line-height: 1; }
.fruit-card.empty small { font-weight: 600; }
.fc-head { display: flex; gap: 12px; align-items: center; position: relative; }
.fc-head h3 { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 400; letter-spacing: 1px; }
.fc-head .eq { position: absolute; top: 0; right: 0; }
.dmg { font-size: 13px; font-weight: 800; color: #ffb38a; }
.mastery .m-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; color: var(--dim); margin-bottom: 4px; }
.mastery .m-label strong { color: var(--text); }
.m-bar { position: relative; height: 10px; background: #0a1424; border: 1px solid var(--line); border-radius: 99px; }
.m-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--haki), #e3a8ff); }
.m-bar b { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--gold); border-radius: 2px; }
.moves li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 10px; background: var(--bg2); margin-bottom: 6px; font-size: 14px; }
.moves li.locked { opacity: .55; }
.mv-name { font-weight: 800; }
.mv-info { color: var(--dim); font-size: 13px; font-weight: 700; text-align: right; }
.fc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.fc-actions .btn { flex: 1; }

/* Roll */
.roll-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.roll-card p { margin: 0; }
.roll-hero { display: flex; gap: 4px; }
.roll-hero svg { animation: bob 2.6s ease-in-out infinite; }
.roll-hero svg:nth-child(2) { animation-delay: -.9s; }
.roll-hero svg:nth-child(3) { animation-delay: -1.7s; }
.odds { display: flex; flex-wrap: wrap; gap: 10px; }
.odds li { display: flex; align-items: center; gap: 6px; }
.pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.pool li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); font-weight: 800; font-size: 14px; }
.pool li:not(.r-common) { border-color: color-mix(in srgb, var(--rc) 55%, var(--line)); }
.pool small { display: block; font-weight: 600; color: var(--dim); font-size: 12px; }

/* Shop */
.shop-item { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed #24405f; }
.shop-item:last-child { border-bottom: 0; }
.si-main h4 { margin: 0 0 2px; }
.si-main p { margin: 0; color: var(--dim); font-size: 13px; }
.si-main.row { display: flex; align-items: center; gap: 10px; }
.si-main .req { color: #c7b3f7; font-size: 12px; font-weight: 700; }
.si-main .req.good { color: var(--good); }
.si-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.si-buy small { color: var(--dim); font-size: 11px; font-weight: 700; max-width: 110px; text-align: right; }

/* Battle tab */
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-bottom: 14px; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.vs-fruit { font-weight: 800; font-size: 14px; }
.vs-mid { font-size: 40px; color: var(--gold); text-shadow: 0 3px 0 #b36b00; }
.mystery { width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 40px; background: var(--bg2); border: 2px dashed var(--line); color: var(--dim); }
.rules li { padding-left: 18px; position: relative; margin-bottom: 6px; font-size: 14px; }
.rules li::before { content: "🍎"; position: absolute; left: -2px; font-size: 11px; top: 3px; }
.panel > .btn.big.wide { margin-top: 14px; }

/* ---------- modals, toasts, overlays ---------- */
#layer { position: relative; z-index: 50; }
.modal-back, .overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background: rgba(3, 8, 16, .72); backdrop-filter: blur(4px);
  animation: fade .15s ease;
}
.modal-back.closing { opacity: 0; transition: opacity .15s; }
.modal {
  width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--panel); border: 2px solid var(--line); border-radius: 18px;
  padding: 18px; box-shadow: 0 30px 60px -20px #000;
  animation: pop .22s cubic-bezier(.2,1.4,.4,1);
}
.modal.wide { max-width: 560px; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.modal h2 { font-size: 30px; color: var(--gold); margin-bottom: 8px; }
.modal-body p { margin: 8px 0; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; justify-content: flex-end; }
.modal-actions .btn { flex: 1 1 auto; }
.confirm-fruit { display: flex; align-items: center; gap: 12px; }
.cpu-lines li { padding: 6px 10px; background: var(--bg2); border-radius: 8px; margin-bottom: 6px; }
.help h4 { color: var(--gold); }
.help ul { padding-left: 18px; list-style: disc; }
.help li { margin-bottom: 4px; font-size: 14px; }
.settings { display: flex; flex-direction: column; gap: 10px; }

#toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #213b5e; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-weight: 800; box-shadow: 0 10px 20px -10px #000; animation: pop .2s ease; transition: opacity .4s, transform .4s; text-align: center; }
.toast.good { border-color: #1f7a4f; background: #10372a; }
.toast.bad { border-color: #7a3540; background: #3a1820; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* Pass the device */
.overlay.pass { background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--team) 35%, var(--bg)), var(--bg) 70%); backdrop-filter: none; }
.pass-box { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 360px; }
.pass-emoji { font-size: 90px; animation: bob 2s ease-in-out infinite; }
.pass-box h2 { font-size: 48px; color: var(--team); }

/* Roulette */
.reel-box { width: 100%; max-width: 760px; text-align: center; }
.reel-box h2 { font-size: 40px; color: var(--gold); margin-bottom: 14px; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.reel { position: relative; overflow: hidden; border: 3px solid var(--gold); border-radius: 18px; background: var(--bg2); padding: 14px 0; box-shadow: 0 0 40px -10px rgba(255,201,60,.6); }
.reel::before, .reel::after { content: ""; position: absolute; top: 0; bottom: 0; width: 18%; z-index: 2; pointer-events: none; }
.reel::before { left: 0; background: linear-gradient(90deg, var(--bg2), transparent); }
.reel::after { right: 0; background: linear-gradient(-90deg, var(--bg2), transparent); }
.reel-pointer { position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: var(--gold); z-index: 3; box-shadow: 0 0 12px var(--gold); }
.reel-pointer::before { content: ""; position: absolute; left: 50%; top: -2px; transform: translateX(-50%); border: 10px solid transparent; border-top-color: var(--gold); }
.reel-strip { display: flex; gap: 10px; padding: 0 10px; will-change: transform; }
.reel-tile { flex: 0 0 96px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px; background: var(--panel); border: 2px solid var(--line); font-weight: 800; font-size: 13px; }
.reel-tile:not(.r-common) { border-color: var(--rc); }
.reel-tile.r-legendary, .reel-tile.r-mythical { background: color-mix(in srgb, var(--rc) 18%, var(--panel)); }
.reel-tile.win { transform: scale(1.12); border-color: #fff; box-shadow: 0 0 30px var(--gold); transition: transform .3s; }

/* Reveal */
.reveal { text-align: center; }
.reveal-art { display: flex; justify-content: center; position: relative; padding: 8px; }
.reveal-art::before { content: ""; position: absolute; inset: 10% 25%; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.35), transparent 70%); animation: glow 2s ease-in-out infinite; }
.reveal:not(.r-common) .reveal-art::before { background: radial-gradient(circle, color-mix(in srgb, var(--rc) 70%, transparent), transparent 70%); }
@keyframes glow { 50% { transform: scale(1.15); opacity: .7; } }
.reveal-art svg { position: relative; animation: reveal .7s cubic-bezier(.2,1.5,.4,1); }
@keyframes reveal { from { transform: scale(.2) rotate(-40deg); opacity: 0; } }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.facts div { background: var(--bg2); border-radius: 10px; padding: 6px; }
.facts dt { font-size: 11px; color: var(--dim); font-weight: 800; text-transform: uppercase; }
.facts dd { margin: 0; font-weight: 800; }
.reveal h4 { text-align: left; }

/* ---------- battle ---------- */
.overlay.battle {
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  overflow-y: auto; padding: 12px 12px calc(16px + env(safe-area-inset-bottom));
  background: radial-gradient(900px 500px at 50% 0%, #22406a, transparent 70%), linear-gradient(180deg, #0c1a2e, #050b14);
  backdrop-filter: none; gap: 10px;
}
.overlay.battle.flash { animation: flash .6s ease; }
@keyframes flash { 30% { background: #3a2266; } }
.b-head { text-align: center; font-weight: 800; color: var(--dim); }
.arena {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "a b" "c c"; gap: 10px;
  width: 100%; max-width: 900px; margin: 0 auto;
}
#f0 { grid-area: a; } #f1 { grid-area: b; }
.arena .center { grid-area: c; display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 150px; justify-content: center; }
.fighter {
  background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  transition: border-color .2s, box-shadow .2s;
}
.fighter.acting { border-color: var(--team); box-shadow: 0 0 0 3px color-mix(in srgb, var(--team) 30%, transparent), 0 0 30px -8px var(--team); }
.fighter.hit { animation: shake .45s ease; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); background: #4a1a22; } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.f-team { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.f-haki { font-size: 14px; }
.f-art { animation: bob 3s ease-in-out infinite; }
.f-fruit { font-weight: 800; font-size: 13px; color: var(--dim); }
.energy { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; color: #c7b3f7; flex-wrap: wrap; justify-content: center; }
.energy i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--haki); }
.energy i.on { background: var(--haki); box-shadow: 0 0 6px var(--haki); }
.status { min-height: 20px; font-size: 13px; font-weight: 800; color: #ffb38a; }
.coin-wrap { perspective: 600px; height: 96px; display: flex; align-items: flex-end; }
.coin { width: 84px; height: 84px; position: relative; transform-style: preserve-3d; }
.coin .face {
  position: absolute; inset: 0; border-radius: 50%; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: grid; place-items: center; font-family: var(--display); font-size: 22px; letter-spacing: 1px;
  border: 4px solid; box-shadow: inset 0 -6px 0 rgba(0,0,0,.2);
}
.coin .heads { background: radial-gradient(circle at 35% 30%, #fff1b8, var(--gold) 60%, #c98a00); border-color: #a86f00; color: #4a2c00; }
.coin .tails { background: radial-gradient(circle at 35% 30%, #e6edf7, #9fb3cf 60%, #6c809c); border-color: #56677f; color: #1d2838; transform: rotateY(180deg); }
.caption { min-height: 48px; text-align: center; font-weight: 800; font-size: 17px; max-width: 520px; }
.controls { width: 100%; max-width: 900px; margin: 0 auto; }
.ctl-title { text-align: center; font-weight: 800; font-size: 17px; margin-bottom: 8px; color: var(--team); }
.moves-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.move-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 12px; min-height: 60px; border-radius: 14px; cursor: pointer;
  border: 2px solid var(--team, var(--line)); background: linear-gradient(180deg, var(--panel2), var(--panel));
  touch-action: manipulation;
}
.move-btn:hover { background: #23426a; }
.move-btn:active { transform: translateY(2px); }
.move-btn span { font-size: 12px; color: var(--dim); font-weight: 700; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; justify-content: center; }
.toggle { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 2px solid var(--haki); border-radius: 12px; font-weight: 800; cursor: pointer; min-height: 44px; }
.toggle input { width: 20px; height: 20px; accent-color: var(--haki); }
.toggle.off { opacity: .45; }
.blog { width: 100%; max-width: 900px; margin: 0 auto; color: var(--dim); font-size: 13px; }
.blog summary { cursor: pointer; font-weight: 800; padding: 6px 0; }
.blog ol { padding-left: 20px; max-height: 160px; overflow: auto; }

/* Results */
.results { display: grid; gap: 10px; }
.res { background: var(--bg2); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.res.won { border-color: var(--gold); }
.res h4 { margin: 0 0 6px; font-size: 16px; }
.res li { font-size: 14px; padding: 2px 0; }
.res .gain { color: var(--good); font-weight: 800; }
.new-move { color: var(--gold); font-weight: 800; }

/* ---------- training ---------- */
.train-info p { margin: 0 0 10px; }
.good-text { color: var(--good); }
.pips { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; color: var(--dim); }
.pips span { margin-right: 4px; }
.pips i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--gold); }
.pips i.on { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.fruit-grid { margin-top: 14px; }
.train-card { align-items: center; text-align: center; }
.train-card .mastery { width: 100%; }
.train-card h3 { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 400; letter-spacing: 1px; justify-content: center; }
.dojo { position: relative; padding: 6px 30px 10px; }
.dojo .fruit-art { animation: bob 2.4s ease-in-out infinite; }
.dojo-floor { position: absolute; left: 10px; right: 10px; bottom: 0; height: 10px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.45), transparent); }
.next-move { margin: 0; font-size: 14px; color: var(--dim); }
.next-move b { color: var(--gold); }
.why { color: var(--dim); font-weight: 700; }
.m-bar i { transition: width .7s cubic-bezier(.2,.9,.3,1); }
.fruit-card.training { animation: train-pop .9s ease; }
.fruit-card.training .fruit-art { animation: train-punch .9s ease; }
@keyframes train-pop { 30% { box-shadow: 0 0 0 4px var(--gold), 0 0 40px -6px var(--gold); } }
@keyframes train-punch {
  15% { transform: translateX(-10px) rotate(-12deg) scale(.95); }
  30% { transform: translateX(14px) rotate(10deg) scale(1.12); }
  45% { transform: translateX(-8px) rotate(-6deg); }
  60% { transform: translateY(-14px) scale(1.15); }
  80% { transform: translateY(0) scale(1); }
}
.overlay.new-move-overlay { background: rgba(3, 8, 16, .8); cursor: pointer; }
.new-move-box { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
.new-move-box .fruit-art { position: relative; animation: bob 2s ease-in-out infinite; }
.nm-rays { position: absolute; top: -60px; width: 260px; height: 260px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255,201,60,.35) 0 10deg, transparent 10deg 20deg);
  mask: radial-gradient(circle, #000 30%, transparent 70%); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%);
  animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nm-label { position: relative; font-weight: 800; color: var(--dim); letter-spacing: 2px; }
.nm-name { position: relative; font-family: var(--display); font-size: clamp(36px, 10vw, 60px); color: var(--gold); text-shadow: 0 4px 0 #b36b00; line-height: 1; }
.new-move-box small { color: var(--dim); }

/* ---------- battle effects ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.fx { position: fixed; pointer-events: none; will-change: transform, opacity; }
.particle { font-size: 20px; line-height: 1; }
.float-text { font-family: var(--display); font-size: 34px; letter-spacing: 1px; white-space: nowrap; text-shadow: 0 3px 0 #000, 0 0 12px rgba(0,0,0,.6); }
.float-text.dmg { color: var(--bad); font-size: 44px; }
.float-text.heal { color: var(--good); }
.float-text.miss { color: #c9d4e4; }
.float-text.dodge { color: var(--haki); }
.float-text.mastery { color: var(--gold); font-size: 28px; }
.orb {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 18px;
  background: radial-gradient(circle at 35% 35%, #fff, var(--c) 45%, color-mix(in srgb, var(--c) 60%, #000));
  box-shadow: 0 0 18px 6px var(--g), 0 0 40px 10px color-mix(in srgb, var(--g) 50%, transparent);
}
.orb.armed { background: radial-gradient(circle at 35% 35%, #9a8cff, #1a1426 55%, #000); box-shadow: 0 0 18px 6px #6b4cff, 0 0 40px 10px rgba(30,0,60,.7); }
.beam {
  height: 12px; transform-origin: 0 50%; border-radius: 99px;
  background: linear-gradient(90deg, transparent, #fff 15%, var(--c) 50%, #fff 85%, transparent);
  box-shadow: 0 0 20px 6px var(--c);
}
.ring { width: 60px; height: 60px; border-radius: 50%; border: 5px solid var(--c); box-shadow: 0 0 20px var(--c); }
.ring.conq { --c: #b48cff; border-width: 8px; }
.arena { position: relative; }
.callout {
  position: absolute; left: 50%; top: 38%; z-index: 5; pointer-events: none;
  font-family: var(--display); font-size: clamp(32px, 9vw, 56px); letter-spacing: 2px; white-space: nowrap;
  color: var(--team); -webkit-text-stroke: 2px #000; text-shadow: 0 5px 0 #000;
  animation: callout 1.2s ease forwards;
}
@keyframes callout {
  0% { transform: translate(-50%, -50%) scale(2.4) rotate(-6deg); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1) rotate(-4deg); opacity: 1; }
  75% { transform: translate(-50%, -50%) scale(1.05) rotate(-4deg); opacity: 1; }
  100% { transform: translate(-50%, -70%) scale(1) rotate(-4deg); opacity: 0; }
}
.fighter.lunge-0 { animation: lunge-r .5s ease; }
.fighter.lunge-1 { animation: lunge-l .5s ease; }
@keyframes lunge-r { 40% { transform: translateX(26px) scale(1.04); } }
@keyframes lunge-l { 40% { transform: translateX(-26px) scale(1.04); } }
.fighter.armed { box-shadow: 0 0 0 3px #6b4cff, 0 0 40px 4px #6b4cff; }
.fighter.armed .f-art { filter: drop-shadow(0 0 10px #6b4cff) brightness(.75) contrast(1.3); }
.fighter.dodge { animation: dodge .7s ease; }
@keyframes dodge { 30% { transform: translateY(-18px) translateX(14px); opacity: .45; } 60% { transform: translateX(-6px); opacity: .8; } }
.fighter.dizzy .f-art { animation: dizzy 1s ease; }
@keyframes dizzy { 25% { transform: rotate(-18deg); } 50% { transform: rotate(16deg); } 75% { transform: rotate(-10deg); } }
.fighter.swap .f-art { animation: swap .7s ease; }
@keyframes swap { 50% { transform: rotateY(90deg) scale(.6); } }
.fighter.ko { animation: ko .8s ease forwards; }
@keyframes ko { to { filter: grayscale(1) brightness(.6); transform: rotate(-4deg) translateY(8px); } }
.overlay.battle.quake { animation: quake .6s ease, flash .6s ease; }
@keyframes quake { 15% { transform: translate(-8px, 4px); } 30% { transform: translate(8px, -6px); } 45% { transform: translate(-6px, 6px); } 60% { transform: translate(5px, -3px); } 80% { transform: translate(-2px, 2px); } }

/* ---------- bigger screens ---------- */
@media (min-width: 700px) {
  body { font-size: 16px; }
  .dash { padding-bottom: 32px; }
  .tabs {
    position: static; background: none; backdrop-filter: none; border: 0; padding: 0;
    display: flex; gap: 8px; margin: 4px 0 12px;
  }
  .tab { flex-direction: row; height: 44px; padding: 0 16px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel); font-size: 15px; gap: 8px; color: var(--text); }
  .tab span { font-size: 18px; }
  .tab.on { border-color: var(--gold); background: #2b2a1e; }
  .tab.on span { transform: none; }
  #toasts { bottom: 24px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .grid .span { grid-column: 1 / -1; }
  .fruit-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .moves-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .arena { grid-template-columns: 1fr 220px 1fr; grid-template-areas: "a c b"; align-items: center; }
  .overlay.battle { justify-content: center; }
  .turn-title { font-size: 30px; }
}
@media (min-width: 1000px) {
  .grid.home3 { grid-template-columns: 1fr 1fr 1fr; }
}

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