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

body {
    display: flex;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background: #0f172a;
    color: #f9fafb;
}

/* Sidebar */

.sidebar {
    width: 240px;
    min-height: 100vh;
    background: #020617;
    color: white;
    padding: 24px 16px;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: width 0.25s ease;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.logo,
.logo-text {
    font-size: 22px;
    font-weight: 800;
    white-space: nowrap;
}

.sidebar-toggle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: #1e293b;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
}

.sidebar-toggle:hover {
    background: #334155;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 14px;
    margin-bottom: 8px;
    border-radius: 10px;
    transition: 0.2s;
}

.sidebar a:hover {
    background: #1e293b;
    color: white;
}

.sidebar a span {
    white-space: nowrap;
}

.sidebar.collapsed {
    width: 78px;
    padding: 24px 12px;
}

.sidebar.collapsed .logo-text {
    display: none;
}

.sidebar.collapsed .sidebar-top {
    justify-content: center;
}

.sidebar.collapsed a {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed a span {
    display: none;
}

/* Layout */

.content {
    flex: 1;
    padding: 40px;
    overflow-x: auto;
}

.page-title {
    font-size: 34px;
    margin-bottom: 10px;
    color: #ffffff;
}

.page-desc {
    color: #94a3b8;
    margin-bottom: 24px;
}

.card,
.panel-card {
    background: #111827;
    border-radius: 20px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.25);
}

.card + .card {
    margin-top: 18px;
}

.muted,
.empty-text {
    color: #94a3b8;
    font-size: 14px;
}

/* Forms */

.form-row,
.filter-form,
.search-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filter-form {
    margin-bottom: 20px;
}

.input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #334155;
    border-radius: 12px;
    font-size: 15px;
    background: #020617;
    color: #f9fafb;
}

.input::placeholder {
    color: #64748b;
}

.select-input {
    max-width: 180px;
}

.input:focus {
    outline: none;
    border-color: #6366f1;
}

.btn,
button {
    display: inline-block;
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    background: #6366f1;
    color: white;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover,
button:hover {
    background: #4f46e5;
}

/* Dashboard */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.primary-action {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 12px 18px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.35);
}

.metric-grid,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.metric-card,
.stat-card {
    border-radius: 22px;
    padding: 24px;
    min-height: 140px;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.25);
}

.metric-card::after,
.stat-card::after {
    content: "";
    position: absolute;
    width: 130px;
    height: 130px;
    right: -42px;
    bottom: -48px;
    background: rgba(255, 255, 255, 0.13);
    border-radius: 50%;
}

.metric-label,
.stat-card h3 {
    display: block;
    font-size: 15px;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 14px;
}

.metric-card strong,
.stat-number {
    display: block;
    font-size: 42px;
    line-height: 1;
    font-weight: 800;
    color: white;
    margin-bottom: 12px;
}

.metric-card small {
    color: rgba(255, 255, 255, 0.75);
}

.gradient-blue,
.stat-card:nth-child(1) {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
}

.gradient-purple,
.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #7c3aed, #ec4899);
}

.gradient-green,
.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #059669, #22c55e);
}

.gradient-orange,
.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #ea580c, #f59e0b);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.panel-header h2,
.card h2 {
    font-size: 22px;
    color: #f9fafb;
}

.panel-header span {
    color: #94a3b8;
    font-size: 13px;
}

.word-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.word-row:last-child {
    border-bottom: none;
}

.word-row strong {
    font-size: 18px;
    color: #ffffff;
}

.word-row p {
    color: #94a3b8;
    margin-top: 6px;
    line-height: 1.4;
}

.badge {
    height: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.18);
    color: #c7d2fe;
    font-size: 12px;
    font-weight: 700;
}

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

/* Table */

.word-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.word-table th {
    background: #020617;
    color: #cbd5e1;
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #334155;
    white-space: nowrap;
}

.word-table td {
    padding: 12px;
    border-bottom: 1px solid #1f2937;
    vertical-align: top;
    color: #e5e7eb;
}

.word-table tr:hover {
    background: #1e293b;
}

.empty-row {
    text-align: center;
    color: #94a3b8;
    padding: 30px;
}

.list-info {
    margin-bottom: 12px;
    color: #94a3b8;
    font-size: 14px;
}

.pagination {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-number {
    color: #cbd5e1;
    font-weight: bold;
}

.word-main {
    font-weight: bold;
}

.sentence-cell {
    max-width: 360px;
    line-height: 1.5;
}

.usage-note-cell {
    max-width: 320px;
    white-space: pre-line;
    line-height: 1.5;
}

/* Search Result */

.search-box-card {
    margin-bottom: 22px;
}

.word-hero-card {
    padding: 34px;
    margin-top: 22px;
    background: linear-gradient(180deg, #111827, #0f172a);
}

.word-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 16px;
}

.word-hero-title {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 10px;
    letter-spacing: -0.03em;
}

.word-pronunciation {
    color: #a5b4fc;
    font-size: 22px;
    font-weight: 800;
}

.word-hero-meaning {
    margin-top: 26px;
    font-size: 34px;
    font-weight: 900;
    color: #ffffff;
}

.word-hero-sentence {
    margin-top: 22px;
    font-size: 20px;
    color: #cbd5e1;
    line-height: 1.7;
}

.detail-card {
    margin-top: 22px;
}

.detail-title {
    font-size: 24px;
    margin-bottom: 22px;
    color: #ffffff;
}

.pos-card-list {
    display: grid;
    gap: 16px;
}

.pos-card {
    background: #020617;
    border: 1px solid #334155;
    border-radius: 18px;
    padding: 22px;
}

.pos-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.pos-badge {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
    font-weight: 900;
    font-size: 14px;
}

.pos-korean {
    color: #cbd5e1;
    font-weight: 700;
    font-size: 16px;
}

.clean-list {
    margin-left: 20px;
}

.clean-list li {
    color: #e5e7eb;
    line-height: 1.75;
    margin-bottom: 8px;
    font-size: 17px;
}

.tag-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

.tag-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.word-tag {
    display: inline-block;
    padding: 9px 13px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.18);
    color: #bfdbfe;
    font-size: 15px;
    font-weight: 800;
}

.danger-tag {
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca;
}

.example-card-list {
    display: grid;
    gap: 12px;
}

.example-card {
    background: #020617;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 16px 18px;
    color: #e5e7eb;
    line-height: 1.7;
    font-size: 17px;
}

.usage-note-clean {
    white-space: pre-line;
    background: #020617;
    border-left: 4px solid #6366f1;
    border-radius: 14px;
    padding: 20px;
    color: #e5e7eb;
    line-height: 1.85;
    font-size: 16px;
}

.etymology-text {
    color: #e5e7eb;
    line-height: 1.75;
    font-size: 17px;
}

/* Settings */

.settings-form {
    display: grid;
    gap: 20px;
    max-width: 760px;
}

.setting-section h2 {
    margin-bottom: 18px;
}

.setting-label {
    display: block;
    margin: 14px 0 8px;
    color: #cbd5e1;
    font-weight: 700;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    color: #e5e7eb;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
}

/* Quiz */

.quiz-question {
    font-size: 22px;
    line-height: 1.7;
    margin: 20px 0;
    font-weight: bold;
}

.quiz-hint-box {
    display: flex;
    gap: 14px;
    margin: 20px 0;
}

.quiz-hint-item {
    flex: 1;
    background: #020617;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 16px;
}

.quiz-hint-item span {
    display: block;
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 8px;
}

.quiz-hint-item strong {
    color: #f9fafb;
    font-size: 18px;
}

/* Charts */

.chart-card {
    margin-bottom: 20px;
}

.chart-card canvas {
    max-height: 320px;
}

/* Mobile */

@media (max-width: 1000px) {
    .metric-grid,
    .stats-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 900px) {
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }

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

    .word-hero-title {
        font-size: 36px;
    }

    .word-hero-meaning {
        font-size: 28px;
    }
}


.sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 18px;
}



/* Loading Page */

.loading-card {
    max-width: 720px;
}

.loading-box {
    margin-top: 24px;
    background: #020617;
    border: 1px solid #334155;
    border-radius: 18px;
    padding: 28px;
    text-align: center;
}

.spinner {
    width: 52px;
    height: 52px;
    border: 5px solid #334155;
    border-top-color: #6366f1;
    border-radius: 50%;
    margin: 0 auto 22px;
    animation: spin 0.9s linear infinite;
}

.loading-box p {
    line-height: 1.7;
    margin-bottom: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


.loading-wrapper {
    min-height: 70vh;

    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-card {
    width: 100%;
    max-width: 1100px;
}

.loading-card {
    width: 100%;
    max-width: 900px;
}


/* Writing Challenge */

.wc-page {
    max-width: 1180px;
}

.wc-card {
    margin-top: 22px;
}

.wc-header,
.wc-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.wc-eyebrow {
    font-size: 12px;
    letter-spacing: 0.12em;
    color: #818cf8;
    font-weight: 800;
    margin-bottom: 8px;
}

.wc-title {
    font-size: 26px;
    line-height: 1.35;
    color: #f9fafb;
}

.wc-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.wc-mini-box,
.wc-usage-box,
.wc-review-box,
.wc-text-box,
.wc-feedback-item {
    background: #020617;
    border: 1px solid #1e293b;
    border-radius: 16px;
    padding: 18px;
}

.wc-mini-label {
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 10px;
    font-weight: 700;
}

.wc-word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wc-badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.wc-instruction {
    color: #cbd5e1;
    margin: 18px 0;
    line-height: 1.7;
}

.wc-form textarea {
    width: 100%;
    min-height: 260px;
    background: #020617;
    color: #f8fafc;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 18px;
    font-size: 16px;
    line-height: 1.7;
    resize: vertical;
}

.wc-form textarea:focus {
    outline: none;
    border-color: #6366f1;
}

.wc-submit-btn {
    margin-top: 16px;
}

.wc-score-box {
    width: 112px;
    height: 112px;
    border-radius: 26px;
    background: linear-gradient(135deg, #4f46e5, #8b5cf6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wc-score-number {
    font-size: 38px;
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
}

.wc-score-label {
    color: #e0e7ff;
    font-size: 13px;
    margin-top: 6px;
}

.wc-score-small {
    font-size: 26px;
    font-weight: 900;
    color: #f9fafb;
}

.wc-review-box {
    color: #e2e8f0;
    margin-bottom: 20px;
    line-height: 1.7;
    border-left: 4px solid #6366f1;
}

.wc-section-title {
    margin: 26px 0 14px;
    font-size: 20px;
    color: #f9fafb;
}

.wc-usage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.wc-usage-box h4 {
    margin-bottom: 12px;
}

.wc-success {
    border-color: rgba(34, 197, 94, 0.45);
}

.wc-danger {
    border-color: rgba(239, 68, 68, 0.45);
}

.wc-text-box {
    white-space: pre-wrap;
    line-height: 1.75;
    color: #e2e8f0;
}

.wc-feedback-list {
    display: grid;
    gap: 14px;
}

.wc-feedback-type {
    color: #818cf8;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 8px;
}

.wc-wrong {
    color: #fca5a5;
    font-weight: 800;
}

.wc-right {
    color: #86efac;
    font-weight: 800;
}

@media (max-width: 900px) {
    .wc-grid,
    .wc-usage-grid {
        grid-template-columns: 1fr;
    }

    .wc-header,
    .wc-result-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.wc-writing-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
    padding: 0 4px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 700;
    flex-wrap: wrap;
}

.wc-count-low {
    color: #94a3b8;
}

.wc-count-good {
    color: #22c55e;
}

.wc-count-over {
    color: #f97316;
}


[data-speak] {
    cursor: pointer;
}

[data-speak]:hover {
    color: #a5b4fc;
}

[data-speak] {
    cursor: pointer;
}

[data-speak]:hover {
    color: #a5b4fc;
}

.word-hero-title[data-speak],
.word-hero-sentence[data-speak],
.example-card[data-speak],
.word-main[data-speak],
.sentence-cell[data-speak] {
    transition: color 0.2s ease, transform 0.2s ease;
}

.word-hero-title[data-speak]:hover,
.word-hero-sentence[data-speak]:hover,
.example-card[data-speak]:hover,
.word-main[data-speak]:hover,
.sentence-cell[data-speak]:hover {
    color: #c7d2fe;
}

@media (max-width: 900px) {
    body {
        display: block !important;
    }

    .sidebar {
        width: 100% !important;
        min-height: auto !important;
        height: auto !important;
        padding: 14px 16px !important;
    }

    .sidebar-top {
        margin-bottom: 0 !important;
    }

    .logo-text {
        display: block !important;
        font-size: 24px !important;
    }

    .sidebar-toggle {
        width: 46px !important;
        height: 46px !important;
        font-size: 22px !important;
    }

    .sidebar > a,
    .sidebar-bottom {
        display: none !important;
    }

    .sidebar.open > a {
        display: flex !important;
        align-items: center;
        gap: 10px;
        font-size: 18px;
        padding: 13px 10px;
    }

    .sidebar.open .sidebar-bottom {
        display: block !important;
        margin-top: 12px;
    }

    .sidebar.open {
        padding-bottom: 18px !important;
    }

    .sidebar.open .sidebar-top {
        margin-bottom: 14px !important;
    }

    .content {
        width: 100% !important;
        padding: 20px 16px !important;
        overflow-x: hidden;
    }
}


.reading-highlight {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.16);
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.reading-highlight:hover {
    background: rgba(59, 130, 246, 0.28);
}