 * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    html {
      font-size: calc(16px * var(--font-scale));
    }

    body {
      font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
      background-color: #ecfdf5;
      background-image:
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(251, 191, 36, 0.16) 0px, transparent 55%);
      color: var(--text-main);
      min-height: 100vh;
      line-height: 1.55;
      overflow-x: hidden;
    }

    /* ==========================================================================
       2. LAYOUT PRINCIPAL E CABEÇALHO INSTITUCIONAL
       ========================================================================== */
    .app-wrapper {
      max-width: 980px;
      margin: 0 auto;
      padding: 16px;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    .top-bar {
      background: rgba(255, 255, 255, 0.95);
      backdrop-filter: blur(8px);
      border-radius: var(--radius-lg);
      padding: 14px 20px;
      box-shadow: var(--shadow-card);
      border: 2px solid #d1fae5;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 20px;
    }

    .school-brand {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .school-crest {
      width: 48px;
      height: 48px;
      flex-shrink: 0;
    }

    .school-title h1 {
      font-size: 1.05rem;
      font-weight: 800;
      color: var(--primary-dark);
      line-height: 1.2;
    }

    .school-title span {
      font-size: 0.82rem;
      color: var(--text-muted);
      font-weight: 600;
      display: block;
    }

    .hud-controls {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .hud-pill {
      background: var(--secondary-light);
      color: #92400e;
      border: 2px solid #fcd34d;
      padding: 6px 14px;
      border-radius: 999px;
      font-weight: 800;
      font-size: 0.92rem;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: transform 0.2s ease;
    }

    .hud-pill.pop {
      animation: popScale 0.4s ease;
    }

    .streak-pill {
      background: #ffedd5;
      color: #c2410c;
      border: 2px solid #fdba74;
      padding: 6px 12px;
      border-radius: 999px;
      font-weight: 800;
      font-size: 0.88rem;
      display: none;
      align-items: center;
      gap: 4px;
    }

    .streak-pill.visible {
      display: inline-flex;
    }

    @keyframes popScale {
      0% { transform: scale(1); }
      50% { transform: scale(1.18); }
      100% { transform: scale(1); }
    }

    .icon-btn {
      background: #f1f5f9;
      border: 2px solid #cbd5e1;
      color: var(--text-main);
      padding: 8px 13px;
      border-radius: 999px;
      font-weight: 700;
      font-size: 0.86rem;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
    }

    .icon-btn:hover {
      background: #e2e8f0;
      border-color: #94a3b8;
    }