:root {
    /* 颜色系统 */
    --primary-color: #333;
    --secondary-color: #666;
    --text-color: #333;
    --text-light: #555;
    --text-muted: #999;
    --bg-color: #f9f5f0;
    --bg-card: #fff;
    --bg-warm: #f8f0e3;
    --bg-warm-hover: #f0e6d6;
    --border-color: #eee;
    --success-color: #2e7d32;
    --error-color: #c62828;
    --info-color: #1967d2;
    
    /* 阴影系统 */
    --shadow-sm: rgba(0, 0, 0, 0.05);
    --shadow-md: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.2);
    --overlay-bg: rgba(0, 0, 0, 0.5);
    --toast-bg: rgba(0, 0, 0, 0.8);
    
    /* 交互元素 */
    --toggle-bg: #ccc;
    --toggle-active: #333;
    
    /* 边框半径 */
    --border-radius-sm: 12px;
    --border-radius-md: 16px;
    --border-radius-lg: 20px;
    --border-radius-full: 50%;
    
    /* 动画过渡 */
    --transition-fast: 0.1s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* 间距系统 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 20px;
    --space-xl: 24px;
    
    /* 字体 */
    --font-family: 'Microsoft YaHei', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-focus-ring-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*::-webkit-scrollbar {
    display: none;
}

* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body {
    font-family: var(--font-family);
    background-color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.container {
    max-width: 480px;
    width: 100%;
    aspect-ratio: 9/16;
    background-color: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 30px var(--shadow-light);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
}

@media (min-width: 768px) {
    .container {
        max-width: 600px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 650px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 700px;
    }
}

.subsection-title {
    background-color: var(--bg-warm);
    padding: var(--space-md);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-fast);
}

.subsection-title:hover {
    background-color: var(--bg-warm-hover);
    padding-left: calc(var(--space-md) + 4px);
}

.toggle-icon {
    font-size: 12px;
    transition: transform var(--transition-normal);
}

.subsection-title.active .toggle-icon {
    transform: rotate(180deg);
}

.content-card > *:not(.entry-btn-header) {
    padding: var(--space-md);
    display: none;
    animation: slideDown var(--transition-normal);
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.content-card > .entry-btn-header:not(:first-child) {
    display: none;
}

.content-card.show > *:not(.entry-btn-header) {
    display: block;
}

.content-card.show > .entry-btn-header {
    display: block;
}

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

.sub-subsection {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.sub-subsection-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-top: var(--space-xs);
    margin-bottom: var(--space-xs);
    padding-left: var(--space-sm);
    border-left: 3px solid var(--primary-color);
}

.resource-item {
    background-color: #f9f9f9;
    border-radius: var(--border-radius-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    border: 1px solid #e0e0e0;
    transition: all var(--transition-fast);
}

.resource-item:hover {
    box-shadow: 0 2px 8px var(--shadow-sm);
    transform: translateY(-1px);
}

.item-header {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--space-sm);
    gap: var(--space-xs);
}

.item-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
}

.item-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: color var(--transition-fast);
    display: inline-block;
}

.item-title a:hover {
    color: #0066cc;
    text-decoration: underline;
    transform: translateY(-1px);
}

.item-tags {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.tag {
    background-color: #e8f0fe;
    color: #1967d2;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.tag:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px var(--shadow-sm);
}

.item-url {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    word-break: break-all;
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.item-desc {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
}

.item-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
}

.item-pros, .item-cons {
    font-size: 13px;
    line-height: 1.5;
}

.item-pros {
    color: var(--success-color);
}

.item-cons {
    color: var(--error-color);
}

.placeholder-text {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
    background-color: #f9f9f9;
    border-radius: var(--border-radius-md);
    margin: var(--space-md);
}

/* 内容网格布局 */
.content-grid {
    display: none;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.content-grid.show {
    display: flex;
}

/* 工具容器布局 */
.tools-container {
    display: none;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.tools-container.show {
    display: flex;
}

@media (min-width: 768px) {
    .content-grid {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .content-grid .content-card {
        flex: 1;
        margin: 0;
        margin-right: var(--space-md);
    }
    
    .content-grid .content-card:last-child {
        margin-right: 0;
    }
}

/* 按钮样式 */
.entry-btn-header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background-color: var(--bg-warm);
    border-radius: var(--border-radius-md);
}

.entry-btn-header:hover {
    background-color: var(--bg-warm-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-md);
}

.entry-btn-icon {
    font-size: 36px;
    margin-right: var(--space-md);
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.entry-btn-header:hover .entry-btn-icon {
    transform: scale(1.1);
}

.entry-btn-content {
    flex: 1;
}

.entry-btn-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
}

.entry-btn-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 4px;
}

.entry-btn-arrow {
    font-size: 20px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.entry-btn-header:hover .entry-btn-arrow {
    transform: translateX(4px);
}

/* 子按钮样式 */
.sub-button {
    transition: all var(--transition-fast);
}

.sub-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-md);
}

/* 学科容器样式 */
.subject-container {
    margin-bottom: var(--space-md);
}

/* 并列按钮容器样式 */
.sub-buttons-container {
    display: none;
    flex-direction: row;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.sub-buttons-container.show {
    display: flex;
}

.sub-buttons-container .content-card {
    flex: 1 1 calc(50% - 5px);
    min-width: 150px;
}

.page {
    display: none;
    flex-direction: column;
    height: 100%;
    gap: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    will-change: opacity, transform;
    visibility: hidden;
}

.page.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.page.slide-in {
    animation: slideIn 0.2s ease forwards;
}

.page.slide-out {
    animation: slideOut 0.2s ease forwards;
}

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

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

/* 首页进入动画 */
@keyframes homeSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.page.home-slide-in {
    animation: homeSlideIn 0.3s ease-out forwards;
}

/* 返回首页动画 */
@keyframes slideOutToHome {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

.page.slide-out-to-home {
    animation: slideOutToHome 0.3s ease-in forwards;
}

/* Toast动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeOutDown {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

.header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.back-btn {
    width: 40px;
    height: 40px;
    background-color: var(--bg-warm);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 20px;
    color: var(--text-color);
    border: none;
    text-decoration: none;
}

.back-btn:hover {
    background-color: var(--bg-warm-hover);
    transform: translateX(-2px);
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.content-area {
    flex: 1;
    border-radius: 16px;
    padding: 8px;
    overflow-y: auto;
    background-color: transparent;
}

.feedback-link {
    text-align: right;
    font-size: 12px;
    color: #666;
    flex: 1;
}

.feedback-link a {
    color: #666;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.feedback-link a:hover {
    color: #333;
}

.settings-link {
    text-align: left;
    font-size: 12px;
    color: #666;
    flex: 1;
}

.settings-link a {
    color: #666;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.settings-link a:hover {
    color: #333;
}

.footer-links {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.usage-link {
    text-align: center;
    font-size: 12px;
    color: #666;
    flex: 1;
}

.usage-link a {
    color: #666;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.usage-link a:hover {
    color: #333;
}

.settings-modal {
    max-width: 350px;
}

.settings-section {
    margin-top: 20px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

.settings-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #333;
}

.settings-icon {
    font-size: 20px;
}

.settings-desc {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #333;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #fff;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    position: relative;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
    border: 1px solid #e0e0e0;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background-color: #f5f5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #333;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background-color: #e0e0e0;
    color: #000;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 20px;
}

.modal-text {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    text-align: center;
}

.success-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #333;
    color: #fff;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 14px;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.success-toast.show {
    opacity: 1;
    visibility: visible;
}

/* 资源详情弹窗样式 */
.resource-modal {
    max-width: 95%;
    max-height: 90vh;
    width: 95%;
    height: auto;
    max-height: 90vh;
    overflow-y: auto;
}

.resource-modal .modal-content-body {
    padding: 20px 0;
    overflow-y: auto;
    max-height: 60vh;
}

.resource-modal .resource-item {
    margin-bottom: 20px;
}

.resource-modal .resource-item:last-child {
    margin-bottom: 0;
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }

    .container {
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        aspect-ratio: unset;
        border-radius: 0;
        padding: 16px 12px;
        gap: 20px;
    }

    .header {
        gap: 10px;
    }

    .back-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
        border-radius: 10px;
    }

    .page-title {
        font-size: 17px;
    }

    .title-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
        border-radius: 10px;
    }

    .content-area {
        padding: 8px;
        border-radius: 12px;
    }

    .feedback-link {
        font-size: 11px;
    }

    .modal-content {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .modal-title {
        font-size: 18px;
    }

    .modal-text {
        font-size: 13px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 600px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 650px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 700px;
    }
}

/* 内容网格布局 */
.content-grid {
    display: none;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.content-grid.show {
    display: flex;
}

/* 工具容器布局 */
.tools-container {
    display: none;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.tools-container.show {
    display: flex;
}

@media (min-width: 768px) {
    .content-grid {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .content-grid .content-card {
        flex: 1;
        margin: 0;
        margin-right: var(--space-md);
    }
    
    .content-grid .content-card:last-child {
        margin-right: 0;
    }
}

/* 按钮样式 */
.entry-btn-header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background-color: var(--bg-warm);
    border-radius: var(--border-radius-md);
}

.entry-btn-header:hover {
    background-color: var(--bg-warm-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-md);
}

.entry-btn-icon {
    font-size: 36px;
    margin-right: var(--space-md);
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.entry-btn-header:hover .entry-btn-icon {
    transform: scale(1.1);
}

.entry-btn-content {
    flex: 1;
}

.entry-btn-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
}

.entry-btn-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 4px;
}

.entry-btn-arrow {
    font-size: 20px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.entry-btn-header:hover .entry-btn-arrow {
    transform: translateX(4px);
}

/* 子按钮样式 */
.sub-button {
    transition: all var(--transition-fast);
}

.sub-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-md);
}

/* 学科容器样式 */
.subject-container {
    margin-bottom: var(--space-md);
}

/* 并列按钮容器样式 */
.sub-buttons-container {
    display: none;
    flex-direction: row;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.sub-buttons-container.show {
    display: flex;
}

.sub-buttons-container .content-card {
    flex: 1 1 calc(50% - 5px);
    min-width: 150px;
}
