:root {
    --bg-dark: #0f1115;
    --bg-card: #1e222d;
    --bg-card-hover: #252a36;
    --text-main: #e0e0e0;
    --text-muted: #8b9bb4;
    --accent-primary: #4cd9c0;
    --accent-secondary: #4c9dd9;
    --neon-glow: 0 0 8px rgba(76, 217, 192, 0.3);
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.3);
    --border-radius: 12px;
    --nav-height: 60px;
    --header-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Icons */
.icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Header */
header {
    height: var(--header-height);
    background-color: rgba(15, 17, 21, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

header h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    box-shadow: var(--neon-glow);
}

/* Main Content Area */
main {
    flex: 1;
    margin-top: var(--header-height);
    margin-bottom: var(--nav-height);
    overflow-y: auto;
    position: relative;
}

.page {
    display: none;
    padding: 16px;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

/* Modular Cards */
.card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.02);
    transition: transform 0.2s, background-color 0.2s;
}

.card:active {
    transform: scale(0.98);
    background-color: var(--bg-card-hover);
}

/* News Page */
.banner-carousel {
    height: 180px;
    border-radius: var(--border-radius);
    background: linear-gradient(45deg, #1a2a3a, #2a3a4a);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-item {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
}

.banner-text {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 2;
}

.banner-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.category-tabs {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--bg-dark);
    background-color: var(--accent-primary);
    box-shadow: var(--neon-glow);
}

.news-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.news-item:last-child {
    border-bottom: none;
}

.news-thumb {
    width: 80px;
    height: 80px;
    background-color: #2a303c;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
}

.news-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.news-title {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.tag {
    color: var(--accent-secondary);
    background: rgba(76, 157, 217, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* AI Page */
.ai-input-container {
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 24px;
}

.ai-input-fake {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.ai-icon-glow {
    color: var(--accent-primary);
    filter: drop-shadow(0 0 5px rgba(76, 217, 192, 0.5));
}

.recommend-title {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

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

.recommend-tag {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.recommend-tag:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Review Page */
.review-stats {
    text-align: center;
    padding: 30px 0;
}

.chart-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 8px solid rgba(255, 255, 255, 0.05);
    border-top: 8px solid var(--accent-primary);
    border-right: 8px solid var(--accent-primary);
    margin: 0 auto 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(76, 217, 192, 0.1);
    transform: rotate(-45deg);
}

.chart-content {
    transform: rotate(45deg);
    text-align: center;
}

.score-num {
    font-size: 32px;
    font-weight: bold;
    color: var(--accent-primary);
    text-shadow: var(--neon-glow);
}

.score-label {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-primary {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    width: 100%;
    padding: 14px;
    border-radius: 24px;
    color: white;
    font-weight: bold;
    font-size: 16px;
    box-shadow: var(--neon-glow);
    cursor: pointer;
    margin-top: 20px;
}

/* Bottom Navigation */
nav.bottom-nav {
    height: var(--nav-height);
    background-color: rgba(15, 17, 21, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    gap: 4px;
    width: 60px;
    cursor: pointer;
    transition: color 0.3s;
}

.nav-item.active {
    color: var(--accent-primary);
}

.nav-item.active svg {
    filter: drop-shadow(0 0 5px rgba(76, 217, 192, 0.5));
}

/* Modals / Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    z-index: 200;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.overlay.open {
    transform: translateY(0);
}

.overlay-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-main);
    padding: 8px;
    margin-right: 8px;
    cursor: pointer;
}

.overlay-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* AI Chat UI */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 80px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.message.user {
    align-self: flex-end;
    background: var(--accent-secondary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.ai {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255,255,255,0.05);
}

.chat-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: var(--bg-dark);
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    gap: 10px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.chat-input {
    flex: 1;
    background: var(--bg-card);
    border: none;
    border-radius: 20px;
    padding: 10px 16px;
    color: white;
}

/* Quiz UI */
.quiz-container {
    padding: 20px;
}

.quiz-progress {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin-bottom: 24px;
    position: relative;
}

.quiz-progress-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s;
    box-shadow: var(--neon-glow);
}

.question-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
}

.option-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 15px;
    transition: all 0.2s;
}

.option-btn:active {
    background: var(--accent-primary);
    color: var(--bg-dark);
    border-color: var(--accent-primary);
}

/* Utility */
.hidden {
    display: none !important;
}
