/* ════════════════════════════════════════════════════════
   DESIGN TOKEN SYSTEM
   ════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Colors */
  --bg0: #05080f;
  --bg1: #080d18;
  --bg2: #0d1525;
  --bg3: #121c30;
  --border: rgba(78, 205, 196, 0.15);
  --border-hi: rgba(78, 205, 196, 0.4);
  --text: #e8f0ff;
  --text-sub: #8fa5c4;
  --text-mute: #4a6486;
  --accent: #4ecdc4;
  --red: #ff6b6b;
  --green: #6bcb77;
  --yellow: #ffd93d;
  --purple: #c77dff;

  /* Spacing System (rem-based) */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.25rem;
  --space-2xl: 1.5rem;
  --space-3xl: 2rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;

  /* Font Sizes (rem-based for accessibility) */
  --text-xs: 0.625rem;
  --text-sm: 0.6875rem;
  --text-base: 0.8125rem;
  --text-lg: 0.9375rem;
  --text-xl: 1.125rem;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg0);
  color: var(--text);
  font-family: 'Exo 2', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(78, 205, 196, 0.2);
  border-radius: 3px;
}

input,
select,
textarea,
button {
  font-family: 'Exo 2', sans-serif;
  font-size: 1rem;
}

/* ════════════════════════════════════════════════════════
   TYPOGRAPHY
   ════════════════════════════════════════════════════════ */
h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.75rem;
  letter-spacing: 5px;
  font-weight: 900;
}

h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.125rem;
  letter-spacing: 3px;
  font-weight: 700;
}

h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.875rem;
  letter-spacing: 2px;
  font-weight: 700;
}

p {
  font-size: var(--text-base);
  line-height: 1.6;
}

small {
  font-size: var(--text-sm);
}

.section-label {
  font-size: var(--text-xs);
  color: var(--text-mute);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
  font-family: 'Share Tech Mono', monospace;
  display: block;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(22px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
  from { transform: translateY(-22px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes scaleBounce {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes notifIn {
  from { transform: translateX(-50%) translateY(-18px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(78, 205, 196, 0.08); }
  50% { box-shadow: 0 0 35px rgba(78, 205, 196, 0.22); }
}

@keyframes ringExp {
  from { transform: translate(-50%, -50%) scale(0.5); opacity: 0.7; }
  to { transform: translate(-50%, -50%) scale(1.3); opacity: 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes completeQuest {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); background: rgba(107, 203, 119, 0.2); }
  100% { transform: scale(1); opacity: 0.8; }
}

@keyframes popIn {
  0% { transform: scale(0) rotateZ(-10deg); opacity: 0; }
  100% { transform: scale(1) rotateZ(0); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ════════════════════════════════════════════════════════
   LOGIN SCREEN
   ════════════════════════════════════════════════════════ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(78, 205, 196, 0.06), transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(199, 125, 255, 0.05), transparent 50%),
    var(--bg0);
}

.login-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-particle {
  position: absolute;
  border-radius: 50%;
  animation: float linear infinite;
}

.login-box {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 2;
  animation: slideUp 0.5s ease;
}

.login-title-area {
  text-align: center;
  margin-bottom: 1.75rem;
}

.sys-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--text-xs);
  color: var(--text-mute);
  letter-spacing: 7px;
  margin-bottom: 0.625rem;
}

.brand-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.625rem;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(90deg, #3dc7ff, #4ecdc4, #c77dff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
}

.brand-line {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 0.625rem auto 0;
}

.login-card {
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-xl);
  padding: 1.875rem;
  box-shadow: 0 0 60px rgba(78, 205, 196, 0.1);
}

.login-tabs {
  display: flex;
  margin-bottom: 1.625rem;
  border-bottom: 1px solid var(--border);
}

.login-tab {
  flex: 1;
  padding: 0.625rem;
  background: none;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-mute);
  cursor: pointer;
  transition: color 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.login-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.form-group {
  margin-bottom: 0.9375rem;
}

.form-label {
  font-size: var(--text-xs);
  color: var(--text-mute);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 0.375rem;
  font-family: 'Share Tech Mono', monospace;
  display: block;
}

.form-input {
  width: 100%;
  background: rgba(78, 205, 196, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.875rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(78, 205, 196, 0.3);
}

.form-input::placeholder {
  color: var(--text-mute);
}

.btn-login {
  width: 100%;
  padding: 0.875rem;
  margin-top: 0.375rem;
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.2), rgba(78, 205, 196, 0.35));
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-login:hover {
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.3), rgba(78, 205, 196, 0.5));
}

.btn-login:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-error {
  margin-top: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 5px;
  font-size: 0.75rem;
  display: none;
}

.login-error.error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: var(--red);
}

.login-error.success {
  background: rgba(107, 203, 119, 0.1);
  border: 1px solid rgba(107, 203, 119, 0.3);
  color: var(--green);
}

.forgot-password {
  text-align: center;
  margin-top: 0.875rem;
  font-size: 0.75rem;
  color: var(--text-mute);
}

.forgot-password button {
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  text-decoration: none;
  font-size: inherit;
}

.forgot-password button:hover {
  color: var(--accent);
}

.register-form {
  display: none;
}

.spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(78, 205, 196, 0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

/* ════════════════════════════════════════════════════════
   WELCOME SCREEN
   ════════════════════════════════════════════════════════ */
.welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, var(--bg0), var(--bg1));
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow-y: auto;
}

.welcome-modal.open {
  display: flex;
}

.welcome-box {
  width: 100%;
  max-width: 600px;
  animation: slideUp 0.5s ease;
}

.welcome-slide {
  text-align: center;
  padding: 2.5rem 1.25rem;
  animation: slideUp 0.5s ease;
}

.welcome-slide.hidden {
  display: none;
}

.welcome-slide h1 {
  margin-bottom: 0.75rem;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-slide p {
  font-size: 1rem;
  color: var(--text-sub);
  margin-bottom: 0.625rem;
  line-height: 1.8;
}

.welcome-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.875rem 0;
}

.welcome-card {
  background: linear-gradient(160deg, rgba(78, 205, 196, 0.1), rgba(78, 205, 196, 0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  transition: all 0.3s;
}

.welcome-card:hover {
  background: linear-gradient(160deg, rgba(78, 205, 196, 0.15), rgba(78, 205, 196, 0.08));
  border-color: var(--accent);
  transform: translateY(-4px);
}

.welcome-card-icon {
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
}

.welcome-card h3 {
  font-size: var(--text-base);
  margin-bottom: 0.5rem;
}

.welcome-card p {
  font-size: var(--text-sm);
  color: var(--text-mute);
}

/* ════════════════════════════════════════════════════════
   CLASS SELECTION
   ════════════════════════════════════════════════════════ */
.class-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.class-modal.open {
  display: flex;
}

.class-box {
  width: 100%;
  max-width: 580px;
  animation: slideUp 0.5s ease;
}

.class-inner {
  background: linear-gradient(160deg, var(--bg0), var(--bg1));
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: 0 0 80px rgba(78, 205, 196, 0.1);
}

.class-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.25rem;
  color: var(--accent);
  letter-spacing: 4px;
  text-align: center;
  margin-bottom: 0.5rem;
}

.class-sub {
  font-size: var(--text-base);
  color: var(--text-sub);
  text-align: center;
  margin-bottom: 1.75rem;
  line-height: 1.6;
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.class-card {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
}

.class-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.class-card.selected {
  border-color: var(--accent);
  background: rgba(78, 205, 196, 0.1);
  box-shadow: 0 0 20px rgba(78, 205, 196, 0.2);
}

.class-icon {
  font-size: 2.25rem;
  margin-bottom: 0.625rem;
}

.class-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 0.375rem;
}

.class-bonus {
  font-size: var(--text-sm);
  color: var(--text-sub);
  line-height: 1.6;
}

/* ════════════════════════════════════════════════════════
   MAIN APP STRUCTURE
   ════════════════════════════════════════════════════════ */
.app-container {
  display: none;
  min-height: 100vh;
  padding: 0.75rem 0.75rem 4.375rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-particle {
  position: absolute;
  border-radius: 50%;
  animation: float ease-in-out infinite;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 1rem;
  position: relative;
  animation: slideDown 0.5s ease;
}

.app-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.375rem;
  font-weight: 900;
  letter-spacing: 5px;
  background: linear-gradient(90deg, #3dc7ff, #4ecdc4, #c77dff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
}

.header-line {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 0.5rem auto 0;
}

.header-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-name-header {
  font-size: var(--text-sm);
  color: var(--text-sub);
}

.user-class-header {
  font-size: var(--text-xs);
  padding: 0.25rem 0.625rem;
  border-radius: 0.625rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.btn-logout {
  padding: 0.375rem 0.75rem;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.25);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(255, 107, 107, 0.2);
}

/* Main Grid — supports both .main-grid (old) and .app-layout (new) */
.main-grid,
.app-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  align-items: start;
}

.sidebar,
.left-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: sticky;
  top: 0.75rem;
  max-height: calc(100vh - 1.5rem);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar,
.left-panel::-webkit-scrollbar {
  display: none;
}

.panel {
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.panel.glow {
  animation: glowPulse 5s ease-in-out infinite;
}

/* ════════════════════════════════════════════════════════
   CHARACTER CARD (LEFT PANEL)
   ════════════════════════════════════════════════════════ */
.character-card {
  border: 2px solid var(--accent);
  box-shadow: 0 0 40px rgba(78, 205, 196, 0.2);
}

.avatar-wrap {
  text-align: center;
  margin-bottom: 0.875rem;
  position: relative;
}

.avatar {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-lg);
  margin: 0 auto 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  animation: float 4s ease-in-out infinite;
  position: relative;
  border: 2px solid var(--accent);
}

.rank-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', sans-serif;
  font-size: var(--text-xs);
  font-weight: 900;
  color: #000;
}

.char-name-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.875rem;
  letter-spacing: 3px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s;
}

.char-name-text:hover {
  color: var(--accent);
}

.char-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  color: var(--text);
  font-size: 0.875rem;
  font-family: 'Orbitron', sans-serif;
  text-align: center;
  outline: none;
  width: 100%;
  letter-spacing: 2px;
}

.char-title-badge {
  font-size: var(--text-sm);
  padding: 0.25rem 0.625rem;
  border-radius: 0.625rem;
  margin-top: 5px;
  display: inline-block;
  letter-spacing: 1px;
  font-weight: 700;
}

.rank-label {
  font-size: var(--text-xs);
  letter-spacing: 3px;
  margin-top: 3px;
  text-transform: uppercase;
}

.level-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.375rem;
}

.level-number {
  font-family: 'Orbitron', sans-serif;
  font-size: 2rem;
  font-weight: 900;
}

.xp-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--text-sub);
  margin-bottom: 0.25rem;
}

.xp-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.375rem;
  margin: 0.875rem 0;
}

.stat-mini-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  text-align: center;
}

.stat-mini-icon {
  font-size: 1rem;
}

.stat-mini-value {
  font-size: var(--text-base);
  font-weight: 700;
  margin-top: 3px;
}

.stat-mini-label {
  font-size: 0.5625rem;
  color: var(--text-mute);
  letter-spacing: 1px;
}

.free-points-btn {
  padding: 0.625rem;
  text-align: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: rgba(107, 203, 119, 0.08);
  border: 1px solid rgba(107, 203, 119, 0.4);
  color: var(--green);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  animation: glowPulse 1.5s ease-in-out infinite;
  display: none;
}

/* Attributes */
.attr-item {
  margin-bottom: 0.5rem;
}

.attr-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
  align-items: center;
}

.attr-name {
  font-size: var(--text-sm);
  color: var(--text-sub);
}

.attr-value {
  font-size: var(--text-sm);
  font-weight: 700;
}

.attr-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.attr-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s ease;
}

/* Day Progress */
.day-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.day-value {
  font-size: var(--text-base);
  color: var(--green);
  font-weight: 700;
}

.day-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.day-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(107, 203, 119, 0.6), var(--green));
  border-radius: 4px;
  transition: width 0.8s ease;
}

/* ════════════════════════════════════════════════════════
   TAB SYSTEM (DESKTOP & MOBILE)
   ════════════════════════════════════════════════════════ */
.tabs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tabs-nav {
  display: flex;
  flex: 1;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tabs-nav::-webkit-scrollbar {
  height: 0;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.625rem 0.75rem;
  color: var(--text-mute);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-btn:hover {
  color: var(--accent);
}

.tab-badge {
  margin-left: 0.25rem;
  font-size: 0.5625rem;
  padding: 2px 5px;
  border-radius: 0.625rem;
  background: rgba(78, 205, 196, 0.15);
  color: var(--accent);
  font-weight: 700;
}

.tab-badge.green {
  background: rgba(107, 203, 119, 0.2);
  color: var(--green);
}

.tab-badge.red {
  background: rgba(255, 107, 107, 0.2);
  color: var(--red);
}

/* More Tabs Button */
.btn-more-tabs {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-mute);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 700;
  transition: all 0.2s;
}

.btn-more-tabs:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.more-tabs-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 200px;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.more-tabs-dropdown.show {
  display: block;
}

.more-tabs-dropdown .tab-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: 0;
}

.more-tabs-dropdown .tab-btn:hover {
  background: rgba(78, 205, 196, 0.1);
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(5, 8, 15, 0.97);
  border-top: 1px solid var(--border);
  display: none;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  padding: 0.25rem;
  padding-bottom: calc(0.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  min-height: 56px;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.bottom-nav button {
  background: none;
  border: none;
  color: var(--text-mute);
  font-size: 1.375rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all 0.2s;
  min-width: 0;
  padding: 0.25rem 0;
}

.bottom-nav button.active {
  background: rgba(78, 205, 196, 0.15);
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.bottom-nav button:active {
  transform: scale(0.85);
}

/* Content */
.tab-content {
  animation: slideUp 0.3s ease;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.content-title {
  font-size: 1rem;
  color: var(--text);
  font-weight: 700;
}

.content-subtitle {
  font-size: var(--text-sm);
  color: var(--text-sub);
  margin-top: 2px;
}

/* ════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════ */
.btn-primary {
  padding: 0.625rem 1.125rem;
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.2), rgba(78, 205, 196, 0.35));
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  color: var(--accent);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.3), rgba(78, 205, 196, 0.5));
}

.btn-primary:active {
  transform: scale(0.95);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary.red {
  border-color: var(--red);
  color: var(--red);
  background: rgba(255, 107, 107, 0.1);
}

.btn-primary.red:hover {
  background: rgba(255, 107, 107, 0.2);
}

.btn-primary.green {
  border-color: var(--green);
  color: var(--green);
  background: rgba(107, 203, 119, 0.1);
}

.btn-primary.green:hover {
  background: rgba(107, 203, 119, 0.2);
}

.btn-primary.sm {
  padding: 0.4375rem 0.8125rem;
  font-size: var(--text-sm);
}

.btn-secondary {
  padding: 0.625rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-sub);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.07);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  color: var(--red);
  transform: scale(1.1);
}

/* ════════════════════════════════════════════════════════
   QUEST CARDS
   ════════════════════════════════════════════════════════ */
.quest-card {
  background: rgba(78, 205, 196, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: 0.5rem;
  transition: all 0.25s;
}

.quest-card:hover {
  border-color: rgba(78, 205, 196, 0.3);
  transform: translateY(-2px);
}

.quest-card.done {
  background: rgba(107, 203, 119, 0.04);
  border-color: rgba(107, 203, 119, 0.2);
  opacity: 0.72;
}

.quest-card.completed-animation {
  animation: completeQuest 0.6s ease-out;
}

.quest-card.boss {
  background: rgba(255, 107, 107, 0.03);
  border-color: rgba(255, 107, 107, 0.15);
}

.quest-card.boss:hover {
  border-color: rgba(255, 107, 107, 0.35);
}

.quest-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quest-icon-box {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.quest-info {
  flex: 1;
  min-width: 0;
}

.quest-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.quest-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.quest-title.done {
  text-decoration: line-through;
  color: var(--green);
}

.quest-desc {
  font-size: var(--text-sm);
  color: var(--text-sub);
  margin-bottom: 5px;
}

.quest-meta {
  display: flex;
  gap: 0.875rem;
  flex-wrap: wrap;
  font-size: var(--text-sm);
}

.quest-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
}

.done-label {
  font-size: var(--text-sm);
  color: var(--green);
  font-weight: 700;
}

.diff-badge {
  font-size: var(--text-xs);
  padding: 2px 7px;
  border-radius: 3px;
  font-weight: 600;
  letter-spacing: 1px;
}

.class-bonus-tag {
  font-size: var(--text-xs);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  animation: popIn 0.5s ease;
}

.empty-state-title {
  font-size: 1.125rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 2px;
}

.empty-state-subtitle {
  font-size: 0.75rem;
  color: var(--text-sub);
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

/* ════════════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: linear-gradient(160deg, var(--bg0), var(--bg1));
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 60px rgba(78, 205, 196, 0.15);
  animation: scaleIn 0.3s ease;
}

.modal-title {
  font-family: 'Orbitron', sans-serif;
  font-size: var(--text-base);
  color: var(--accent);
  letter-spacing: 3px;
  margin-bottom: 1.25rem;
  font-weight: 700;
}

.modal-field {
  margin-bottom: 0.875rem;
}

.modal-label {
  font-size: var(--text-xs);
  color: var(--text-mute);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 0.375rem;
  font-family: 'Share Tech Mono', monospace;
  display: block;
  font-weight: 500;
}

.modal-input {
  width: 100%;
  background: rgba(78, 205, 196, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(78, 205, 196, 0.3);
}

.modal-select {
  width: 100%;
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.modal-select:focus {
  border-color: var(--accent);
}

.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
}

.modal-xp-preview {
  padding: 0.6875rem 1rem;
  background: rgba(78, 205, 196, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  margin-bottom: 1rem;
  font-size: var(--text-base);
  color: var(--accent);
  font-weight: 600;
}

.modal-footer {
  display: flex;
  gap: 0.625rem;
  margin-top: 1rem;
}

.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.875rem;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.5rem 0.625rem;
  font-size: 1.125rem;
  cursor: pointer;
  transition: all 0.15s;
}

.icon-btn.selected {
  background: rgba(78, 205, 196, 0.18);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(78, 205, 196, 0.3);
}

/* Confirmation Modal */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 3500;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.confirm-modal.open {
  display: flex;
}

.confirm-box {
  background: linear-gradient(160deg, var(--bg0), var(--bg1));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  max-width: 360px;
  width: 100%;
  text-align: center;
  animation: popIn 0.3s ease;
}

.confirm-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.confirm-box h3 {
  font-size: 1.125rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.confirm-box p {
  font-size: var(--text-base);
  color: var(--text-sub);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
  margin-top: 1.25rem;
}

/* ════════════════════════════════════════════════════════
   LEVEL UP MODAL
   ════════════════════════════════════════════════════════ */
.levelup-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
}

.levelup-modal.open {
  display: flex;
}

.levelup-box {
  position: relative;
  text-align: center;
  padding: 0 1.25rem;
  animation: scaleBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.levelup-panel {
  background: linear-gradient(160deg, var(--bg0), var(--bg1));
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 360px;
  position: relative;
  border: 2px solid var(--accent);
}

.levelup-sys {
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--text-xs);
  color: var(--accent);
  letter-spacing: 6px;
  margin-bottom: 0.375rem;
}

.levelup-label {
  font-size: var(--text-xs);
  color: var(--text-mute);
  letter-spacing: 4px;
  font-family: 'Share Tech Mono', monospace;
  margin-bottom: 0.375rem;
}

.levelup-number {
  font-family: 'Orbitron', sans-serif;
  font-size: 4.5rem;
  font-weight: 900;
  line-height: 1;
}

.levelup-rank {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.875rem;
  letter-spacing: 4px;
  margin-top: 0.375rem;
}

.levelup-rank-name {
  font-size: 0.75rem;
  color: var(--text-sub);
  margin-top: 3px;
}

.levelup-points {
  margin-top: 1rem;
  padding: 0.625rem 1.125rem;
  background: rgba(78, 205, 196, 0.08);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--accent);
  font-size: var(--text-base);
}

.levelup-rings {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.levelup-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 1px solid;
  transform: translate(-50%, -50%);
  animation: ringExp 1.2s ease-out both;
}

/* ════════════════════════════════════════════════════════
   NOTIFICATION
   ════════════════════════════════════════════════════════ */
.notification {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6000;
  display: none;
  min-width: 250px;
  text-align: center;
  animation: notifIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.notification-inner {
  display: inline-block;
  background: var(--bg0);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.375rem;
  font-size: var(--text-base);
  letter-spacing: 1px;
  box-shadow: 0 0 24px rgba(78, 205, 196, 0.3);
  font-weight: 600;
  border: 1px solid var(--accent);
}

/* ════════════════════════════════════════════════════════
   SHOP
   ════════════════════════════════════════════════════════ */
.shop-section {
  margin-bottom: 1.75rem;
}

.shop-section-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.875rem;
}

.shop-section-icon {
  font-size: 1.25rem;
}

.shop-section-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 3px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.shop-item {
  background: rgba(78, 205, 196, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.875rem;
  text-align: center;
  transition: all 0.25s;
}

.shop-item:hover {
  border-color: rgba(78, 205, 196, 0.3);
  transform: translateY(-2px);
}

.shop-item.owned {
  background: rgba(107, 203, 119, 0.05);
  border-color: rgba(107, 203, 119, 0.3);
}

.shop-item.equipped {
  background: rgba(78, 205, 196, 0.08);
  border-color: var(--accent);
}

.shop-item-icon {
  font-size: 2.25rem;
  margin-bottom: 0.625rem;
}

.shop-item-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}

.shop-item-desc {
  font-size: var(--text-sm);
  color: var(--text-sub);
  margin-bottom: 0.625rem;
  line-height: 1.5;
}

.shop-price {
  font-size: 0.75rem;
  color: var(--yellow);
  font-weight: 700;
  margin-bottom: 0.625rem;
}

.xp-balance {
  text-align: center;
  padding: 0.875rem;
  background: rgba(162, 155, 254, 0.08);
  border: 1px solid rgba(162, 155, 254, 0.25);
  border-radius: var(--radius-lg);
  margin-bottom: 1.375rem;
}

.xp-balance-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.75rem;
  color: #a29bfe;
  font-weight: 900;
}

.xp-balance-label {
  font-size: var(--text-sm);
  color: var(--text-mute);
  letter-spacing: 2px;
  margin-top: 0.25rem;
}

/* ════════════════════════════════════════════════════════
   HISTORY & CHARTS
   ════════════════════════════════════════════════════════ */
.history-day {
  margin-bottom: 1.25rem;
}

.history-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.625rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.history-day-date {
  font-size: var(--text-base);
  color: var(--text-sub);
  font-weight: 600;
}

.history-entry {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5625rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.375rem;
}

.history-entry-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
}

.history-entry-name {
  font-size: var(--text-base);
  color: var(--text);
  flex: 1;
}

.history-entry-xp {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}

.chart-wrap {
  position: relative;
  height: 300px;
}

/* Comparison Panel */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.comparison-card {
  background: linear-gradient(160deg, rgba(78, 205, 196, 0.08), rgba(78, 205, 196, 0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}

.comparison-stat {
  font-size: 1.75rem;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  margin: 0.5rem 0;
}

.comparison-duel {
  background: linear-gradient(160deg, rgba(255, 217, 61, 0.08), rgba(255, 217, 61, 0.03));
  border: 1px solid rgba(255, 217, 61, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

/* Diary */
.diary-textarea {
  width: 100%;
  min-height: 150px;
  background: rgba(78, 205, 196, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  font-family: 'Exo 2', sans-serif;
}

.diary-textarea:focus {
  border-color: var(--accent);
}

/* ════════════════════════════════════════════════════════
   VISUALLY HIDDEN (screen-reader only)
   ════════════════════════════════════════════════════════ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 1000px) {
  .main-grid,
  .app-layout {
    grid-template-columns: 240px 1fr;
  }

  .sidebar,
  .left-panel {
    position: sticky;
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
  }
}

@media (max-width: 780px) {
  /* Header Mobile */
  .app-header {
    margin-bottom: 0.75rem;
  }

  .app-title {
    font-size: 1.125rem;
    letter-spacing: 3px;
  }

  .header-actions {
    position: static;
    justify-content: flex-end;
    margin-top: 0.5rem;
    font-size: var(--text-xs);
  }

  /* Layout — single column, padding accounts for bottom nav + iPhone safe area */
  .app-container {
    padding: 0.625rem 0.625rem calc(56px + env(safe-area-inset-bottom, 0px) + 0.5rem);
  }

  .main-grid,
  .app-layout {
    grid-template-columns: 1fr;
  }

  /* Hide sidebar on mobile — nav done via bottom bar */
  .sidebar,
  .left-panel {
    display: none;
  }

  /* Tabs — hidden on mobile, bottom nav used instead */
  .tabs-header {
    margin-bottom: 0.5rem;
  }

  .tab-btn {
    padding: 0.5rem 0.625rem;
    font-size: var(--text-xs);
  }

  .btn-more-tabs {
    font-size: var(--text-xs);
    padding: 0.375rem 0.625rem;
  }

  /* Stats Grid */
  .stat-mini-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
  }

  /* Avatar */
  .avatar {
    width: 64px;
    height: 64px;
    font-size: 1.75rem;
  }

  .level-number {
    font-size: 1.75rem;
  }

  /* Card Grid */
  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .class-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  /* Modals slide up from bottom on mobile */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-box {
    padding: 1.25rem 1rem;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    max-width: 100%;
    width: 100%;
    border-radius: 1rem 1rem 0 0;
    max-height: 92vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
  }

  .modal-grid-2 {
    grid-template-columns: 1fr;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn-secondary,
  .modal-footer .btn-primary {
    width: 100%;
  }

  /* Bottom Navigation — shown on mobile */
  .bottom-nav {
    display: grid;
  }

  /* Remove Desktop Tabs - Show Mobile */
  .tabs-nav {
    display: none;
  }

  /* Chart */
  .chart-wrap {
    height: 250px;
  }
}

@media (max-width: 520px) {
  .sidebar > .panel {
    flex: 1 1 100%;
  }

  .stat-mini-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
  }

  .stat-mini-item {
    padding: 0.375rem 0.25rem;
  }

  .stat-mini-icon {
    font-size: 0.875rem;
  }

  .stat-mini-value {
    font-size: 0.75rem;
  }

  .stat-mini-label {
    font-size: 0.5rem;
  }

  .avatar {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }

  .level-number {
    font-size: 1.5rem;
  }

  .content-title {
    font-size: 0.875rem;
  }

  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .btn-primary {
    padding: 0.5rem 0.75rem;
    font-size: var(--text-sm);
  }

  .modal-box {
    padding: 0.75rem;
  }

  .modal-title {
    font-size: 0.75rem;
  }

  .chart-wrap {
    height: 200px;
  }

  .bottom-nav {
    grid-template-columns: repeat(7, 1fr);
    height: calc(52px + env(safe-area-inset-bottom, 0px));
    min-height: 52px;
    padding: 2px;
    padding-bottom: calc(2px + env(safe-area-inset-bottom, 0px));
  }

  .bottom-nav button {
    font-size: 1.125rem;
  }
}

@media (max-width: 360px) {
  .app-container {
    padding: 0.5rem 0.5rem calc(52px + env(safe-area-inset-bottom, 0px) + 0.5rem);
  }

  .app-title {
    font-size: 0.875rem;
    letter-spacing: 2px;
  }

  .panel {
    padding: 0.75rem;
  }

  .modal-box {
    padding: 0.625rem;
    margin: 0.625rem;
  }

  .avatar {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  .rank-badge {
    width: 24px;
    height: 24px;
    font-size: 0.5625rem;
  }

  .char-name-text {
    font-size: 0.75rem;
  }

  .level-number {
    font-size: 1.25rem;
  }

  .stat-mini-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-mini-item {
    padding: 0.25rem 0.125rem;
  }

  .stat-mini-icon {
    font-size: 0.75rem;
  }

  .stat-mini-value {
    font-size: var(--text-sm);
  }

  .btn-primary {
    padding: 0.375rem 0.625rem;
    font-size: var(--text-xs);
  }

  .quest-card {
    padding: 0.625rem;
  }

  .quest-row {
    gap: 0.5rem;
  }

  .quest-icon-box {
    width: 40px;
    height: 40px;
    font-size: 1.125rem;
  }

  .shop-grid {
    grid-template-columns: 1fr;
  }

  .confirm-box {
    max-width: 90vw;
  }

  .levelup-number {
    font-size: 3rem;
  }
}

/* ════════════════════════════════════════════════════════
   v6.0 - NOVOS ESTILOS
   ════════════════════════════════════════════════════════ */

/* Boss Battle */
@keyframes bossShake {
  0%   { transform: translateY(0) rotate(-2deg); }
  100% { transform: translateY(-6px) rotate(2deg); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}

.boss-battle-screen {
  max-width: 600px;
  margin: 0 auto;
}

.battle-header {
  text-align: center;
  padding: 24px;
  border: 1px solid;
  border-radius: var(--radius-xl);
  margin-bottom: 16px;
  background: rgba(0,0,0,.3);
}

.battle-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
  padding: 16px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.battle-fighter {
  text-align: center;
  flex: 1;
}

.battle-log-container {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.battle-log-title {
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 2px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  font-family: 'Share Tech Mono', monospace;
}

.battle-log {
  max-height: 200px;
  overflow-y: auto;
  padding: 12px;
}

.battle-log-entry {
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  line-height: 1.5;
}

.battle-result {
  text-align: center;
  padding: 24px;
  border: 2px solid;
  border-radius: var(--radius-xl);
  animation: scaleIn .4s ease;
}

/* Equip Slots */
.equip-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  min-height: 80px;
  cursor: pointer;
  transition: all .2s;
}

.equip-slot:hover {
  border-color: rgba(78,205,196,.4);
  background: rgba(78,205,196,.05);
}

/* Quest locked */
.quest-card.locked {
  pointer-events: none;
}

/* Quest captured */
.quest-card.captured {
  border-color: rgba(162,155,254,.3);
  background: rgba(162,155,254,.04);
}

/* Diamond color */
.diamond-text {
  color: #4fc3f7;
  font-weight: 700;
}

/* Battle log colors */
.battle-log-entry.player { color: #6bcb77; }
.battle-log-entry.boss   { color: #ff6b6b; }

/* Mobile improvements */
@media (max-width: 768px) {
  /* Safe area for iPhone notch/home-indicator */
  .bottom-nav {
    grid-template-columns: repeat(7, 1fr);
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    min-height: 56px;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }

  .bottom-nav button {
    padding: 6px 0;
    font-size: 1.25rem;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Better tap targets */
  .btn-primary.sm {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
    min-width: 60px;
  }

  .quest-card .quest-actions {
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
  }

  .boss-battle-screen {
    padding: 0 4px;
  }

  .battle-vs {
    gap: 12px;
    padding: 12px;
  }

  .equip-slot {
    min-height: 68px;
    padding: 8px 4px;
  }

  /* Larger tap targets for mobile */
  .quest-icon-box {
    min-width: 44px;
    min-height: 44px;
  }

  /* Modal slides up from bottom — safe area aware */
  .modal-box {
    border-radius: 1rem 1rem 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: calc(92vh - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    animation: slideUp .3s ease;
    margin: 0;
    max-width: 100%;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  /* Shop grid on mobile */
  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Stat mini on mobile */
  .stat-mini-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .stat-mini-item:last-child {
    grid-column: 1 / -1;
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  .shop-grid {
    grid-template-columns: 1fr;
  }

  h2 {
    font-size: 0.9rem;
    letter-spacing: 2px;
  }
}

/* Smooth scroll mobile */
#tabContent {
  -webkit-overflow-scrolling: touch;
}

/* ════════════════════════════════════════════════════════
   PAGE SLIDE SYSTEM
   ════════════════════════════════════════════════════════ */

/* Animações de transição de página */
@keyframes pageSlideIn {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pageSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-28px);
  }
}

/* Tab content — ocupa toda a área disponível */
.tab-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-lg);
  /* Evita flash durante a animação */
  will-change: transform, opacity;
}

/* Barra colorida indicadora de qual página está ativa */
#tabColorBar {
  height: 2px;
  width: 100%;
  transition: background 0.3s ease;
  margin-bottom: 0;
}

/* Header compacto da tab ativa */
.tab-page-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tab-page-icon {
  font-size: 18px;
  line-height: 1;
}

.tab-page-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
}

/* Navegação principal — tabs como pills horizontais com scroll */
.tabs-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Exo 2', sans-serif;
}

.tab-btn:hover {
  border-color: var(--border-hi);
  color: var(--text-sub);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: rgba(78, 205, 196, 0.12);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(78, 205, 196, 0.15);
}

/* "Mais" dropdown */
.btn-more-tabs {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Exo 2', sans-serif;
}

.more-tabs-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 6px;
  z-index: 100;
  min-width: 160px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  animation: scaleIn .15s ease;
}

.more-tabs-dropdown.show {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.more-tabs-dropdown .tab-btn {
  border-radius: var(--radius-md);
  text-align: left;
  width: 100%;
  border-color: transparent;
  background: transparent;
}

/* Wrapper do header de tabs */
.tabs-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 13, 24, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* ─── Layout responsivo ──────────────────────────────── */
@media (max-width: 768px) {
  .tab-content {
    padding: var(--space-md);
  }

  /* Esconde tabs de desktop, mostra bottom nav */
  .tabs-header {
    display: none;
  }

  /* Tab content ocupa tela cheia no mobile */
  .app-layout {
    display: flex;
    flex-direction: column;
  }
}

@media (min-width: 769px) {
  /* Layout desktop: sidebar à esquerda, conteúdo à direita */
  .app-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
    align-items: start;
  }

  .left-panel {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: var(--space-lg);
    border-right: 1px solid var(--border);
    scrollbar-width: thin;
  }

  .tab-content {
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding: var(--space-xl) var(--space-2xl);
  }

  /* Garante que o bottom nav não apareça no desktop */
  .bottom-nav {
    display: none !important;
  }
}
/* ════════════════════════════════════════════════════════
   PATCH v6.0 — Estilos adicionais para nova estrutura
   Carregue DEPOIS de styles.css e page-slide.css
   ════════════════════════════════════════════════════════ */

/* ─── TOP BAR (Header do app) ─────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(8, 13, 24, 0.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── CHARACTER AVATAR ────────────────────────────────── */
.char-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  position: relative;
  border: 2px solid var(--accent);
  flex-shrink: 0;
  animation: float 4s ease-in-out infinite;
}

.char-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.char-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.char-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 2px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  transition: color 0.2s;
}

.char-name:hover {
  color: var(--accent);
}

.char-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  color: var(--text);
  font-size: 0.75rem;
  font-family: 'Orbitron', sans-serif;
  outline: none;
  width: 120px;
  letter-spacing: 2px;
}

.char-title-badge {
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 1px;
}

/* ─── LEVEL BADGE ─────────────────────────────────────── */
.level-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 10px;
  background: rgba(78, 205, 196, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.level-num {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.125rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}

/* ─── XP BAR GLOBAL (abaixo do header) ───────────────── */
.xp-bar-global {
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a29bfe);
  border-radius: 2px;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.xp-text-global {
  text-align: center;
  font-size: 9px;
  color: var(--text-mute);
  letter-spacing: 2px;
  padding: 3px 0 6px;
  font-family: 'Share Tech Mono', monospace;
}

/* ─── LOGIN EXTRAS ────────────────────────────────────── */
.login-logo {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 0.5rem;
  animation: float 3s ease-in-out infinite;
}

.login-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 4px;
  text-align: center;
  background: linear-gradient(90deg, #3dc7ff, #4ecdc4, #c77dff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-size: 0.75rem;
  color: var(--text-mute);
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 1.5rem;
}

/* Login screen centering */
#loginScreen {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(78, 205, 196, 0.06), transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(199, 125, 255, 0.05), transparent 50%),
    var(--bg0);
}

#loginScreen .login-card {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 2;
  animation: slideUp 0.5s ease;
}

/* ─── NOTIFICATION ────────────────────────────────────── */
.notification {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6000;
  display: none;
  pointer-events: none;
}

.notification.show {
  display: block;
  animation: notifIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── APP LAYOUT CORRECTIONS ──────────────────────────── */
#mainApp {
  min-height: 100vh;
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}

.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  align-items: start;
}

.left-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  scrollbar-width: none;
  border-right: 1px solid var(--border);
}

.left-panel::-webkit-scrollbar {
  display: none;
}

#tabContent {
  padding: 16px;
  min-height: calc(100vh - 120px);
}

/* ─── TABS HEADER CORRECTION ──────────────────────────── */
.tabs-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(8, 13, 24, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.tabs-nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  flex: 1;
  border-bottom: none;
  scrollbar-width: none;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: none;
  margin-bottom: 0;
}

.tab-btn.active {
  background: rgba(78, 205, 196, 0.12);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px rgba(78, 205, 196, 0.15);
}

.tab-btn:hover {
  color: var(--text-sub);
  border-color: var(--border);
}

.more-tabs-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 12px;
  background: var(--bg2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 6px;
  z-index: 100;
  min-width: 160px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.15s ease;
}

.more-tabs-dropdown .tab-btn {
  display: block;
  width: 100%;
  text-align: left;
  border-radius: var(--radius-md);
  border-color: transparent;
  background: transparent;
  margin-bottom: 2px;
}

.more-tabs-dropdown .tab-btn:hover {
  background: rgba(78, 205, 196, 0.1);
  border-color: transparent;
}

/* ─── MOBILE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .left-panel {
    display: none;
  }

  .tabs-header {
    display: none;
  }

  #tabContent {
    padding: 12px;
  }

  .bottom-nav {
    display: grid !important;
  }
}

@media (min-width: 769px) {
  .bottom-nav {
    display: none !important;
  }
}
