/* ============================================================
   DIÁRIO DE EVOLUÇÃO — style.css v3.0
   Mobile-first PWA. Bottom nav. Compact cards.
   Cyberpunk / Solo Leveling palette
   ============================================================ */

/* === VARIABLES === */
:root {
  --bg:            #020408;
  --bg2:           #050b14;
  --panel:         rgba(8, 18, 35, 0.92);
  --border:        rgba(0, 170, 255, 0.15);
  --border-bright: rgba(0, 200, 255, 0.45);
  --blue:          #00aaff;
  --cyan:          #00f5ff;
  --purple:        #9b59ff;
  --gold:          #ffd700;
  --green:         #00ff88;
  --red:           #ff3355;
  --text:          #c8e0f4;
  --text-dim:      #5a7a99;
  --text-bright:   #e8f4ff;
  --glow-blue:     0 0 16px rgba(0,170,255,0.5), 0 0 32px rgba(0,170,255,0.15);
  --glow-gold:     0 0 16px rgba(255,215,0,0.5);
  --font-main:     'Rajdhani', sans-serif;
  --font-display:  'Orbitron', sans-serif;
  --font-mono:     'Share Tech Mono', monospace;
  --r:             8px;
  --bottom-nav-h:  64px;
  /* Safe area para iPhones com notch */
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 15px;
  min-height: 100dvh;
  overflow-x: hidden;
}
a { cursor: pointer; color: var(--cyan); text-decoration: none; }
button { cursor: pointer; border: none; outline: none; font-family: var(--font-main); }
input, select { font-family: var(--font-main); }

/* === PARTICLES === */
#particles-canvas {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}

/* === SCREENS === */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}
.screen-enter {
  animation: screenEnter 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes screenEnter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================ */
/* HERO                                                          */
/* ============================================================ */
#screen-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0 6vw;
  min-height: 100dvh;
}

.hero-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
}
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0,170,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,170,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}
.hero-glow {
  position: absolute;
  width: 60vw; height: 60vw;
  top: -10vw; right: -15vw;
  background: radial-gradient(circle, rgba(155,89,255,0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-content { position: relative; z-index: 1; max-width: 520px; }
.hero-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--blue);
  letter-spacing: 0.12em;
  margin-bottom: 1rem;
  text-transform: uppercase;
}
.hero-title {
  display: flex; flex-direction: column;
  margin-bottom: 1rem;
}
.hero-title-top {
  font-family: var(--font-display);
  font-size: clamp(1rem, 5vw, 1.4rem);
  color: var(--text-dim);
  letter-spacing: 0.25em;
}
.hero-title-main {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 12vw, 5rem);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--blue), var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  min-height: 1.1em;
}
.hero-desc {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 2rem; }
.hero-stats-preview { display: flex; gap: 1.5rem; }
.stat-preview { display: flex; flex-direction: column; align-items: center; }
.sp-val { font-family: var(--font-display); font-size: 1.1rem; color: var(--blue); font-weight: 700; }
.sp-label { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.hero-footer {
  position: fixed; bottom: 1rem; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  z-index: 1;
}

/* ============================================================ */
/* AUTH                                                          */
/* ============================================================ */
.auth-container {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100dvh;
  padding: 1rem 1rem 2rem;
  overflow-y: auto;
  position: relative; z-index: 1;
}
.auth-container.wide { max-width: 520px; margin: 0 auto; width: 100%; }

.auth-back {
  align-self: flex-start;
  background: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 0.4rem 0;
  margin-bottom: 1rem;
  transition: color 0.2s;
}
.auth-back:hover { color: var(--blue); }

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
}
.auth-card.wide { max-width: 520px; }

.auth-logo {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.auth-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-bright);
  text-align: center;
  letter-spacing: 0.12em;
  margin-bottom: 0.25rem;
}
.auth-sub {
  color: var(--text-dim);
  font-size: 0.82rem;
  text-align: center;
  margin-bottom: 1.25rem;
}
.auth-switch {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 1rem;
}
.auth-switch a { color: var(--blue); cursor: pointer; }

/* ============================================================ */
/* FORMS                                                         */
/* ============================================================ */
.form-group { margin-bottom: 0.9rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.form-input {
  width: 100%;
  background: rgba(0,170,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-bright);
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0,170,255,0.12);
}
.form-input::placeholder { color: var(--text-dim); }
select.form-input { cursor: pointer; }
.form-error {
  background: rgba(255,51,85,0.12);
  border: 1px solid rgba(255,51,85,0.3);
  border-radius: var(--r);
  color: var(--red);
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}
.hidden { display: none !important; }

/* ============================================================ */
/* BUTTONS                                                       */
/* ============================================================ */
.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #000;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.7rem 1.5rem;
  border-radius: var(--r);
  transition: transform 0.15s, box-shadow 0.15s;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-primary:hover  { transform: translateY(-1px); box-shadow: var(--glow-blue); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary.full   { width: 100%; justify-content: center; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-bright);
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.7rem 1.5rem;
  border-radius: var(--r);
  transition: background 0.2s, box-shadow 0.2s;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-secondary:hover { background: rgba(0,200,255,0.06); box-shadow: var(--glow-blue); }
.btn-secondary:active { transform: scale(0.97); }

/* ============================================================ */
/* DASHBOARD                                                     */
/* ============================================================ */
#screen-dashboard {
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 0.5rem);
}

/* TOPBAR */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(2,4,8,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-brand {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--blue);
  letter-spacing: 0.1em;
  display: flex; align-items: center; gap: 0.35rem;
}
.topbar-name { color: var(--text-bright); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-hud  { display: flex; align-items: center; gap: 0.5rem; }
.hud-chip {
  background: rgba(0,170,255,0.08);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  color: var(--text);
  display: flex; align-items: center; gap: 0.2rem;
  font-family: var(--font-mono);
}
.btn-icon-top {
  background: rgba(255,51,85,0.1);
  border: 1px solid rgba(255,51,85,0.2);
  color: var(--red);
  border-radius: var(--r);
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
  transition: background 0.2s;
}
.btn-icon-top:hover { background: rgba(255,51,85,0.2); }

/* TAB CONTENT */
.tab-content {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* PLAYER CARD COMPACT */
.player-card-compact {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.pcc-avatar-wrap { position: relative; flex-shrink: 0; }
.pcc-avatar {
  width: 48px; height: 48px;
  background: rgba(0,170,255,0.08);
  border: 2px solid var(--border-bright);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.pcc-level {
  position: absolute; bottom: -4px; right: -4px;
  background: var(--blue);
  color: #000;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.pcc-info { flex: 1; min-width: 0; }
.pcc-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-bright);
  font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pcc-class {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.pcc-rank {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 0.2rem;
}
.pcc-xp-wrap { flex: 1; min-width: 80px; padding-top: 0.15rem; }
.pcc-xp-label { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-dim); margin-bottom: 0.3rem; }
.xp-bar-wrap {
  background: rgba(0,170,255,0.08);
  border: 1px solid var(--border);
  border-radius: 20px;
  height: 8px; overflow: hidden;
}
.xp-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  border-radius: 20px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 6px rgba(0,170,255,0.5);
}

/* ATTRS ROW */
.attrs-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
}
.attr-chip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.45rem 0.2rem;
  display: flex; flex-direction: column; align-items: center;
  gap: 0.1rem;
}
.ac-label {
  font-size: 0.58rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ac-val {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--blue);
  font-weight: 700;
}
.attr-bump { animation: bump 0.3s ease-out; }
@keyframes bump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); color: var(--cyan); }
  100% { transform: scale(1); }
}

/* ============================================================ */
/* PANELS                                                        */
/* ============================================================ */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--blue);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.panel-badge {
  background: rgba(0,170,255,0.12);
  border: 1px solid var(--border);
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
}

/* ============================================================ */
/* QUESTS                                                        */
/* ============================================================ */
.quests-list { padding: 0.4rem; display: flex; flex-direction: column; gap: 0.35rem; }

.quest-item {
  display: flex; align-items: flex-start; gap: 0.65rem;
  background: rgba(0,170,255,0.03);
  border: 1px solid rgba(0,170,255,0.07);
  border-radius: var(--r);
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
  animation: fadeSlideIn 0.3s ease-out both;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.quest-item:hover  { background: rgba(0,170,255,0.07); border-color: rgba(0,170,255,0.2); }
.quest-item:active { transform: scale(0.99); }
.quest-item.completed {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}
.quest-item.completed .quest-check {
  background: var(--green);
  color: #000;
  border-color: var(--green);
}
.quest-item.main-quest { border-left: 3px solid rgba(255,215,0,0.3); }

.quest-check {
  width: 20px; height: 20px;
  border: 1.5px solid var(--border-bright);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 1px;
  transition: all 0.2s;
}
.quest-main { flex: 1; min-width: 0; }
.quest-name {
  font-size: 0.88rem;
  color: var(--text);
  display: block;
  line-height: 1.3;
}
.quest-tip {
  font-size: 0.7rem;
  color: var(--text-dim);
  display: block;
  margin-top: 0.15rem;
  line-height: 1.3;
}
.quest-xp {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold);
  white-space: nowrap;
  margin-top: 2px;
}
.quest-flash { animation: questFlash 0.4s ease-out; }
@keyframes questFlash {
  0%   { background: rgba(0,255,136,0.08); }
  50%  { background: rgba(0,255,136,0.25); }
  100% { background: rgba(0,170,255,0.03); }
}

/* Custom tasks */
.custom-task-item { cursor: pointer; }
.btn-delete-task {
  background: rgba(255,51,85,0.1);
  color: var(--red);
  border: 1px solid rgba(255,51,85,0.2);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}
.btn-add-task {
  background: rgba(0,170,255,0.1);
  border: 1px solid var(--border);
  color: var(--blue);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  transition: background 0.2s;
}
.btn-add-task:hover { background: rgba(0,170,255,0.18); }

/* Task form */
.task-form {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.task-history-list {
  padding: 0 0.75rem 0.75rem;
}
.history-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(0,170,255,0.05);
  font-size: 0.8rem;
}
.history-item:last-child { border-bottom: none; }
.history-label { flex: 1; color: var(--text); }
.history-xp { color: var(--gold); font-family: var(--font-mono); font-size: 0.75rem; white-space: nowrap; }
.history-date { color: var(--text-dim); font-size: 0.7rem; font-family: var(--font-mono); white-space: nowrap; }
.empty-msg { color: var(--text-dim); font-size: 0.8rem; text-align: center; padding: 1rem; }

/* ============================================================ */
/* CLASS GRID                                                    */
/* ============================================================ */
.class-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.class-card {
  background: rgba(0,170,255,0.04);
  border: 1.5px solid rgba(0,170,255,0.1);
  border-radius: var(--r);
  padding: 0.6rem 0.4rem;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.class-card:hover  { border-color: var(--class-color, var(--blue)); background: rgba(0,170,255,0.08); }
.class-card.selected {
  border-color: var(--class-color, var(--blue));
  background: rgba(0,170,255,0.1);
  box-shadow: 0 0 10px rgba(0,170,255,0.2);
}
.class-icon { font-size: 1.4rem; display: block; margin-bottom: 0.25rem; }
.class-name { font-size: 0.7rem; color: var(--text-bright); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.class-bonus{ font-size: 0.62rem; color: var(--blue); margin-top: 0.15rem; }
.class-desc { font-size: 0.62rem; color: var(--text-dim); margin-top: 0.15rem; line-height: 1.3; display: none; }

/* Avatar grid */
.avatar-grid { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.avatar-opt {
  width: 36px; height: 36px;
  background: rgba(0,170,255,0.04);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.avatar-opt:hover  { border-color: var(--blue); background: rgba(0,170,255,0.1); }
.avatar-opt.selected { border-color: var(--cyan); background: rgba(0,245,255,0.12); }

/* ============================================================ */
/* INVENTORY                                                     */
/* ============================================================ */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 0.5rem;
  padding: 0.75rem;
}
.inv-item {
  width: 52px; height: 52px;
  background: rgba(0,170,255,0.05);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.15s;
  position: relative;
}
.inv-item.common   { border: 1px solid rgba(150,150,150,0.3); }
.inv-item.rare     { border: 1px solid rgba(68,136,255,0.5);  }
.inv-item.epic     { border: 1px solid rgba(170,68,255,0.6);  box-shadow: 0 0 8px rgba(170,68,255,0.2); }
.inv-item.legendary{ border: 1px solid rgba(255,170,0,0.7);  box-shadow: 0 0 10px rgba(255,170,0,0.25); }
.inv-item.mythic   { border: 1px solid rgba(255,68,170,0.8);  box-shadow: 0 0 14px rgba(255,68,170,0.3); animation: mythicPulse 2s ease-in-out infinite; }
.inv-item:hover    { transform: scale(1.08); }
@keyframes mythicPulse {
  0%,100% { box-shadow: 0 0 14px rgba(255,68,170,0.3); }
  50%     { box-shadow: 0 0 22px rgba(255,68,170,0.6); }
}

/* Item tooltip */
.item-tooltip {
  position: fixed;
  background: rgba(5,11,20,0.97);
  border: 1px solid var(--border-bright);
  border-radius: var(--r);
  padding: 0.65rem 0.85rem;
  min-width: 160px;
  max-width: 200px;
  z-index: 9999;
  pointer-events: none;
  box-shadow: var(--glow-blue);
}
.tooltip-name { font-size: 0.82rem; color: var(--text-bright); font-weight: 600; margin-bottom: 0.2rem; }
.tooltip-rarity {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.rarity-common    { color: #aaa; }
.rarity-rare      { color: #4488ff; }
.rarity-epic      { color: #aa44ff; }
.rarity-legendary { color: var(--gold); }
.rarity-mythic    { color: #ff44aa; }
.tooltip-desc { font-size: 0.75rem; color: var(--text-dim); }

/* ============================================================ */
/* ACHIEVEMENTS                                                  */
/* ============================================================ */
.achievements-list {
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.achievement-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0,170,255,0.05);
  animation: fadeSlideIn 0.3s ease-out both;
}
.achievement-item.locked { opacity: 0.38; }
.achievement-item:last-child { border-bottom: none; }
.ach-icon { font-size: 1.2rem; flex-shrink: 0; }
.ach-name { font-size: 0.82rem; color: var(--text); font-weight: 600; }
.ach-date { font-size: 0.7rem; color: var(--text-dim); font-family: var(--font-mono); }

/* ============================================================ */
/* RANKING                                                       */
/* ============================================================ */
.ranking-list { padding: 0.5rem 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; }
.rank-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0,170,255,0.05);
  font-size: 0.85rem;
}
.rank-item:last-child { border-bottom: none; }
.rank-item.rank-self { background: rgba(0,170,255,0.05); margin: 0 -0.75rem; padding: 0.5rem 0.75rem; border-radius: var(--r); }
.rank-pos { font-family: var(--font-display); font-size: 0.82rem; min-width: 24px; }
.rank-pos.gold   { color: var(--gold); }
.rank-pos.silver { color: #c0c0c0; }
.rank-pos.bronze { color: #cd7f32; }
.rank-name { flex: 1; color: var(--text); }
.rank-level { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); white-space: nowrap; }

/* ============================================================ */
/* STATS                                                         */
/* ============================================================ */
.stats-radar-wrap { padding: 0.75rem; display: flex; justify-content: center; }
.stats-radar-wrap svg { max-width: 260px; }

.stats-row-4col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  padding: 0 0.75rem;
}
.stats-quick-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.75rem;
  display: flex; flex-direction: column; align-items: center;
  gap: 0.2rem;
}
.sq-icon { font-size: 1.2rem; }
.sq-val {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--blue);
  font-weight: 700;
}
.sq-label { font-size: 0.7rem; color: var(--text-dim); text-align: center; }

/* Weekly chart */
.stats-weekly-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  padding: 0.75rem;
  height: 100px;
}
.weekly-col {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  height: 100%;
}
.weekly-bar-wrap {
  flex: 1; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 0.1rem;
}
.weekly-xp-label { font-size: 0.58rem; color: var(--text-dim); font-family: var(--font-mono); }
.weekly-bar {
  width: 100%;
  min-width: 20px;
  background: linear-gradient(to top, var(--blue), var(--cyan));
  border-radius: 3px 3px 0 0;
  transition: height 0.5s ease;
}
.weekly-day {
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
  font-family: var(--font-mono);
}

/* Stats bars */
.stats-bars { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.stat-bar-row { display: flex; align-items: center; gap: 0.5rem; }
.sb-label { font-size: 0.75rem; color: var(--text-dim); min-width: 100px; }
.sb-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(0,170,255,0.06);
  border-radius: 20px;
  overflow: hidden;
}
.sb-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  border-radius: 20px;
  transition: width 0.5s ease;
}
.sb-count { font-size: 0.7rem; color: var(--text-dim); font-family: var(--font-mono); min-width: 28px; text-align: right; }

/* ============================================================ */
/* BOTTOM NAV                                                    */
/* ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(2,4,8,0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 200;
}
.bnav-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.2rem;
  background: none;
  color: var(--text-dim);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.5rem;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.bnav-btn:hover  { color: var(--text); }
.bnav-btn.active { color: var(--blue); }
.bnav-icon { font-size: 1.3rem; line-height: 1; }
.bnav-label { font-family: var(--font-mono); }

/* ============================================================ */
/* MODAL                                                         */
/* ============================================================ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end;
  z-index: 1000;
  padding: 1rem;
  padding-bottom: calc(1rem + var(--safe-bottom));
}
.modal-box {
  background: rgba(5,11,20,0.98);
  border: 1px solid var(--border-bright);
  border-radius: var(--r);
  padding: 1.25rem;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  animation: slideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--blue);
  letter-spacing: 0.1em;
}
.modal-close {
  background: rgba(255,51,85,0.1);
  border: 1px solid rgba(255,51,85,0.2);
  color: var(--red);
  border-radius: 6px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
}

/* ============================================================ */
/* LEVEL UP                                                      */
/* ============================================================ */
.levelup-box {
  background: rgba(5,11,20,0.98);
  border: 1px solid rgba(255,215,0,0.4);
  border-radius: var(--r);
  padding: 1.5rem 1.25rem;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--glow-gold);
}
.levelup-glow {
  position: absolute;
  width: 200px; height: 200px;
  top: -60px; left: 50%; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255,215,0,0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.levelup-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.25em;
  margin-bottom: 0.25rem;
  text-shadow: var(--glow-gold);
}
.levelup-num {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  text-shadow: var(--glow-gold);
  margin-bottom: 0.25rem;
}
.levelup-sub {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}
.levelup-rewards { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-bottom: 0.75rem; }
.reward-tag {
  background: rgba(255,215,0,0.1);
  border: 1px solid rgba(255,215,0,0.3);
  color: var(--gold);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}

/* ============================================================ */
/* NOTIFICATION                                                  */
/* ============================================================ */
.notification {
  position: fixed;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5,11,20,0.97);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  padding: 0.5rem 1.1rem;
  font-size: 0.82rem;
  color: var(--text-bright);
  z-index: 9000;
  white-space: nowrap;
  max-width: calc(100vw - 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--glow-blue);
  animation: notifIn 0.25s ease-out;
}
@keyframes notifIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.notification.success { border-color: rgba(0,255,136,0.4); }
.notification.error   { border-color: rgba(255,51,85,0.4); color: var(--red); }

/* ============================================================ */
/* PWA INSTALL BANNER                                            */
/* ============================================================ */
.install-banner {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 0.5rem);
  left: 0.75rem; right: 0.75rem;
  background: rgba(8,18,35,0.97);
  border: 1px solid rgba(0,170,255,0.4);
  border-radius: var(--r);
  padding: 0.65rem 0.85rem;
  display: flex; align-items: center; gap: 0.65rem;
  z-index: 500;
  font-size: 0.82rem;
  color: var(--text);
  box-shadow: var(--glow-blue);
  animation: slideUp 0.3s ease-out;
}
.install-banner span { flex: 1; }
.btn-install {
  background: var(--blue);
  color: #000;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
}
.btn-dismiss {
  background: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 0.2rem 0.3rem;
}

/* ============================================================ */
/* RIPPLE                                                        */
/* ============================================================ */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(0,170,255,0.25);
  transform: scale(0);
  animation: ripple 0.6s linear;
  width: 80px; height: 80px;
  top: 50%; left: 50%;
  margin: -40px 0 0 -40px;
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

/* ============================================================ */
/* ANIMATIONS                                                    */
/* ============================================================ */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================ */
/* RESPONSIVE — Desktop                                          */
/* ============================================================ */
@media (min-width: 768px) {
  .tab-content { max-width: 680px; margin: 0 auto; }
  .stats-row-4col { grid-template-columns: repeat(4, 1fr); }
  .class-grid { grid-template-columns: repeat(4, 1fr); }
  .class-desc { display: block; }
  .bottom-nav { max-width: 680px; margin: 0 auto; left: 50%; transform: translateX(-50%); border-left: 1px solid var(--border); border-right: 1px solid var(--border); }

  #screen-dashboard { padding-bottom: calc(var(--bottom-nav-h) + 1rem); }
}

@media (min-width: 1024px) {
  .class-grid { grid-template-columns: repeat(6, 1fr); }
}

/* Reduces motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================ */
/* PHYSICAL CHARACTER CREATION                                   */
/* ============================================================ */
.char-preview-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0,170,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
#char-svg {
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(0,170,255,0.3));
}
.char-preview-stats {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.char-preview-stats span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}
.char-preview-stats span strong {
  color: var(--blue);
}

.body-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.body-type-btn {
  background: rgba(0,170,255,0.04);
  border: 1.5px solid rgba(0,170,255,0.1);
  border-radius: var(--r);
  padding: 0.5rem 0.3rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  transition: border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.body-type-btn:hover { border-color: var(--blue); background: rgba(0,170,255,0.08); }
.body-type-btn.selected { border-color: var(--cyan); background: rgba(0,245,255,0.1); box-shadow: 0 0 10px rgba(0,170,255,0.2); }
.bt-icon { font-size: 1.4rem; }
.bt-label { font-size: 0.72rem; color: var(--text-bright); font-weight: 600; text-transform: uppercase; }
.bt-desc { font-size: 0.6rem; color: var(--text-dim); text-align: center; line-height: 1.2; }

.goal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.goal-btn {
  background: rgba(0,170,255,0.04);
  border: 1.5px solid rgba(0,170,255,0.1);
  border-radius: var(--r);
  padding: 0.55rem 0.5rem;
  font-size: 0.78rem;
  font-family: var(--font-main);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.goal-btn:hover { border-color: var(--blue); }
.goal-btn.selected { border-color: var(--cyan); background: rgba(0,245,255,0.08); color: var(--text-bright); }

/* ============================================================ */
/* PHYSICAL PROGRESS CARD (DASHBOARD)                           */
/* ============================================================ */
.phys-card-body {
  padding: 0.75rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.phys-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0,170,255,0.03);
  border: 1px solid rgba(0,170,255,0.07);
  border-radius: var(--r);
  padding: 0.5rem 0.3rem;
}
.phys-stat-val {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1;
}
.phys-stat-val.positive { color: var(--green); }
.phys-stat-val.negative { color: var(--red); }
.phys-stat-label {
  font-size: 0.62rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
  text-align: center;
}
.phys-progress-bar-wrap {
  grid-column: 1/-1;
  margin-top: 0.25rem;
}
.phys-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 0.25rem;
}
.phys-bar-outer {
  background: rgba(0,170,255,0.06);
  border: 1px solid var(--border);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}
.phys-bar-inner {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  transition: width 0.6s ease;
  box-shadow: 0 0 6px rgba(155,89,255,0.5);
}

/* Physical stats in stats tab */
.phys-stats-panel {
  padding: 0.75rem;
}
.phys-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(0,170,255,0.05);
  font-size: 0.8rem;
  gap: 0.5rem;
}
.phys-log-row:last-child { border-bottom: none; }
.phys-log-date { color: var(--text-dim); font-family: var(--font-mono); font-size: 0.7rem; white-space: nowrap; }
.phys-log-weight { color: var(--blue); font-family: var(--font-display); font-weight: 700; }
.phys-log-delta { font-family: var(--font-mono); font-size: 0.7rem; }
.phys-log-delta.up { color: var(--green); }
.phys-log-delta.down { color: var(--red); }
.phys-chart-mini {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 50px;
  margin: 0.5rem 0;
}
.phys-bar-mini {
  flex: 1;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(to top, var(--purple), var(--blue));
  min-height: 4px;
  transition: height 0.4s ease;
}

/* ============================================================ */
/* BATTLE ANIMATION OVERLAY                                      */
/* ============================================================ */
.battle-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.battle-overlay.hidden { display: none; }
#battle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.battle-text {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 8vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-align: center;
  color: #fff;
  text-shadow: 0 0 20px rgba(0,170,255,0.9), 0 0 40px rgba(0,170,255,0.5);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s, transform 0.2s;
}
.battle-text.show {
  opacity: 1;
  transform: scale(1);
}

/* XP Float Labels */
.xp-floats-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 7000;
}
.xp-float {
  position: absolute;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255,215,0,0.7);
  pointer-events: none;
  animation: xpFloatAnim 1.2s ease-out forwards;
  white-space: nowrap;
}
@keyframes xpFloatAnim {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  60%  { opacity: 1; transform: translateY(-60px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-100px) scale(0.8); }
}

/* Screen flash on task complete */
@keyframes screenFlash {
  0%   { background: rgba(0,170,255,0); }
  20%  { background: rgba(0,170,255,0.08); }
  100% { background: rgba(0,170,255,0); }
}
.task-flash-anim {
  animation: screenFlash 0.5s ease-out;
}

/* Shake animation for errors */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}
.shake { animation: shake 0.4s ease-out; }

/* ============================================================ */
/* RESPONSIVE ADDITIONS                                          */
/* ============================================================ */
@media (min-width: 768px) {
  .body-type-grid { grid-template-columns: repeat(3, 1fr); }
  .phys-card-body { grid-template-columns: repeat(5, 1fr); }
}
