:root {
    --color-primary: #FF6B9D;
    --color-secondary: #C44569;
    --color-accent: #FFD93D;
    --color-success: #6BCF7F;
    --color-dark: #1A1A2E;
    --color-light: #F8F9FA;
    --color-gray: #E9ECEF;
    --color-text: #2D2D3A;
    --color-white: #FFFFFF;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.24);
    
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Background Decoration */
.background-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-kanji {
    position: absolute;
    font-family: 'Shippori Mincho', serif;
    font-size: 120px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.05);
    animation: float 20s infinite ease-in-out;
}

.floating-kanji:nth-child(1) {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.floating-kanji:nth-child(2) {
    top: 60%;
    right: 15%;
    animation-delay: 5s;
}

.floating-kanji:nth-child(3) {
    bottom: 20%;
    left: 20%;
    animation-delay: 10s;
}

.floating-kanji:nth-child(4) {
    top: 30%;
    right: 25%;
    animation-delay: 15s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.05;
    }
    50% {
        transform: translateY(-30px) rotate(5deg);
        opacity: 0.08;
    }
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    animation: fadeIn 0.6s ease-out;
}

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

/* Hero Header */
.hero-header {
    text-align: center;
    margin-bottom: 48px;
    animation: slideDown 0.8s ease-out;
}

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

.hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 8px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-white);
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: pulse 2s infinite ease-in-out;
}

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

.hero-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.title-main {
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(3rem, 8vw, 5rem);
    color: var(--color-white);
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    letter-spacing: -2px;
    line-height: 1;
}

.title-sub {
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(2rem, 6vw, 3.5rem);
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    line-height: 1;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* Control Panel */
.control-panel {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-xl);
    margin-bottom: 40px;
    animation: scaleIn 0.8s ease-out 0.2s both;
}

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

.panel-section {
    margin-bottom: 40px;
}

.panel-section:last-of-type {
    margin-bottom: 0;
}

.section-header {
    margin-bottom: 24px;
}

.section-title {
    font-family: 'Archivo Black', sans-serif;
    font-size: 1.5rem;
    color: var(--color-dark);
    letter-spacing: -0.5px;
}

/* Lesson Selector */
.lesson-selector {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.select-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    background: linear-gradient(135deg, var(--color-success) 0%, #5AB76C 100%);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    align-self: flex-start;
}

.select-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.select-all-btn .btn-icon {
    font-size: 1.25rem;
}

.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.lesson-chip {
    position: relative;
    cursor: pointer;
}

.lesson-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.lesson-chip-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 16px;
    background: var(--color-gray);
    border-radius: var(--radius-md);
    border: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.lesson-chip input:checked + .lesson-chip-content {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-color: var(--color-primary);
    color: var(--color-white);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.lesson-chip:hover .lesson-chip-content {
    transform: translateY(-4px);
    box-shadow: var(--shadow-sm);
}

.lesson-number {
    font-family: 'Archivo Black', sans-serif;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.lesson-name {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.setting-card {
    background: var(--color-light);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--color-gray);
}

.setting-label {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-dark);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.875rem;
}

.setting-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.option-chip {
    cursor: pointer;
}

.option-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--color-white);
    border: 2px solid var(--color-gray);
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.option-chip input:checked + .chip-content {
    background: var(--color-dark);
    border-color: var(--color-dark);
    color: var(--color-white);
    transform: scale(1.05);
}

.option-chip:hover .chip-content {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.chip-icon {
    font-size: 1.25rem;
    line-height: 1;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px solid var(--color-gray);
}

.action-btn {
    position: relative;
    padding: 20px 48px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn-primary {
    box-shadow: 0 8px 32px rgba(255, 107, 157, 0.4);
}

.action-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 48px rgba(255, 107, 157, 0.6);
}

.action-btn:active {
    transform: translateY(-2px);
}

.btn-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.btn-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-white);
    font-weight: 700;
    font-size: 1.125rem;
}

.btn-icon {
    font-size: 1.5rem;
    animation: bounce 2s infinite;
}

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

.action-secondary {
    display: flex;
    gap: 12px;
}

.action-btn-small {
    padding: 14px 24px;
    background: var(--color-light);
    border: 2px solid var(--color-gray);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--color-dark);
}

.action-btn-small:hover {
    background: var(--color-dark);
    border-color: var(--color-dark);
    color: var(--color-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Vocab Display */
.vocab-display {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

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

.lesson-section {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.6s ease-out both;
}

.lesson-section:nth-child(n) {
    animation-delay: calc(0.1s * var(--index, 1));
}

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

.lesson-header {
    font-family: 'Archivo Black', sans-serif;
    font-size: 1.5rem;
    color: var(--color-white);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    letter-spacing: -0.5px;
    box-shadow: var(--shadow-md);
}

.vocab-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.vocab-table thead {
    background: var(--color-dark);
    color: var(--color-white);
}

.vocab-table th {
    padding: 14px 18px;
    text-align: left;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vocab-table th:first-child {
    border-top-left-radius: var(--radius-md);
}

.vocab-table th:last-child {
    border-top-right-radius: var(--radius-md);
}

.vocab-table td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--color-gray);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.vocab-table tbody tr {
    transition: all 0.3s ease;
}

.vocab-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(255, 107, 157, 0.05) 0%, rgba(255, 217, 61, 0.05) 100%);
    transform: scale(1.01);
}

.vocab-table tbody tr:last-child td {
    border-bottom: none;
}

.vocab-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius-md);
}

.vocab-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius-md);
}

/* Hidden columns */
.vocab-table .hide-english,
.vocab-table .hide-kanji,
.vocab-table .hide-furigana {
    color: transparent;
    user-select: none;
    background: var(--color-gray);
    position: relative;
}

/* Interactive mode */
.vocab-table.interactive .hide-english,
.vocab-table.interactive .hide-kanji,
.vocab-table.interactive .hide-furigana {
    cursor: pointer;
    background: linear-gradient(135deg, var(--color-gray) 0%, #DDE1E6 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.vocab-table.interactive .hide-english:hover,
.vocab-table.interactive .hide-kanji:hover,
.vocab-table.interactive .hide-furigana:hover {
    background: linear-gradient(135deg, #C8CFD6 0%, #B8BFC6 100%);
    transform: scale(1.02);
}

.vocab-table.interactive .hide-english::before,
.vocab-table.interactive .hide-kanji::before,
.vocab-table.interactive .hide-furigana::before {
    content: '✨ Click to reveal';
    color: var(--color-text);
    opacity: 0.6;
    font-size: 0.9rem;
    font-weight: 500;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
}

.vocab-table.interactive .hide-english.revealed,
.vocab-table.interactive .hide-kanji.revealed,
.vocab-table.interactive .hide-furigana.revealed {
    color: var(--color-text);
    background: linear-gradient(135deg, rgba(107, 207, 127, 0.2) 0%, rgba(90, 183, 108, 0.2) 100%);
    animation: reveal 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes reveal {
    from {
        transform: scale(0.95);
        opacity: 0.5;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.vocab-table.interactive .hide-english.revealed::before,
.vocab-table.interactive .hide-kanji.revealed::before,
.vocab-table.interactive .hide-furigana.revealed::before {
    content: none;
}

/* Print styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .background-decoration,
    .control-panel {
        display: none !important;
    }

    .container {
        padding: 0;
        max-width: 100%;
    }

    .hero-header {
        margin-bottom: 10px;
    }

    .hero-badge,
    .hero-subtitle {
        display: none;
    }

    .title-main,
    .title-sub {
        font-size: 1.5rem;
        line-height: 1.2;
    }

    .lesson-section {
        box-shadow: none;
        page-break-inside: avoid;
        margin-bottom: 12px;
        padding: 0;
        border-radius: 0;
    }

    .lesson-header {
        font-size: 1rem;
        padding: 6px 12px;
        margin-bottom: 8px;
        border-radius: 4px;
        page-break-after: avoid;
    }

    .vocab-table {
        page-break-inside: auto;
        font-size: 0.75rem;
        margin-bottom: 0;
    }

    .vocab-table thead {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .vocab-table th {
        padding: 4px 8px;
        font-size: 0.7rem;
        border: 1px solid #ddd;
        page-break-after: avoid;
    }

    .vocab-table td {
        padding: 4px 8px;
        font-size: 0.75rem;
        border: 1px solid #ddd;
        line-height: 1.3;
    }

    .vocab-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    .vocab-table tbody tr:hover {
        background: transparent;
    }

    /* Make hidden cells visible but empty for print */
    .vocab-table .hide-english,
    .vocab-table .hide-kanji,
    .vocab-table .hide-furigana {
        background: white !important;
        color: transparent !important;
        min-height: 1em;
    }

    .vocab-table .hide-english::before,
    .vocab-table .hide-kanji::before,
    .vocab-table .hide-furigana::before {
        content: none !important;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    .control-panel {
        padding: 24px;
    }

    .lesson-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }

    .lesson-chip-content {
        padding: 16px 12px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .setting-options {
        flex-direction: column;
    }

    .chip-content {
        width: 100%;
        justify-content: center;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .action-btn {
        width: 100%;
    }

    .action-secondary {
        flex-direction: column;
        width: 100%;
    }

    .action-btn-small {
        width: 100%;
    }

    .lesson-section {
        padding: 24px;
    }

    .vocab-table {
        font-size: 0.9rem;
    }

    .vocab-table th,
    .vocab-table td {
        padding: 14px 16px;
    }
}
