html[data-bg="1"] body {
    background: linear-gradient(135deg, #fce4ec 0%, #f3e5f5 100%) !important;
}

html[data-bg="2"] body {
    background: linear-gradient(135deg, #e1bee7 0%, #f8bbd0 100%) !important;
}

html[data-bg="3"] body {
    background: linear-gradient(135deg, #f3e5f5 0%, #e8eaf6 100%) !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
  --bg-main: #faf5ff;       
  --bg-sidebar: #f5f3ff;    
  --bg-card: #ffffff;        
  --accent: #c084fc;        
  --accent-hover: #a855f7;   
  --accent-pink: #f472b6;
  --text-main: #4a1d96;      
  --text-muted: #9333ea;     
  --border: #e9d5ff;
  --shadow: rgba(168, 85, 247, 0.15);
}

body {
    font-family: 'Comic Sans MS', 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(135deg, #fae8ff 0%, #f3e8ff 50%, #ede9fe 100%);
    color: var(--text-main);
    min-height: 100vh;
}

.hero {
    position: relative;
    height: 140px;
    background: linear-gradient(135deg, #f5f3ff 0%, #fae8ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid var(--accent);
    box-shadow: 0 4px 12px var(--shadow);
}

.hero-text {
    text-align: center;
}

.hero-text h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: 1px;
}

.hero-text p {
    color: var(--text-muted);
    margin-top: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.menu {
    background: linear-gradient(90deg, #f5f3ff, #fae8ff, #f5f3ff);
    color: var(--accent);
    padding: 14px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 2px;
    font-size: 0.8rem;
    border-bottom: 3px solid var(--border);
    text-transform: uppercase;
}

.layout {
    display: flex;
    min-height: calc(100vh - 220px);
    position: relative;
    z-index: 1;
}

.sidebar-menu {
    width: 240px;
    background: linear-gradient(180deg, #f5f3ff 0%, #fae8ff 100%);
    border-right: 3px solid var(--border);
    padding: 24px 16px;
    box-shadow: 4px 0 12px var(--shadow);
}

.sidebar-menu h2 {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 20px;
    font-weight: 700;
    text-align: center;
}

.sidebar-menu h2::before {
    content: '🎀 ';
}

.sidebar-menu h3 {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 20px 0 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.js-activities {
    list-style: none;
}

.js-activities li {
    margin-bottom: 8px;
}

.js-activities button {
    width: 100%;
    padding: 10px 14px;
    background: white;
    border: 2px solid var(--border);
    color: var(--text-main);
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 500;
}

.js-activities button:hover {
    background: linear-gradient(135deg, var(--accent), var(--accent-pink));
    color: white;
    border-color: var(--accent);
    transform: translateX(4px);
    box-shadow: 0 4px 12px var(--shadow);
}

main {
    flex: 1;
    padding: 24px;
}

.content-grid {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 100%;
}

.about-card,
.output-card,
.console-card,
.exercise4-card {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 16px;
    border: 3px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow);
    position: relative;
}

.about-card,
.output-card,
.console-card,
.exercise4-card {
    flex: 1;
    min-width: 220px;
    min-height: 150px;
}

.card-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-width: 220px;
}

.output-card {
    display: flex;
    flex-direction: column;
}

.card-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-pink));
    color: white;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px var(--shadow);
}

.about-card h2,
.output-card h2,
.console-card h2 {
    color: var(--text-main);
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 700;
}

.about-card p,
.console-card p {
    color: var(--text-muted);
    line-height: 1.5;
    font-size: 0.75rem;
}

.output-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.output-message {
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 8px;
    font-size: 0.75rem;
}

#movieImg {
    display: none;
    margin-top: 16px;
    border-radius: 16px;
    border: 3px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow);
    max-width: 300px;
    height: auto;
}

footer {
    text-align: center;
    padding: 20px;
    font-size: 0.8rem;
    background: linear-gradient(90deg, #f5f3ff, #fae8ff, #f5f3ff);
    border-top: 3px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
}

.todo-card,
.char-counter-card,
#todo-container-8,
#calculator-container,
#todo-container {
    background: white;
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    max-width: 100%;
    margin-top: 16px;
    box-shadow: 0 4px 12px var(--shadow);
}

.todo-card h3,
.char-counter-card h3,
#todo-container-8 h3,
#calculator-container h3,
#todo-container h3 {
    margin-bottom: 14px;
    color: var(--accent);
    font-size: 1rem;
    font-weight: 700;
}

.todo-input-group {
    display: flex;
    gap: 10px;
}

.todo-input-group input,
#charInput,
#todo-container-8 input,
#calculator-container input,
#todo-container input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: white;
    color: var(--text-main);
    font-size: 0.85rem;
}

.todo-input-group input::placeholder,
#charInput::placeholder,
#todo-container-8 input::placeholder,
#calculator-container input::placeholder,
#todo-container input::placeholder {
    color: #c4b5fd;
}

.todo-input-group input:focus,
#charInput:focus,
#todo-container-8 input:focus,
#calculator-container input:focus,
#todo-container input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(192, 132, 252, 0.2);
}

.todo-input-group button,
#todo-container-8 button,
#calculator-container button,
#todo-container button {
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-pink));
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.todo-input-group button:hover,
#todo-container-8 button:hover,
#calculator-container button:hover,
#todo-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

#todo-list,
#todo-container-8 ul,
#todo-container ul {
    list-style: none;
    margin-top: 12px;
}

#todo-list li,
#todo-container-8 li,
#todo-container li {
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.4), rgba(26, 26, 46, 0.4));
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

#todo-list li::before,
#todo-container-8 li::before,
#todo-container li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), transparent);
    transition: width 0.3s ease;
    opacity: 0.2;
}

#todo-list li:hover,
#todo-container-8 li:hover,
#todo-container li:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(255, 0, 110, 0.1));
    transform: translateX(8px);
    box-shadow: 0 4px 20px var(--shadow), 0 0 30px var(--glow);
    border-left-color: var(--accent-2);
}

#todo-list li:hover::before,
#todo-container-8 li:hover::before,
#todo-container li:hover::before {
    width: 100%;
}

#charCount {
    font-size: 0.85rem;
    color: var(--text-muted);
}

#calculator-container input {
    width: 100%;
    margin-bottom: 10px;
}

#calculator-container button {
    width: 100%;
    padding: 8px 14px;
    margin-bottom: 10px;
}

#calc-result {
    padding: 12px 16px;
    background: linear-gradient(135deg, #fae8ff, #f5f3ff);
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--accent);
    border: 2px solid var(--border);
    font-weight: 600;
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }
    
    .sidebar-menu {
        width: 100%;
        border-right: none;
        border-bottom: 3px solid var(--border);
    }
    
    .js-activities button {
        text-align: center;
    }
    
    .content-grid {
        max-width: 100%;
    }
}

#todo-list li,
#todo-container-8 li,
#todo-container li {
    background: var(--bg-main);
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

#todo-list li:hover,
#todo-container-8 li:hover,
#todo-container li:hover {
    background: #f9fafb;
    border-color: var(--accent);
}

/* Dark Mode Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 64px;
    height: 32px;
    cursor: pointer;
    margin-top: 8px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #e9d5ff;
    border-radius: 32px;
    transition: 0.3s;
    border: 2px solid var(--border);
}

.toggle-slider::before {
    content: "☀️";
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    line-height: 24px;
    text-align: center;
}

.toggle-switch input:checked + .toggle-slider {
    background: #4a1d96;
    border-color: #7c3aed;
}

.toggle-switch input:checked + .toggle-slider::before {
    content: "🌙";
    transform: translateX(32px) translateY(-50%);
}

/* Grade Calculator Card */
.grade-card {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 16px;
    border: 3px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow);
    position: relative;
    width: 100%;
}

.grade-card h2 {
    color: var(--text-main);
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 700;
}

.grade-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grade-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.grade-input-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.grade-input-group input {
    padding: 8px 12px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: white;
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: inherit;
    width: 100%;
}

.grade-input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(192, 132, 252, 0.2);
}

.grade-error {
    color: #dc3545;
    font-size: 0.72rem;
    display: none;
}

.grade-btn-group {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.grade-btn-group button {
    flex: 1;
    padding: 9px;
    border: none;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

#calculateBtn {
    background: linear-gradient(135deg, var(--accent), var(--accent-pink));
    color: white;
    box-shadow: 0 2px 8px var(--shadow);
}

#calculateBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

#resetBtn {
    background: white;
    color: var(--text-muted);
    border: 2px solid var(--border);
}

#resetBtn:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.grade-result {
    display: none;
    background: linear-gradient(135deg, #fae8ff, #f5f3ff);
    border-radius: 12px;
    padding: 12px 14px;
    border: 2px solid var(--border);
    margin-top: 4px;
}

.grade-result.show {
    display: block;
}

.grade-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.grade-result-row strong {
    color: var(--accent);
    font-size: 1rem;
}

/* Live Console */
#live-console {
    background: #1a1a2e;
    border-radius: 10px;
    padding: 10px 12px;
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
}

.console-line {
    color: #a5f3a5;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    word-break: break-all;
}

.console-line:last-child {
    border-bottom: none;
}
