       * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* Tablet (641px-1024px) */
        @media (min-width: 641px) and (max-width: 1024px) {
            .container {
                max-width: 900px;
                padding: 0 2rem;
            }
            
            h1 {
                font-size: 2rem;
            }
            
            .tab-btn {
                padding: 0.7rem 1rem;
                font-size: 0.85rem;
            }
            
            .btn {
                padding: 0.75rem 1.25rem;
                font-size: 0.9rem;
            }
            
            .btn-group {
                gap: 0.6rem;
            }
        }
        
        /* Very small mobile (320px-480px) */
        @media (max-width: 480px) {
            
            h1 {
                font-size: 1.5rem;
            }
            
            .subtitle {
                font-size: 0.85rem;
            }
            
            .tabs {
                gap: 0.5rem;
                padding: 0.5rem;
            }
            
            .tab-btn {
                width: 100%;
                min-width: auto;
                font-size: 0.8rem;
                padding: 0.7rem 0.9rem;
            }
            
            .card {
                padding: 1.25rem;
            }
            
            .card-title {
                font-size: 1.25rem;
            }
            
            .card-description {
                font-size: 0.875rem;
            }
            
            input, select {
                padding: 0.75rem;
                font-size: 0.9rem;
            }
            
            .btn {
                padding: 0.75rem 1rem;
                font-size: 0.85rem;
                width: 100%;
            }
            
            .btn-group {
                flex-direction: column;
                gap: 0.65rem;
            }
            
            .result-value {
                font-size: 2.5rem;
            }
            
            .result-label {
                font-size: 0.85rem;
            }
            
            .grade-item {
                padding: 0.5rem 0.375rem;
            }
            
            .grade-item .grade {
                font-size: 0.875rem;
            }
            
            .grade-item .points {
                font-size: 0.625rem;
            }
            
            .back-link {
                position: static;
                display: flex;
                justify-content: flex-end;
                margin-bottom: 1rem;
            }
            
            .back-link .btn {
                width: auto;
                padding: 0.625rem 1rem;
                font-size: 0.8rem;
            }
        }
        
        /* Landscape mobile */
        @media (max-height: 600px) and (orientation: landscape) {
            header {
                padding: 1.5rem 1rem;
            }
            
            h1 {
                font-size: 1.5rem;
            }
            
            .tabs {
                gap: 0.5rem;
                padding: 0.5rem;
            }
            
            .tab-btn {
                padding: 0.75rem 1rem;
                font-size: 0.85rem;
            }
            
            .card {
                padding: 1.25rem;
            }
        }

        :root {
            --primary: #4F46E5;
            --primary-light: #6366F1;
            --secondary: #F59E0B;
            --background: #F8FAFC;
            --surface: #FFFFFF;
            --text-primary: #1E293B;
            --text-secondary: #64748B;
            --border: #E2E8F0;
            --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
            --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
        }

        /* Dark mode variables */
        html.dark {
            --primary: #60a5fa;
            --primary-light: #93c5fd;
            --secondary: #fbbf24;
            --background: #0f1a2e;
            --surface: #111729;
            --text-primary: #f1f5f9;
            --text-secondary: #cbd5e1;
            --border: #2d3748;
            --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
            --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
        }

        html {
            scroll-behavior: smooth;
            overflow-x: hidden;
            width: 100%;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: linear-gradient(135deg, #F8FAFC 0%, #EFF6FF 100%);
            color: var(--text-primary);
            min-height: 100vh;
            line-height: 1.6;
            overflow-x: hidden;
            width: 100%;
            max-width: 100vw;
        }

        html.dark body {
            background: linear-gradient(135deg, #0a0e27 0%, #111729 50%, #0f1a2e 100%);
        }

        .container {
            max-width: 1000px;
            width: 100%;
            margin: 0 auto;
            padding: 0 1rem;
            box-sizing: border-box;
        }

        /* Header */
        header {
            position: sticky;
            top: 0;
            z-index: 100;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 60px;
            background: rgba(255, 255, 255, 0.95);
            border-bottom: 1px solid var(--border);
            backdrop-filter: blur(10px);
            margin-bottom: 2rem;
            width: 100%;
            max-width: 100vw;
            box-sizing: border-box;
        }

        html.dark header {
            background: rgba(15, 23, 42, 0.95);
            border-bottom-color: rgba(255, 255, 255, 0.1);
        }
        
        @media (max-width: 640px) {
            header {
                padding: 12px 20px;
            }
        }

        .logo {
            font-family: 'Poppins', sans-serif;
            font-size: 24px;
            font-weight: 700;
            color: #3b82f6;
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: opacity 0.3s;
        }
        
        .logo svg {
              flex-shrink: 0;
              width: 18px;
              height: 18px;
        }
        
        .logo-img {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .logo:hover {
            opacity: 0.8;
        }
        
        @media (max-width: 640px) {
            .logo {
                font-size: 20px;
            }
            
            .logo-img {
                width: 32px;
                height: 32px;
            }
        }
        
        @media (max-width: 480px) {
            .logo-img {
                width: 28px;
                height: 28px;
            }
        }

        h1 {
            font-size: 2.5rem;
            margin-bottom: 0.5rem;
            background: linear-gradient(135deg, #1E293B 0%, #4F46E5 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        html.dark h1 {
            background: linear-gradient(135deg, #f1f5f9 0%, #60a5fa 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .subtitle {
            color: var(--text-secondary);
            font-size: 1.125rem;
        }

        .page-header {
            text-align: center;
            padding: 3rem 1rem 2rem;
            max-width: 800px;
            margin: 0 auto;
        }
        
        .page-header h1 {
            margin-bottom: 0.75rem;
        }
        
        .page-header p {
            color: var(--text-secondary);
            font-size: 1.125rem;
        }
        
        @media (max-width: 640px) {
            .page-header {
                padding: 2rem 1rem 1.5rem;
            }
            
            .page-header h1 {
                font-size: 1.75rem;
            }
            
            .page-header p {
                font-size: 1rem;
            }
        }

        /* Tabs */
        .tabs {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 2rem;
            background: var(--surface);
            padding: 0.75rem;
            border-radius: 0.75rem;
            box-shadow: var(--shadow);
            border: 1px solid var(--border);
            flex-wrap: wrap;
        }

        .tab-btn {
            flex: 1;
            min-width: 140px;
            padding: 0.875rem 1.5rem;
            border: 2px solid transparent;
            background: transparent;
            color: var(--text-secondary);
            font-size: 0.95rem;
            font-weight: 600;
            border-radius: 0.5rem;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
        }

        .tab-btn:hover {
            color: var(--primary);
            background: rgba(79, 70, 229, 0.05);
        }

        .tab-btn.active {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
            color: white;
            box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
        }

        .tab-btn svg {
            width: 20px;
            height: 20px;
            stroke-width: 2;
        }

        /* Card */
        .card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 1rem;
            padding: 2rem;
            box-shadow: var(--shadow-lg);
            margin-bottom: 2rem;
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
            overflow-wrap: break-word;
            word-wrap: break-word;
        }

        .card-header {
            margin-bottom: 2rem;
        }

        .card-title {
            font-size: 1.5rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
            color: var(--text-primary);
        }

        .card-description {
            color: var(--text-secondary);
            font-size: 0.95rem;
        }

        /* Form elements */
        .form-group {
            margin-bottom: 1.5rem;
        }

        label {
            display: block;
            font-size: 0.875rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
            color: var(--text-primary);
        }

        input, select {
            width: 100%;
            padding: 0.75rem 1rem;
            background: var(--background);
            border: 2px solid var(--border);
            border-radius: 0.5rem;
            color: var(--text-primary);
            font-family: inherit;
            font-size: 0.95rem;
            transition: all 0.3s ease;
        }

        input::placeholder {
            color: var(--text-secondary);
        }

        input:focus, select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
            background: white;
        }

        select {
            cursor: pointer;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 0.75rem center;
            background-size: 20px;
            padding-right: 2.5rem;
        }

        html.dark select {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
        }

        html.dark input:focus, 
        html.dark select:focus {
            background: #0a0e27;
            border-color: var(--primary);
        }

        /* q row */
        .subject-row {
            display: grid;
            grid-template-columns: 1.5fr 100px 120px 40px;
            gap: 1rem;
            align-items: end;
            margin-bottom: 1rem;
            padding: 1rem;
            background: var(--background);
            border-radius: 0.5rem;
            border: 1px solid var(--border);
            animation: slideIn 0.3s ease;
        }

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

        .subject-row > div:first-child label {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }

        /* Buttons */
        .btn {
            padding: 0.75rem 1.5rem;
            border: none;
            border-radius: 0.5rem;
            font-family: inherit;
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            text-decoration: none;
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
            color: white;
            box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
        }

        .btn-primary:active {
            transform: translateY(0);
        }

        .btn-outline {
            background: transparent;
            color: var(--primary);
            border: 2px solid var(--primary);
        }

        .btn-outline:hover {
            background: rgba(79, 70, 229, 0.05);
        }

        .btn-ghost {
            background: transparent;
            color: var(--text-secondary);
            width: 40px;
            height: 40px;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .btn-ghost:hover {
            background: rgba(239, 68, 68, 0.1);
            color: #EF4444;
        }

        .back-link {
            display: flex;
            align-items: center;
            margin-top: 10px;
        }
        
        .back-link .btn {
            padding: 8px 16px;
            font-size: 0.875rem;
            line-height: 1;
        }
        
        .back-link .btn svg {
            width: 16px;
            height: 16px;
        }
        
        @media (max-width: 640px) {
            .back-link .btn {
                padding: 6px 12px;
                font-size: 0.8rem;
            }
            
            .back-link .btn svg {
                width: 14px;
                height: 14px;
            }
        }

        /* Button group */
        .btn-group {
            display: flex;
            gap: 1rem;
            margin-top: 2rem;
            margin-bottom: 2rem;
            flex-wrap: wrap;
        }

        /* Result */
        .result {
            padding: 2rem;
            background: linear-gradient(135deg, rgba(79, 70, 229, 0.05) 0%, rgba(245, 158, 11, 0.05) 100%);
            border: 2px solid rgba(79, 70, 229, 0.2);
            border-radius: 1rem;
            text-align: center;
            margin-bottom: 2rem;
            animation: fadeIn 0.5s ease;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: scale(0.95);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        .result.hidden {
            display: none;
        }

        .result-label {
            font-size: 0.95rem;
            color: var(--text-secondary);
            margin-bottom: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 600;
        }

        .result-value {
            font-size: 3.5rem;
            font-weight: 800;
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 0.5rem;
        }

        .result-grade {
            font-size: 1.25rem;
            color: var(--primary);
            font-weight: 600;
        }

        /* Grade table */
        .grade-info {
            margin-top: 2rem;
            padding-top: 2rem;
            border-top: 1px solid var(--border);
        }

        .grade-info h3 {
            font-size: 1rem;
            margin-bottom: 1rem;
            color: var(--text-primary);
            font-weight: 700;
        }

        .grade-table {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
            gap: 0.5rem;
        }

        .grade-item {
            padding: 0.625rem 0.5rem;
            background: linear-gradient(135deg, #F0F9FF 0%, #FFFBEB 100%);
            border-radius: 0.375rem;
            border: 1px solid var(--border);
            text-align: center;
            transition: all 0.3s ease;
        }
        
        @media (max-width: 640px) {
            .grade-table {
                grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
                gap: 0.375rem;
            }
            
            .grade-item {
                padding: 0.5rem 0.375rem;
            }
        }

        html.dark .grade-item {
            background: linear-gradient(135deg, rgba(96, 165, 250, 0.1) 0%, rgba(251, 191, 36, 0.1) 100%);
            border-color: rgba(148, 163, 184, 0.2);
        }

        .grade-item:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow);
        }

        .grade-item .grade {
            font-weight: 700;
            font-size: 1rem;
            color: var(--primary);
            display: block;
        }

        .grade-item .points {
            font-size: 0.7rem;
            color: var(--text-secondary);
            margin-top: 0.125rem;
        }
        
        @media (max-width: 640px) {
            .grade-item .grade {
                font-size: 0.9rem;
            }
            
            .grade-item .points {
                font-size: 0.65rem;
            }
        }

        /* Tab panel */
        .tab-panel {
            display: none;
        }

        .tab-panel.active {
            display: block;
            animation: fadeIn 0.3s ease;
        }

        /* Footer */
        footer {
            text-align: center;
            padding: 2rem;
            color: var(--text-secondary);
            font-size: 0.9rem;
            margin-top: 2rem;
            border-top: 1px solid var(--border);
            width: 100%;
            max-width: 100vw;
            box-sizing: border-box;
            overflow-x: hidden;
        }

        footer a {
            color: var(--primary);
            text-decoration: none;
            font-weight: 600;
        }

        footer a:hover {
            text-decoration: underline;
        }

        /* Responsive */
        @media (max-width: 640px) {
            h1 {
                font-size: 1.75rem;
            }

            .subject-row {
                grid-template-columns: 1fr;
                gap: 0.75rem;
            }

            .tab-btn {
                min-width: 100px;
                padding: 0.7rem 0.9rem;
                font-size: 0.85rem;
            }

            .card {
                padding: 1.5rem;
            }

            .result-value {
                font-size: 2.75rem;
            }

            .tabs {
                gap: 0.5rem;
                padding: 0.625rem;
            }
            
            .btn {
                padding: 0.75rem 1.05rem;
                font-size: 0.85rem;
            }
            
            .btn-group {
                flex-direction: column;
                gap: 0.65rem;
            }
            
            .btn-group .btn {
                width: 100%;
            }
            
            .back-link {
                position: static;
                display: flex;
                justify-content: flex-end;
                margin-bottom: 1rem;
            }
            
            .back-link .btn {
                width: auto;
                padding: 0.35rem 0.625rem;
                font-size: 0.7rem;
            }
            
            .back-link .btn svg {
                width: 12px;
                height: 12px;
            }
        }
    