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

html {
    overflow-x: hidden;
    touch-action: manipulation;
}

body {
    touch-action: manipulation;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --success: #10b981;
    --warning: #f59e0b;
    --player-x: #06b6d4;
    --player-o: #ec4899;
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
    touch-action: pan-y;
}

/* Navigation menu removed - using back buttons instead */

.container {
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 800px;
    width: 100%;
    box-sizing: border-box;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 3rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--player-x), var(--player-o));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

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

.game-settings {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--surface);
    border-radius: var(--border-radius);
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

select {
    padding: 10px 15px;
    border: 2px solid var(--surface-light);
    border-radius: 8px;
    background: var(--surface-light);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    max-width: 100%;
}

select:hover {
    border-color: var(--primary-color);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: var(--surface);
    border-radius: var(--border-radius);
    flex-wrap: wrap;
    gap: 15px;
}

.player-turn {
    font-size: 1.2rem;
    font-weight: 600;
}

#currentPlayer {
    font-weight: bold;
    font-size: 1.4rem;
    padding: 5px 15px;
    border-radius: 6px;
    display: inline-block;
}

.player-x {
    color: var(--player-x);
    background: rgba(6, 182, 212, 0.1);
}

.player-o {
    color: var(--player-o);
    background: rgba(236, 72, 153, 0.1);
}

.player-red {
    color: #f87171;
    background: rgba(248, 113, 113, 0.15);
}

.player-black {
    color: #e2e8f0;
    background: rgba(226, 232, 240, 0.12);
}

.status-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.game-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    padding: 20px;
}

.game-board {
    display: grid;
    gap: 10px;
    background: var(--surface);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.cell {
    aspect-ratio: 1;
    background: var(--surface-light);
    border: 3px solid transparent;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.cell:hover:not(.taken) {
    background: var(--surface);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.cell.taken {
    cursor: not-allowed;
}

.cell.x {
    color: var(--player-x);
    animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.cell.o {
    color: var(--player-o);
    animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.cell.winner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border-color: var(--success);
    animation: pulse 0.6s ease-in-out;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.btn {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--surface);
    transform: translateY(-2px);
}

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

.score-board {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: var(--surface);
    border-radius: var(--border-radius);
    gap: 20px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.score-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .container {
        padding: 20px 15px;
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 8px;
    }

    h1 {
        font-size: 2rem;
    }

    .game-settings {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .setting-group {
        width: 100%;
    }

    select {
        width: 100%;
    }

    .cell {
        font-size: 1.5rem;
    }

    .game-controls {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        width: 100%;
        padding: 12px 20px;
    }

    .game-board {
        padding: 10px;
        gap: 8px;
    }

    input[type="number"] {
        width: 100%;
        font-size: 16px;
    }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--border-radius);
    text-align: center;
    animation: slideUp 0.3s ease;
    max-width: 400px;
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.modal-content p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.modal-content .btn {
    margin-top: 10px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.thinking {
    opacity: 0.6;
    pointer-events: none;
}

.menu-container {
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
}

.menu-header {
    text-align: center;
    margin-bottom: 50px;
}

.menu-subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-top: 10px;
}

.menu-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.menu-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 30px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.menu-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.3);
}

.card-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

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

.menu-card h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.menu-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.feature-list {
    list-style: none;
    margin-bottom: 25px;
    width: 100%;
}

.feature-list li {
    color: var(--text-secondary);
    padding: 8px 0;
    border-bottom: 1px solid var(--surface-light);
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-list li::before {
    content: "✓ ";
    color: var(--success);
    font-weight: bold;
    margin-right: 8px;
}

.menu-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.menu-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

.menu-footer {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--surface-light);
    color: var(--text-secondary);
}

.back-button {
    display: inline-block;
    padding: 10px 20px;
    background: var(--surface);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 20px;
    font-weight: 600;
}

.back-button:hover {
    background: var(--surface-light);
    transform: translateX(-5px);
}

.fibonacci-container {
    max-width: 1000px;
}

.fibonacci-info {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    border-left: 4px solid var(--primary-color);
}

.info-text {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.results-section {
    margin-top: 30px;
}

.sequence-display {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.sequence-display h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.sequence-output {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 60px;
    align-items: center;
    color: var(--text-secondary);
}

.fib-number {
    display: inline-block;
    padding: 8px 15px;
    background: var(--surface-light);
    border-radius: 6px;
    color: var(--player-x);
    font-weight: 600;
    animation: popIn 0.5s ease backwards;
}

.error {
    color: #ef4444;
    font-weight: 600;
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.stat-value {
    color: var(--player-o);
    font-size: 2rem;
    font-weight: bold;
}

.visualization-section {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.visualization-section h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.visual-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 300px;
    gap: 5px;
    padding: 10px;
    background: var(--background);
    border-radius: 8px;
    position: relative;
}

.visual-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--player-x), var(--primary-color));
    border-radius: 4px 4px 0 0;
    min-height: 2%;
    position: relative;
    animation: growUp 0.5s ease backwards;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

@keyframes growUp {
    from {
        transform: scaleY(0);
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

.bar-label {
    position: absolute;
    bottom: -25px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.visual-note {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.info-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    padding: 25px;
    border-radius: var(--border-radius);
    border: 2px solid var(--surface-light);
}

.info-box h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.info-box p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

@media (max-width: 768px) {
    .menu-container {
        padding: 20px 15px;
        border-radius: 8px;
    }

    .menu-header {
        margin-bottom: 30px;
    }

    .menu-cards {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .menu-card {
        padding: 20px;
    }

    .card-icon {
        font-size: 3rem;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .visual-bars {
        height: 200px;
    }

    .bar-label {
        font-size: 0.6rem;
    }

    .fibonacci-container {
        padding: 20px 15px;
    }

    .sudoku-container {
        padding: 20px 15px;
    }
}

.sudoku-container {
    max-width: 700px;
}

.sudoku-info {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    border-left: 4px solid var(--primary-color);
}

.sudoku-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    padding: 20px;
}

.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
    background: var(--surface-light);
    padding: 10px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--surface-light);
}

.sudoku-cell {
    width: 100%;
    aspect-ratio: 1;
    background: var(--background);
    border: 1px solid var(--surface-light);
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
    outline: none;
}

.sudoku-cell:focus {
    background: var(--surface);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
    z-index: 10;
}

.sudoku-cell:hover {
    background: var(--surface);
}

.sudoku-cell.right-border {
    border-right: 3px solid var(--surface-light);
}

.sudoku-cell.bottom-border {
    border-bottom: 3px solid var(--surface-light);
}

.sudoku-cell.alternate-box {
    background: rgba(99, 102, 241, 0.05);
}

.sudoku-cell.alternate-box:focus {
    background: var(--surface);
}

.sudoku-cell.solved-cell {
    color: var(--player-x);
    animation: popIn 0.5s ease backwards;
}

.sudoku-cell.original-cell {
    color: var(--text-primary);
    font-weight: bold;
}

.sudoku-cell.invalid {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.sudoku-status {
    text-align: center;
    padding: 15px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 20px;
}

.sudoku-status.success-message {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 2px solid var(--success);
}

.sudoku-status.error-message {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 2px solid #ef4444;
}

.sudoku-status.info-message {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.sudoku-status.solving-message {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 2px solid var(--warning);
}

@media (max-width: 768px) {
    .sudoku-board {
        padding: 5px;
        gap: 1px;
    }
    
    .sudoku-cell {
        font-size: 1rem;
    }
    
    .sudoku-container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .sudoku-cell {
        font-size: 1rem;
    }

    .posting-text-input {
        min-height: 100px;
        font-size: 16px;
        padding: 10px 12px;
    }

    .posting-file-input {
        font-size: 13px;
    }

    .posting-image-preview {
        max-height: 200px;
    }

    .post-image {
        max-height: 300px;
    }

    .post-card {
        padding: 12px;
    }

    .posting-composer {
        padding: 12px;
    }

    .posting-feed-title {
        font-size: 1.2rem;
    }

    .post-feed {
        gap: 12px;
    }
}

@media (max-width: 360px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 12px 10px;
    }

    .menu-container {
        padding: 12px 10px;
    }


    h1 {
        font-size: 1.5rem;
    }

    .menu-header h1 {
        font-size: 1.6rem;
    }

    .card-icon {
        font-size: 2.5rem;
    }

    .menu-card {
        padding: 15px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .cell {
        font-size: 1.1rem;
    }

    .sudoku-cell {
        font-size: 0.85rem;
    }

    .posting-container {
        padding: 10px 8px;
    }

    .posting-image-preview {
        max-height: 180px;
    }

    .post-image {
        max-height: 250px;
    }

    .post-card {
        padding: 10px;
    }

    .posting-composer {
        padding: 10px;
    }

    .posting-feed-title {
        font-size: 1.1rem;
    }
}

.todo-container {
    max-width: 980px;
}

.todo-top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.todo-nav-button {
    text-transform: none;
    letter-spacing: 0;
}

.motivation-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(16, 185, 129, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.35);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.motivation-text-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.motivation-label {
    color: var(--text-secondary);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.motivation-quote {
    color: var(--text-primary);
    line-height: 1.55;
    font-size: 1.05rem;
    font-weight: 500;
}

.todo-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.storage-prefix-pill {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.storage-prefix-pill span {
    color: var(--text-primary);
    font-weight: 700;
}

.archive-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
}

.archive-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(217, 119, 6, 0.35);
}

.todo-input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.todo-input {
    flex: 1;
    min-width: 220px;
    max-width: 100%;
    border-radius: 10px;
    border: 2px solid var(--surface-light);
    background: var(--surface);
    color: var(--text-primary);
    padding: 12px 14px;
    font-size: 1rem;
    transition: var(--transition);
}

.todo-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.todo-summary {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    margin-bottom: 18px;
    font-size: 0.95rem;
}

.todo-summary strong {
    color: var(--text-primary);
}

.todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 8px;
}

.todo-list::-webkit-scrollbar {
    width: 8px;
}

.todo-list::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 10px;
}

.todo-list::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 10px;
}

.todo-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.todo-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: start;
    padding: 16px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid transparent;
    transition: var(--transition);
}

.todo-item:hover {
    border-color: var(--surface-light);
    transform: translateY(-1px);
}

.todo-item.completed {
    opacity: 0.95;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 4px;
    accent-color: var(--success);
    cursor: pointer;
}

.todo-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 8px;
}

.todo-text {
    font-size: 1.05rem;
    color: var(--text-primary);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.todo-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.todo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.btn-small {
    padding: 8px 14px;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: 0;
}

.btn.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fecaca;
}

.btn.danger:hover {
    background: rgba(239, 68, 68, 0.28);
}

.todo-edit-input {
    width: 100%;
    max-width: 100%;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
    background: var(--background);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 0.98rem;
    box-sizing: border-box;
}

.todo-edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

.todo-empty {
    background: var(--surface);
    border: 1px dashed var(--surface-light);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.todo-status {
    min-height: 1.4rem;
    margin-top: 14px;
    text-align: center;
    color: var(--text-secondary);
    opacity: 0;
    transition: var(--transition);
}

.todo-status.show {
    opacity: 1;
}

.todo-status.status-success {
    color: var(--success);
}

.todo-status.status-error {
    color: #fca5a5;
}

.archive-modal-content {
    max-width: 460px;
}

.archive-modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.archive-page-container {
    max-width: 1000px;
}

.archive-prefix-pill {
    margin-bottom: 22px;
}

.archive-content {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.archive-day-group {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    padding: 18px;
}

.archive-day-title {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.archive-batch-card {
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
}

.archive-batch-card:last-child {
    margin-bottom: 0;
}

.archive-batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.archive-batch-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
}

.archive-batch-summary {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.archive-note {
    color: var(--warning);
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.archive-items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.archive-item {
    background: var(--surface);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
}

.archive-item.is-complete {
    border-left: 4px solid var(--success);
}

.archive-item.is-complete::before {
    content: "✓ ";
    color: var(--success);
    font-weight: 700;
}

.archive-item.is-pending {
    border-left: 4px solid var(--warning);
}

.archive-item.is-pending::before {
    content: "• ";
    color: var(--warning);
    font-weight: 700;
}

.archive-item-empty {
    color: var(--text-secondary);
    font-style: italic;
}

.archive-empty {
    background: var(--surface);
    border: 1px dashed var(--surface-light);
    border-radius: 12px;
    padding: 26px;
    text-align: center;
    color: var(--text-secondary);
}

@media (max-width: 768px) {

    .todo-container {
        padding: 20px 15px;
    }

    .subtitle {
        font-size: 1rem;
    }

    .todo-top-nav {
        margin-bottom: 15px;
        flex-direction: column;
    }

    .todo-top-nav .back-button,
    .todo-top-nav .todo-nav-button {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
    }

    .motivation-card {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .motivation-quote {
        font-size: 0.95rem;
    }

    .btn-small {
        width: 100%;
    }

    .todo-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .archive-btn {
        width: 100%;
    }

    .todo-input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .todo-input {
        width: 100%;
        min-width: 100%;
        font-size: 16px;
    }

    .todo-input-row .btn {
        width: 100%;
    }

    .todo-summary {
        flex-direction: column;
        gap: 10px;
    }

    .todo-list {
        min-height: 300px;
        max-height: 500px;
    }

    .todo-item {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 10px;
        padding: 14px;
    }

    .todo-checkbox {
        grid-row: 1;
        grid-column: 1;
        margin-top: 2px;
    }

    .todo-main {
        grid-row: 1;
        grid-column: 2;
    }

    .todo-actions {
        grid-row: 2;
        grid-column: 1 / -1;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .todo-actions .btn-small {
        flex: 1;
        min-width: 120px;
    }

    .back-button {
        width: 100%;
        text-align: center;
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
        padding-top: 15px;
    }


    .container {
        padding: 15px 12px;
        border-radius: 6px;
    }

    .menu-container {
        padding: 15px 12px;
    }

    .menu-header h1 {
        font-size: 1.8rem;
    }

    .menu-subtitle {
        font-size: 1rem;
    }

    .menu-cards {
        gap: 15px;
    }

    .menu-card {
        padding: 18px;
    }

    .menu-card h2 {
        font-size: 1.5rem;
    }

    .todo-container {
        padding: 15px 12px;
    }

    .posting-container {
        padding: 15px 12px;
    }

    .fibonacci-container {
        padding: 15px 12px;
    }

    .sudoku-container {
        padding: 15px 12px;
    }

    h1 {
        font-size: 1.7rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .motivation-card {
        padding: 12px;
    }

    .motivation-quote {
        font-size: 0.9rem;
    }

    .todo-list {
        min-height: 250px;
        max-height: 400px;
    }

    .todo-item {
        padding: 12px;
    }

    .todo-text {
        font-size: 0.95rem;
    }

    .btn {
        padding: 11px 18px;
        font-size: 0.95rem;
    }

    .game-settings {
        padding: 12px;
    }

    .game-board {
        padding: 8px;
        gap: 6px;
    }

    .cell {
        font-size: 1.3rem;
    }

    .sudoku-board {
        padding: 5px;
    }
}

.posting-container {
    max-width: 980px;
    box-sizing: border-box;
}

.posting-top-nav {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 10px;
}

.posting-composer {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 22px;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

.posting-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.posting-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.posting-text-input {
    width: 100%;
    max-width: 100%;
    min-height: 120px;
    border-radius: 10px;
    border: 2px solid var(--surface-light);
    background: var(--background);
    color: var(--text-primary);
    padding: 12px 14px;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    transition: var(--transition);
    font-family: inherit;
}

.posting-text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.posting-file-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.posting-file-input {
    width: 100%;
    max-width: 100%;
    border: 2px dashed var(--surface-light);
    border-radius: 10px;
    background: var(--background);
    color: var(--text-secondary);
    padding: 12px;
    font-size: 0.95rem;
}

.posting-file-input::file-selector-button {
    margin-right: 12px;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    background: var(--primary-color);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.posting-file-input::file-selector-button:hover {
    background: var(--primary-dark);
}

.posting-image-preview-wrap {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    border-radius: 0;
    overflow: hidden;
    border: none;
    border-top: 1px solid var(--surface-light);
    border-bottom: 1px solid var(--surface-light);
    background: var(--background);
    position: relative;
}

.posting-image-preview {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.posting-submit-btn {
    align-self: flex-start;
}

.posting-feed-section {
    margin-top: 10px;
}

.posting-feed-title {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.post-feed {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.post-card {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.post-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.post-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.post-text {
    color: var(--text-primary);
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.post-image-wrap {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    border-radius: 0;
    overflow: hidden;
    border: none;
    border-top: 1px solid var(--surface-light);
    border-bottom: 1px solid var(--surface-light);
    position: relative;
    background: var(--background);
}

.post-image {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.post-empty {
    background: var(--surface);
    border: 1px dashed var(--surface-light);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.hidden {
    display: none;
}

.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
    padding: 20px;
    touch-action: none;
}

.image-modal.show {
    display: flex;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    touch-action: none;
}

.image-modal-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #000;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    transition: var(--transition);
    padding: 0;
    z-index: 10001;
    pointer-events: auto;
    touch-action: auto;
    font-weight: bold;
}

.image-modal-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.image-modal-close:active {
    transform: scale(0.95);
}

.post-image,
.posting-image-preview {
    cursor: pointer;
    transition: var(--transition);
}

.post-image:hover,
.posting-image-preview:hover {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .image-modal {
        padding: 10px;
    }

    .image-modal-close {
        top: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
        font-size: 1.8rem;
    }
    
    .modal-image {
        max-height: 75vh;
    }

    .image-modal-content {
        max-width: 95vw;
        max-height: 80vh;
    }
}

/* Snake Game Styles */
.snake-container {
    max-width: 600px;
}

.snake-info {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    border-left: 4px solid var(--primary-color);
}

.snake-game-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--surface);
    border-radius: var(--border-radius);
    position: relative;
}

.mobile-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
    z-index: -1;
}

#snakeCanvas {
    border: 3px solid var(--surface-light);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: block;
    transition: all 0.3s ease;
}

#snakeCanvas.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    border: none;
    border-radius: 0;
    z-index: 99999;
    box-shadow: none;
}

.snake-game-container.fullscreen-active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    background: #0f172a;
    padding: 0;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
}

.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0f172a;
    z-index: 99998;
    display: none;
    overflow: hidden;
}

.fullscreen-overlay.active {
    display: block;
}

body.snake-fullscreen {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

html.snake-fullscreen {
    overflow: hidden !important;
}

.game-status {
    text-align: center;
    padding: 15px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 20px;
    min-height: 50px;
}

.snake-controls-help {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-top: 30px;
    text-align: center;
}

.snake-controls-help h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.control-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.control-section h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.numpad-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.numpad-row {
    display: flex;
    gap: 10px;
}

.numpad-key {
    width: 70px;
    height: 70px;
    background: var(--background);
    border: 2px solid var(--surface-light);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-secondary);
}

.numpad-key.active {
    background: var(--surface-light);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.numpad-key small {
    font-size: 0.7rem;
    font-weight: normal;
    margin-top: 5px;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

@media (max-width: 768px) {
    .snake-container {
        padding: 20px 15px;
    }

    .snake-game-container {
        padding: 10px;
    }

    #snakeCanvas {
        max-width: 100%;
        height: auto;
        cursor: pointer;
    }

    .numpad-key {
        width: 60px;
        height: 60px;
        font-size: 1.3rem;
    }

    .snake-controls-help {
        padding: 15px;
    }

    .controls-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .snake-container {
        padding: 15px 12px;
    }

    .numpad-key {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .numpad-key small {
        font-size: 0.6rem;
    }
}

@media (max-width: 768px) {
    .posting-container {
        padding: 20px 15px;
    }

    .posting-top-nav {
        margin-bottom: 15px;
    }

    .posting-top-nav .back-button {
        width: 100%;
        text-align: center;
    }

    .posting-composer {
        padding: 16px;
    }

    .posting-form {
        gap: 14px;
    }

    .posting-submit-btn {
        width: 100%;
        align-self: stretch;
    }

    .posting-text-input {
        font-size: 16px;
        padding: 12px;
    }

    .posting-file-input {
        font-size: 14px;
        padding: 10px;
    }

    .posting-file-input::file-selector-button {
        padding: 8px 12px;
        font-size: 14px;
    }

    .posting-image-preview {
        max-height: 220px;
    }

    .post-image {
        max-height: 350px;
    }

    .post-card {
        padding: 16px;
    }

    .post-feed {
        gap: 16px;
    }
}

/* Additional 480px mobile styles already covered above */

/* Flappy Bird Styles */
.flappy-container {
    max-width: 760px;
}

.flappy-info {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 26px;
    border-left: 4px solid var(--primary-color);
}

.flappy-game-container {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--border-radius);
}

#flappyCanvas {
    width: 100%;
    max-width: 360px;
    height: auto;
    border: 3px solid var(--surface-light);
    border-radius: 10px;
    background: #0ea5e9;
    display: block;
    touch-action: manipulation;
    cursor: pointer;
}

.flappy-status {
    text-align: center;
    padding: 14px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 18px;
    color: var(--text-secondary);
    background: var(--surface);
}

@media (max-width: 768px) {
    .flappy-container {
        padding: 20px 15px;
    }

    .flappy-info {
        margin-bottom: 18px;
        padding: 16px;
    }

    .flappy-game-container {
        padding: 10px;
    }
}

/* Checkers Game Styles */
.checkers-container {
    max-width: 900px;
}

.checkers-info {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    border-left: 4px solid var(--primary-color);
}

.checkers-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.checkers-board {
    width: 92vw;
    max-width: 560px;
    height: 92vw;
    max-height: 560px;
    aspect-ratio: 1 / 1;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border: 8px solid var(--surface-light);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.checkers-square {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.checkers-square.light {
    background: #d6bc8c;
}

.checkers-square.dark {
    background: #7a5a39;
    cursor: pointer;
}

.checkers-square.dark:hover {
    filter: brightness(1.06);
}

.checkers-square.selected {
    box-shadow: inset 0 0 0 4px rgba(34, 197, 94, 0.85);
}

.checkers-square.move-option::after,
.checkers-square.capture-option::after {
    content: "";
    position: absolute;
    width: 28%;
    height: 28%;
    border-radius: 50%;
    pointer-events: none;
}

.checkers-square.move-option::after {
    background: rgba(34, 197, 94, 0.7);
}

.checkers-square.capture-option::after {
    background: rgba(251, 191, 36, 0.8);
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.35);
}

.checkers-piece {
    width: 72%;
    height: 72%;
    border-radius: 50%;
    position: relative;
    z-index: 2;
    box-shadow: inset 0 8px 12px rgba(255, 255, 255, 0.2), inset 0 -8px 12px rgba(0, 0, 0, 0.3), 0 4px 10px rgba(0, 0, 0, 0.4);
}

.checkers-piece.red {
    background: radial-gradient(circle at 30% 30%, #fca5a5, #b91c1c);
    border: 2px solid #7f1d1d;
}

.checkers-piece.black {
    background: radial-gradient(circle at 30% 30%, #94a3b8, #111827);
    border: 2px solid #020617;
}

.checkers-piece.king::after {
    content: "★";
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(12px, 1.8vw, 18px);
    color: #fde68a;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}

.checkers-piece.movable {
    box-shadow: inset 0 8px 12px rgba(255, 255, 255, 0.2), inset 0 -8px 12px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(34, 197, 94, 0.7), 0 4px 10px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
    .checkers-container {
        padding: 20px 15px;
    }

    .checkers-info {
        margin-bottom: 20px;
        padding: 16px;
    }

    .checkers-board {
        width: 94vw;
        max-width: 520px;
        height: 94vw;
        max-height: 520px;
    }
}

/* Signature Pad Styles */
.signature-container {
    max-width: 980px;
}

.signature-top-nav {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 10px;
}

.signature-info {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    border-left: 4px solid var(--primary-color);
}

.signature-pad-shell {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    padding: 16px;
}

.signature-canvas {
    width: 100%;
    height: clamp(220px, 35vw, 340px);
    border-radius: 10px;
    border: 2px dashed var(--surface-light);
    background: #ffffff;
    display: block;
    touch-action: none;
    cursor: crosshair;
}

.signature-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 18px;
}

@media (max-width: 768px) {
    .signature-container {
        padding: 20px 15px;
    }

    .signature-top-nav {
        margin-bottom: 15px;
    }

    .signature-top-nav .back-button {
        width: 100%;
        text-align: center;
    }

    .signature-controls {
        flex-direction: column;
    }

    .signature-controls .btn {
        width: 100%;
    }
}

/* Markdown Editor Styles */
.markdown-editor-container {
    max-width: 1200px;
}

.markdown-top-nav {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 10px;
}

.markdown-editor-info {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.markdown-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.markdown-panel {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.markdown-panel-title {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.markdown-input,
.html-output {
    width: 100%;
    min-height: 340px;
    border-radius: 10px;
    border: 2px solid var(--surface-light);
    background: var(--background);
    color: var(--text-primary);
    padding: 12px 14px;
    font-size: 0.95rem;
    line-height: 1.6;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    resize: vertical;
    box-sizing: border-box;
}

.markdown-input:focus,
.html-output:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.html-output {
    color: #c7d2fe;
}

.markdown-preview-section {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    padding: 16px;
}

.markdown-preview {
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 10px;
    padding: 16px;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 180px;
    overflow-wrap: anywhere;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
    color: var(--text-primary);
    margin: 0.6em 0 0.4em;
}

.markdown-preview p {
    margin: 0.6em 0;
}

.markdown-preview a {
    color: #93c5fd;
}

.markdown-preview code {
    background: rgba(148, 163, 184, 0.2);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.9em;
}

.markdown-preview pre {
    background: #020617;
    color: #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    overflow-x: auto;
}

.markdown-preview pre code {
    background: transparent;
    padding: 0;
}

.markdown-preview blockquote {
    margin: 0.8em 0;
    padding: 0.35em 0.9em;
    border-left: 4px solid var(--primary-color);
    color: var(--text-secondary);
    background: rgba(99, 102, 241, 0.12);
}

.markdown-preview ul,
.markdown-preview ol {
    margin: 0.6em 0 0.6em 1.4em;
}

.markdown-preview hr {
    border: none;
    border-top: 1px solid var(--surface-light);
    margin: 1em 0;
}

/* Cursor API Chat Styles */
.cursor-api-container {
    max-width: 980px;
}

.cursor-api-top-nav {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 10px;
}

.cursor-api-info {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.cursor-api-panel {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    padding: 18px;
    margin-bottom: 18px;
}

.cursor-api-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.cursor-api-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cursor-api-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.cursor-api-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cursor-api-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.cursor-api-input,
.cursor-api-textarea {
    width: 100%;
    max-width: 100%;
    border-radius: 10px;
    border: 2px solid var(--surface-light);
    background: var(--background);
    color: var(--text-primary);
    padding: 12px 14px;
    font-size: 1rem;
    transition: var(--transition);
    box-sizing: border-box;
}

.cursor-api-input:focus,
.cursor-api-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.cursor-api-textarea {
    resize: vertical;
    min-height: 170px;
    line-height: 1.5;
    font-family: inherit;
}

.cursor-api-checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.cursor-api-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.cursor-api-submit-btn {
    align-self: flex-start;
}

.cursor-chat-panel {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    padding: 16px;
}

.cursor-chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.cursor-chat-thread {
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 10px;
    padding: 12px;
    min-height: 300px;
    max-height: 460px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.cursor-chat-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 30px 10px;
}

.cursor-chat-message {
    border-radius: 10px;
    padding: 10px 12px;
    max-width: min(92%, 760px);
}

.cursor-chat-message.user {
    align-self: flex-end;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.cursor-chat-message.assistant {
    align-self: flex-start;
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.32);
}

.cursor-chat-message-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.cursor-chat-message-text {
    color: var(--text-primary);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.cursor-chat-composer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cursor-chat-input {
    min-height: 120px;
}

@media (max-width: 900px) {
    .markdown-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .markdown-editor-container {
        padding: 20px 15px;
    }

    .markdown-top-nav {
        margin-bottom: 15px;
    }

    .markdown-top-nav .back-button {
        width: 100%;
        text-align: center;
    }

    .markdown-input,
    .html-output {
        min-height: 280px;
        font-size: 16px;
    }

    .cursor-api-container {
        padding: 20px 15px;
    }

    .cursor-api-actions-row .btn {
        width: 100%;
    }

    .cursor-api-grid {
        grid-template-columns: 1fr;
    }

    .cursor-api-submit-btn {
        width: 100%;
        align-self: stretch;
    }

    .cursor-api-checkbox-row {
        flex-direction: column;
        gap: 10px;
    }

    .cursor-chat-thread {
        min-height: 240px;
        max-height: 380px;
    }

    .cursor-chat-message {
        max-width: 100%;
    }
}
