/* ===== OVER 9000 — thème Dragon Ball ===== */
:root {
  --bg: #070b18;
  --panel: #101830;
  --panel2: #16203f;
  --border: #1e2a4a;
  --text: #e8ecf8;
  --muted: #8b96b8;
  --orange: #ff9d2e;
  --gold: #ffd54d;
  --green: #86ff6b;
  --red: #ff5252;
  --blue: #4dc9ff;
  --aura: #9aa7c0;
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #ffffff55, transparent),
    radial-gradient(1px 1px at 78% 8%, #ffffff44, transparent),
    radial-gradient(1.5px 1.5px at 88% 32%, #9ecbff44, transparent),
    radial-gradient(1px 1px at 32% 42%, #ffffff33, transparent),
    radial-gradient(1.2px 1.2px at 62% 58%, #ffd54d33, transparent),
    radial-gradient(1px 1px at 18% 72%, #ffffff3b, transparent),
    radial-gradient(1.4px 1.4px at 92% 78%, #ffffff2e, transparent),
    radial-gradient(1px 1px at 48% 88%, #9ecbff33, transparent),
    radial-gradient(ellipse 80% 50% at 50% -10%, #14204588, transparent);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  padding-bottom: 90px;
  overscroll-behavior-y: contain;
}
button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; }

.screen { display: none; padding: 16px; max-width: 560px; margin: 0 auto; }
.screen.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-size: 1.5rem; letter-spacing: .5px; }
h2 { font-size: 1.15rem; margin-bottom: 12px; }
.title-dbz {
  font-weight: 900; font-style: italic; text-transform: uppercase;
  background: linear-gradient(180deg, var(--gold), var(--orange));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 12px #ff9d2e33;
}

/* ===== Scouter splash ===== */
#splash {
  position: fixed; inset: 0; z-index: 100; background: #03150a;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; transition: opacity .4s ease;
  background-image:
    repeating-linear-gradient(0deg, #86ff6b0e 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, #86ff6b0e 0 1px, transparent 1px 28px),
    radial-gradient(circle at 50% 45%, #0a3517, #03150a 75%);
}
#splash.hidden { opacity: 0; pointer-events: none; }
.scouter-label { color: var(--green); font-family: Consolas, monospace; letter-spacing: 4px; font-size: .85rem; animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.scouter-ring {
  width: 190px; height: 190px; border-radius: 50%;
  border: 3px solid var(--green); box-shadow: 0 0 30px #86ff6b55, inset 0 0 30px #86ff6b22;
  outline: 1px solid #86ff6b44; outline-offset: 9px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  position: relative; overflow: hidden;
}
.scouter-ring::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(50% - 1px), #86ff6b2e calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(50% - 1px), #86ff6b2e calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}
.scouter-ring::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, #86ff6b26 50%, transparent 60%);
  animation: scan 1.4s linear infinite;
}
@keyframes scan { from { transform: translateY(-100%); } to { transform: translateY(100%); } }
#splash-pl { font-family: Consolas, monospace; font-size: 2.4rem; font-weight: 700; color: var(--green); text-shadow: 0 0 14px #86ff6b88; }
.scouter-sub { color: #4cbf46; font-size: .72rem; font-family: Consolas, monospace; letter-spacing: 2px; }
#splash-transfo { color: var(--green); font-family: Consolas, monospace; font-size: .95rem; letter-spacing: 1px; }

/* ===== Cards & layout ===== */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); font-size: .85rem; }
.small { font-size: .78rem; }

/* ===== Dashboard hero ===== */
.hero { text-align: center; padding: 22px 16px; position: relative; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: -45%;
  background: repeating-conic-gradient(from 0deg, #ff9d2e0d 0deg 9deg, transparent 9deg 20deg);
  animation: spin 32s linear infinite; pointer-events: none;
}
.hero::after {
  content: '気'; position: absolute; right: 4px; top: -6px; font-size: 5rem; font-weight: 900;
  color: #ffffff08; pointer-events: none;
}
.hero > * { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }
.avatar-wrap { width: 158px; height: 150px; margin: 0 auto 4px; }
.avatar-svg { width: 100%; height: 100%; }
.flame-out path, .flame-in path { transform-box: fill-box; transform-origin: 50% 100%; }
.flame-out path { animation: flick 1.7s ease-in-out infinite; }
.flame-in path { animation: flick 1.15s ease-in-out infinite reverse; }
@keyframes flick { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.08) scaleX(.95); } }
.zap { animation: zapblink 2.3s linear infinite; }
@keyframes zapblink {
  0%, 7%, 13%, 54%, 62%, 100% { opacity: 0; }
  9%, 11%, 56%, 60% { opacity: 1; }
}
.pl-value {
  font-family: Consolas, monospace; font-size: 2.6rem; font-weight: 800;
  color: var(--gold); text-shadow: 0 0 18px #ffd54d44; line-height: 1.1;
}
.transfo-name { font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; text-shadow: 0 0 16px currentColor; }
.pl-bar { height: 10px; background: #0b1226; border-radius: 6px; overflow: hidden; margin-top: 12px; border: 1px solid var(--border); }
.pl-bar > div {
  height: 100%; background: linear-gradient(90deg, var(--orange), var(--gold)); border-radius: 6px;
  transition: width .6s ease; position: relative; overflow: hidden;
}
.pl-bar > div::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 25%, #ffffff8c 50%, transparent 75%);
  transform: translateX(-100%); animation: shimmer 2.8s ease-in-out infinite;
}
@keyframes shimmer { 55%, 100% { transform: translateX(100%); } }

/* ===== Gravity / streak ===== */
.gravity-badge {
  font-family: Consolas, monospace; font-weight: 800; font-size: 1.5rem; color: var(--blue);
  background: #0b1226; border: 1px solid var(--border); border-radius: 12px; padding: 8px 14px;
}
.danger { color: var(--red); }

/* ===== Dragon balls ===== */
.dballs { display: flex; justify-content: space-between; gap: 4px; }
.dball {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #b33;
  background: radial-gradient(circle at 32% 28%, #ffdf8a, #ff9d2e 55%, #d97706);
  box-shadow: 0 0 10px #ff9d2e66, inset -3px -4px 8px #b4550088;
  position: relative; overflow: hidden;
}
.dball:not(.locked)::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(120deg, transparent 32%, #ffffff70 48%, transparent 62%);
  transform: translateX(-100%); animation: shimmer 3.4s ease-in-out infinite;
}
.dball.locked { filter: grayscale(1) brightness(.45); box-shadow: none; }
.dball .stars { letter-spacing: -2px; }

/* ===== Buttons ===== */
.btn {
  display: block; width: 100%; padding: 15px; border-radius: 14px; font-size: 1.05rem;
  font-weight: 800; color: #1a1200; text-transform: uppercase; letter-spacing: .5px; font-style: italic;
  background: linear-gradient(180deg, var(--gold), var(--orange));
  box-shadow: 0 4px 14px #ff9d2e33; margin-bottom: 10px;
}
.btn:active { transform: scale(.98); filter: brightness(1.2); }
.btn.secondary { background: var(--panel2); color: var(--text); border: 1px solid var(--border); box-shadow: none; font-style: normal; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px dashed var(--border); box-shadow: none; font-style: normal; font-weight: 600; text-transform: none; }
.btn.danger-btn { background: linear-gradient(180deg, #ff6b6b, #d32f2f); color: #fff; }
.btn:disabled { opacity: .45; }
.btn-sm { padding: 8px 14px; border-radius: 10px; font-size: .85rem; font-weight: 700; width: auto; display: inline-block; margin: 0; }

/* ===== Activity list ===== */
.act-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.act-item:last-child { border-bottom: none; }
.act-ico { font-size: 1.4rem; width: 38px; height: 38px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--panel2); border-radius: 10px; }
.act-main { flex: 1; min-width: 0; }
.act-pl { font-family: Consolas, monospace; color: var(--gold); font-weight: 700; white-space: nowrap; }

/* ===== Workout ===== */
.exo-card { margin-bottom: 12px; }
.exo-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.exo-name { font-weight: 700; }
.last-hint { color: var(--muted); font-size: .78rem; margin-bottom: 8px; }
.set-row { display: grid; grid-template-columns: 30px 1fr 1fr 52px; gap: 8px; align-items: center; margin-bottom: 8px; }
.set-num { color: var(--muted); font-family: Consolas, monospace; font-weight: 700; text-align: center; }
.set-row input {
  width: 100%; padding: 11px 8px; border-radius: 10px; border: 1px solid var(--border);
  background: #0b1226; color: var(--text); font-size: 1.05rem; text-align: center;
  font-family: Consolas, monospace;
}
.set-row input:focus { outline: none; border-color: var(--orange); }
.set-check {
  height: 44px; border-radius: 10px; font-size: 1.15rem; font-weight: 800;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--border);
}
.set-check.done { background: linear-gradient(180deg, #9dff7a, #4caf50); color: #0a2807; border: none; }
.link-btn { background: none; color: var(--blue); font-size: .85rem; font-weight: 600; padding: 6px 0; }
.link-btn.rm { color: var(--red); }

/* ===== Rest timer ===== */
#rest-timer {
  position: fixed; left: 0; right: 0; bottom: 70px; z-index: 40;
  background: linear-gradient(180deg, #16203f, #101830); border-top: 2px solid var(--orange);
  padding: 12px 18px; display: none; align-items: center; gap: 14px;
  box-shadow: 0 -6px 24px #00000088;
}
#rest-timer.on { display: flex; }
.rest-wrap { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.rest-wrap svg { width: 100%; height: 100%; }
#rest-ring { transition: stroke-dashoffset 1s linear; filter: drop-shadow(0 0 4px var(--orange)); }
#rest-count {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: Consolas, monospace; font-size: 1.05rem; font-weight: 800; color: var(--orange);
}

/* ===== Modals ===== */
.modal-bg {
  position: fixed; inset: 0; background: #05081290; backdrop-filter: blur(3px);
  z-index: 60; display: none; align-items: flex-end; justify-content: center;
}
.modal-bg.on { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 560px; max-height: 82vh; overflow-y: auto; padding: 20px;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Celebration */
.modal.celebrate {
  border-radius: 20px; margin: auto; text-align: center; border-color: var(--gold);
  box-shadow: 0 0 60px #ffd54d33; position: relative; overflow: hidden;
}
.modal.celebrate::before {
  content: ''; position: absolute; left: -60%; top: -60%; width: 220%; height: 220%;
  background: repeating-conic-gradient(from 0deg, #ffd54d1c 0deg 10deg, transparent 10deg 22deg);
  animation: spin 16s linear infinite; pointer-events: none;
}
.modal.celebrate > * { position: relative; }
.celebrate .big-emoji { font-size: 4rem; animation: pop .5s cubic-bezier(.2,2,.4,1); }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.celebrate h2 { font-size: 1.5rem; margin: 10px 0 6px; }
.over9000 { color: var(--green); font-family: Consolas, monospace; font-size: 2rem; font-weight: 900; animation: shake .4s linear 3; }
@keyframes shake { 25% { transform: translateX(-4px) rotate(-1deg); } 75% { transform: translateX(4px) rotate(1deg); } }

/* ===== Catalogue picker ===== */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 10px; }
.chip {
  padding: 7px 14px; border-radius: 20px; white-space: nowrap; font-size: .85rem; font-weight: 600;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--border); flex-shrink: 0;
}
.chip.sel { background: var(--orange); color: #1a1200; border-color: var(--orange); }
#exo-search {
  width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--border);
  background: #0b1226; color: var(--text); font-size: 1rem; margin-bottom: 10px;
}
.pick-item { padding: 13px 6px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.pick-item:active { background: var(--panel2); }
.pick-item .g-tag { color: var(--muted); font-size: .75rem; }

/* ===== Forms (run, settings) ===== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px; border-radius: 12px; border: 1px solid var(--border);
  background: #0b1226; color: var(--text); font-size: 1.05rem;
}
.field input:focus { outline: none; border-color: var(--orange); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pace-display { font-family: Consolas, monospace; color: var(--blue); font-size: 1.15rem; font-weight: 700; }

/* ===== Snake Way ===== */
#snake-way svg { width: 100%; height: auto; display: block; }

/* ===== Charts ===== */
.chart-box svg { width: 100%; height: auto; display: block; }

/* ===== History ===== */
.day-head { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; margin: 16px 0 6px; font-weight: 700; }
details.sess { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
details.sess summary { padding: 13px; list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; }
details.sess summary::-webkit-details-marker { display: none; }
.sess-body { padding: 0 13px 13px; border-top: 1px solid var(--border); }
.sess-body table { width: 100%; font-size: .85rem; border-collapse: collapse; margin-top: 8px; }
.sess-body td, .sess-body th { padding: 4px 6px; text-align: left; border-bottom: 1px solid var(--border); }
.sess-body th { color: var(--muted); font-weight: 600; }

/* ===== Records ===== */
.rec-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.rec-row:last-child { border: none; }
.rec-val { font-family: Consolas, monospace; color: var(--gold); font-weight: 700; }

/* ===== Bottom nav ===== */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: #0a1024ee; backdrop-filter: blur(8px); border-top: 1px solid var(--border);
  display: flex; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
#nav button {
  flex: 1; background: none; color: var(--muted); font-size: .68rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 10px;
}
#nav button .ico { font-size: 1.35rem; }
#nav button.sel { color: var(--gold); text-shadow: 0 0 12px #ffd54d66; }
#nav button.sel .ico { transform: scale(1.12); }
#nav button .ico { transition: transform .15s ease; }
#nav button .dot { position: absolute; }

/* Transformations ladder */
.tr-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.tr-row:last-child { border: none; }
.tr-aura { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }
.tr-row.locked { opacity: .38; }
.tr-row.current .tr-name { color: var(--gold); }
.tr-name { font-weight: 700; flex: 1; }
.tr-pl { font-family: Consolas, monospace; color: var(--muted); font-size: .85rem; }

.wish-banner { background: linear-gradient(90deg, #1b2a1b, #14301c); border: 1px solid #2e7d32; border-radius: 12px; padding: 12px; font-size: .9rem; }
