:root {
            --sage-light: #e8f5e9;
            --sage-medium: #c8e6c9;
            --beige: #f5f5dc;
            --off-white: #fafafa;
            --dark-green: #2e7d32;
            --darker-green: #1b5e20;
            --purple-accent: #7b1fa2;
            --purple-light: #e1bee7;
            --error-red: #c62828;
            --success-green: #2e7d32;
            --text-primary: #333;
            --text-secondary: #666;
            --shadow: 0 2px 8px rgba(0,0,0,0.1);
            --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
        }
        
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            line-height: 1.6;
            color: var(--text-primary);
            background: var(--off-white);
        }
        
        /* Header Styles */
        header {
            background: linear-gradient(135deg, var(--dark-green) 0%, var(--darker-green) 100%);
            color: white;
            padding: 1rem 0;
            box-shadow: var(--shadow);
            position: sticky;
            top: 0;
            z-index: 100;
        }
        
        .header-content {
            max-width: 900px;
            margin: 0 auto;
            padding: 0 1rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 0.5rem;
        }
        
        .logo {
            font-size: 1.5rem;
            font-weight: bold;
            text-decoration: none;
            color: white;
            letter-spacing: 0.5px;
        }
        
        .exercise-indicator {
            background: rgba(255,255,255,0.2);
            padding: 0.5rem 1rem;
            border-radius: 20px;
            font-size: 0.9rem;
            font-weight: 500;
        }
        
        /* Navigation */
        .nav-bar {
            background: var(--beige);
            border-bottom: 2px solid var(--sage-medium);
            padding: 1rem 0;
            position: sticky;
            top: 60px;
            z-index: 99;
        }
        
        .nav-content {
            max-width: 900px;
            margin: 0 auto;
            padding: 0 1rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .nav-btn {
            text-decoration: none;
            color: var(--dark-green);
            font-weight: 600;
            padding: 0.5rem 1rem;
            border-radius: 8px;
            transition: all 0.3s;
            border: 2px solid transparent;
        }
        
        .nav-btn:hover {
            background: var(--sage-light);
            border-color: var(--dark-green);
            transform: translateY(-1px);
        }
        
        /* Main Container */
        main {
            max-width: 900px;
            margin: 0 auto;
            padding: 2rem 1rem;
        }
        
        section {
            margin-bottom: 3rem;
            scroll-margin-top: 140px;
        }
        
        h1 {
            color: var(--darker-green);
            font-size: 2rem;
            margin-bottom: 1.5rem;
            border-bottom: 3px solid var(--sage-medium);
            padding-bottom: 0.5rem;
        }
        
        h2 {
            color: var(--dark-green);
            font-size: 1.5rem;
            margin: 2rem 0 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        h3 {
            color: var(--text-primary);
            font-size: 1.2rem;
            margin: 1.5rem 0 0.75rem;
            padding-left: 0.5rem;
            border-left: 4px solid var(--purple-accent);
        }
        
        /* Theory Cards */
        .theory-intro {
            background: var(--beige);
            padding: 1.5rem;
            border-radius: 12px;
            margin-bottom: 2rem;
            border-left: 5px solid var(--dark-green);
        }
        
        .gender-section {
            background: white;
            border-radius: 12px;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            box-shadow: var(--shadow);
            transition: box-shadow 0.3s;
        }
        
        .gender-section:hover {
            box-shadow: var(--shadow-hover);
        }
        
        .gender-header {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-bottom: 1rem;
            font-size: 1.3rem;
            font-weight: bold;
            color: var(--dark-green);
        }
        
        .gender-icon {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            color: white;
        }
        
        .masculine { background: #2196f3; }
        .feminine { background: #e91e63; }
        .neuter { background: #ff9800; }
        .foreign { background: var(--purple-accent); }
        
        .pattern-box {
            background: var(--sage-light);
            padding: 1rem;
            border-radius: 8px;
            margin: 0.75rem 0;
            border-left: 4px solid var(--purple-accent);
        }
        
        .example-list {
            display: grid;
            gap: 0.5rem;
            margin: 0.75rem 0;
        }
        
        .example-item {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 0.5rem;
            background: var(--off-white);
            border-radius: 6px;
            flex-wrap: wrap;
        }
        
        .singular {
            color: var(--text-secondary);
            font-weight: 500;
        }
        
        .arrow {
            color: var(--purple-accent);
            font-weight: bold;
        }
        
        .plural {
            color: var(--dark-green);
            font-weight: bold;
            font-size: 1.1rem;
        }
        
        .umlaut-highlight {
            background: var(--purple-light);
            padding: 0 2px;
            border-radius: 3px;
            font-weight: bold;
            color: var(--purple-accent);
        }
        
        /* Interactive Tools */
        .tool-container {
            background: white;
            border-radius: 12px;
            padding: 2rem;
            margin: 1.5rem 0;
            box-shadow: var(--shadow);
        }
        
        .tool-title {
            font-size: 1.3rem;
            color: var(--purple-accent);
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        /* Dictionary Decoder */
        .decoder-display {
            background: var(--beige);
            padding: 2rem;
            border-radius: 8px;
            text-align: center;
            font-family: 'Courier New', monospace;
            font-size: 1.5rem;
            margin: 1rem 0;
            letter-spacing: 2px;
            position: relative;
            overflow: hidden;
        }
        
        .decoder-part {
            display: inline-block;
            padding: 0.5rem;
            margin: 0.25rem;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s;
            position: relative;
        }
        
        .decoder-part:hover {
            transform: scale(1.05);
        }
        
        .part-gender { background: #bbdefb; color: #1565c0; }
        .part-genitive { background: #ffe0b2; color: #e65100; }
        .part-plural { background: #e1bee7; color: var(--purple-accent); font-weight: bold; }
        
        .decoder-legend {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1rem;
            margin-top: 1rem;
        }
        
        .legend-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem;
            border-radius: 6px;
            font-size: 0.9rem;
        }
        
        /* Plural Builder */
        .builder-form {
            display: grid;
            gap: 1rem;
            max-width: 500px;
            margin: 1rem 0;
        }
        
        .form-group {
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
        }
        
        label {
            font-weight: 600;
            color: var(--dark-green);
            font-size: 0.9rem;
        }
        
        input, select {
            padding: 0.75rem;
            border: 2px solid var(--sage-medium);
            border-radius: 8px;
            font-size: 1rem;
            transition: border-color 0.3s;
        }
        
        input:focus, select:focus {
            outline: none;
            border-color: var(--dark-green);
            box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
        }
        
        .umlaut-buttons {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
            margin-top: 0.5rem;
        }
        
        .umlaut-btn {
            width: 40px;
            height: 40px;
            border: 2px solid var(--purple-accent);
            background: white;
            color: var(--purple-accent);
            border-radius: 8px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.2s;
        }
        
        .umlaut-btn:hover {
            background: var(--purple-accent);
            color: white;
            transform: translateY(-2px);
        }
        
        button {
            background: var(--dark-green);
            color: white;
            border: none;
            padding: 0.75rem 1.5rem;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s;
            font-size: 1rem;
        }
        
        button:hover {
            background: var(--darker-green);
            transform: translateY(-2px);
            box-shadow: var(--shadow);
        }
        
        button.secondary {
            background: var(--beige);
            color: var(--dark-green);
            border: 2px solid var(--dark-green);
        }
        
        button.secondary:hover {
            background: var(--sage-light);
        }
        
        button.danger {
            background: #ffcdd2;
            color: var(--error-red);
            border: 2px solid var(--error-red);
        }
        
        button.danger:hover {
            background: var(--error-red);
            color: white;
        }
        
        /* Pattern Tables */
        .pattern-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1rem;
            margin: 1rem 0;
        }
        
        .pattern-card {
            background: var(--sage-light);
            padding: 1rem;
            border-radius: 8px;
            border-top: 4px solid var(--purple-accent);
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .pattern-card:hover {
            transform: translateY(-3px);
            box-shadow: var(--shadow);
        }
        
        .pattern-card.active {
            background: var(--purple-light);
            border-top-color: var(--darker-green);
        }
        
        .pattern-ending {
            font-size: 1.5rem;
            font-weight: bold;
            color: var(--purple-accent);
            margin-bottom: 0.5rem;
        }
        
        /* Exercise Sections */
        .exercise-container {
            background: white;
            border-radius: 12px;
            padding: 2rem;
            margin: 1.5rem 0;
            box-shadow: var(--shadow);
        }
        
        .exercise-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
            flex-wrap: wrap;
            gap: 1rem;
        }
        
        .exercise-title {
            font-size: 1.3rem;
            color: var(--dark-green);
            font-weight: bold;
        }
        
        .exercise-item {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 1rem;
            background: var(--off-white);
            border-radius: 8px;
            margin-bottom: 0.75rem;
            flex-wrap: wrap;
            transition: background 0.3s;
        }
        
        .exercise-item.correct {
            background: #c8e6c9;
            border-left: 4px solid var(--success-green);
        }
        
        .exercise-item.incorrect {
            background: #ffcdd2;
            border-left: 4px solid var(--error-red);
        }
        
        .item-number {
            font-weight: bold;
            color: var(--purple-accent);
            min-width: 30px;
        }
        
        .item-prompt {
            flex: 1;
            min-width: 200px;
        }
        
        .item-input {
            flex: 2;
            min-width: 200px;
        }
        
        .feedback {
            font-size: 0.85rem;
            margin-top: 0.25rem;
            font-weight: 600;
        }
        
        .feedback.correct { color: var(--success-green); }
        .feedback.incorrect { color: var(--error-red); }
        
        /* Translation Exercise */
        .translation-item {
            flex-direction: column;
            align-items: flex-start;
        }
        
        .translation-prompt {
            font-style: italic;
            color: var(--text-secondary);
            margin-bottom: 0.5rem;
        }
        
        /* Action Buttons */
        .action-bar {
            display: flex;
            gap: 1rem;
            flex-wrap: wrap;
            margin: 2rem 0;
            padding: 1rem;
            background: var(--beige);
            border-radius: 8px;
            position: sticky;
            bottom: 20px;
            box-shadow: var(--shadow-hover);
        }
        
        /* Challenge Mode */
        .challenge-card {
            background: linear-gradient(135deg, var(--purple-light) 0%, var(--sage-light) 100%);
            padding: 2rem;
            border-radius: 16px;
            text-align: center;
            box-shadow: var(--shadow);
        }
        
        .streak-counter {
            font-size: 3rem;
            font-weight: bold;
            color: var(--purple-accent);
            margin: 1rem 0;
        }
        
        .noun-display {
            font-size: 2rem;
            margin: 1.5rem 0;
            padding: 1rem;
            background: white;
            border-radius: 12px;
            box-shadow: var(--shadow);
        }
        
        /* Progress Bar */
        .progress-container {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: rgba(255,255,255,0.3);
            z-index: 101;
        }
        
        .progress-bar {
            height: 100%;
            background: #ffeb3b;
            width: 0%;
            transition: width 0.3s;
        }
        
        /* Summary Table */
        .summary-table {
            width: 100%;
            border-collapse: collapse;
            margin: 1rem 0;
            background: white;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: var(--shadow);
        }
        
        .summary-table th {
            background: var(--dark-green);
            color: white;
            padding: 1rem;
            text-align: left;
        }
        
        .summary-table td {
            padding: 1rem;
            border-bottom: 1px solid var(--sage-medium);
        }
        
        .summary-table tr:hover {
            background: var(--sage-light);
        }
        
        .ending-tag {
            display: inline-block;
            padding: 0.25rem 0.75rem;
            background: var(--purple-light);
            color: var(--purple-accent);
            border-radius: 20px;
            font-weight: bold;
            font-family: monospace;
        }
        
        /* Flip Cards */
        .flip-card-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 1rem;
            margin: 1rem 0;
        }
        
        .flip-card {
            height: 120px;
            perspective: 1000px;
            cursor: pointer;
        }
        
        .flip-card-inner {
            position: relative;
            width: 100%;
            height: 100%;
            transition: transform 0.6s;
            transform-style: preserve-3d;
        }
        
        .flip-card.flipped .flip-card-inner {
            transform: rotateY(180deg);
        }
        
        .flip-card-front, .flip-card-back {
            position: absolute;
            width: 100%;
            height: 100%;
            backface-visibility: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
            box-shadow: var(--shadow);
            font-weight: bold;
            font-size: 1.2rem;
        }
        
        .flip-card-front {
            background: var(--beige);
            color: var(--dark-green);
        }
        
        .flip-card-back {
            background: var(--purple-accent);
            color: white;
            transform: rotateY(180deg);
        }
        
        /* Responsive */
        @media (max-width: 600px) {
            .header-content {
                flex-direction: column;
                text-align: center;
            }
            
            h1 { font-size: 1.5rem; }
            h2 { font-size: 1.2rem; }
            
            .exercise-item {
                flex-direction: column;
                align-items: stretch;
            }
            
            .item-input {
                width: 100%;
            }
            
            .action-bar {
                flex-direction: column;
            }
            
            button {
                width: 100%;
            }
        }
        
        /* Utility Classes */
        .hidden { display: none !important; }
        .fade-in { animation: fadeIn 0.5s; }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .info-box {
            background: #e3f2fd;
            border-left: 4px solid #2196f3;
            padding: 1rem;
            margin: 1rem 0;
            border-radius: 0 8px 8px 0;
        }
        
        .tip-box {
            background: #fff3e0;
            border-left: 4px solid #ff9800;
            padding: 1rem;
            margin: 1rem 0;
            border-radius: 0 8px 8px 0;
        }
        
        /* Keyboard Navigation Focus */
        *:focus-visible {
            outline: 3px solid var(--purple-accent);
            outline-offset: 2px;
        }
        
        /* Skip to main content link for accessibility */
        .skip-link {
            position: absolute;
            top: -40px;
            left: 0;
            background: var(--dark-green);
            color: white;
            padding: 8px;
            text-decoration: none;
            z-index: 1000;
        }
        
        .skip-link:focus {
            top: 0;
        }
