.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.input-group label {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
}

.input-group input {
    padding: 12px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    color: #0f172a;
    background: white;
    transition: all 0.2s ease;
    outline: none;
    font-family: 'DM Sans', sans-serif;
}

.input-group input:focus {
    border-color: #94a3b8;
}

.input-group input::placeholder {
    color: #94a3b8;
}

.input-group input.error {
    border-color: #ef4444;
    background: #fef2f2;
}

.input-group input.error:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-hint {
    font-size: 12px;
    color: #94a3b8;
}

.input-hint.error {
    color: #dc2626;
    font-weight: 500;
}

.optional-tag {
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 4px;
}

.required-star {
    color: #ef4444;
    margin-left: 2px;
}

.tag-dropdown {
    display: none;
    position: absolute;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    width: 100%;
    margin-top: 4px;
}

.dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    color: #1e293b;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: #f1f5f9;
}

.dropdown-empty {
    padding: 10px 14px;
    color: #94a3b8;
    font-size: 14px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 13px;
    color: #1e293b;
    margin-top: 6px;
}

.tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.tag-remove:hover {
    color: #ef4444;
}

.school-search-container {
    position: relative;
}

.school-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 4px;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.school-search-result-item {
    padding: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.school-search-result-item:hover {
    background: #f1f5f9;
}

.create-btn {
    padding: 12px 24px;
    background: #0f172a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.create-btn:hover {
    background: #1e293b;
}

.plus-icon {
    font-size: 18px;
    font-weight: 700;
}

.back-btn {
    padding: 10px 20px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    margin-bottom: 24px;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #f8fafc;
}

.secondary-btn {
    padding: 8px 20px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: #f8fafc;
}

.page-subtitle {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 32px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.feature-card {
    background: white;
    padding: 32px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.feature-icon {
    font-size: 36px;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
}

.feature-count {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #0f172a;
}

.content-container > h2 {
    font-size: 24px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 32px;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.item-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.item-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

.item-count {
    font-size: 12px;
    color: #94a3b8;
    background: #f8fafc;
    padding: 4px 12px;
    border-radius: 12px;
}

.item-summary {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
    line-height: 1.5;
}

.study-btn {
    width: 100%;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.2s ease;
}

.study-btn:hover {
    background: #e2e8f0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 14px;
    color: #64748b;
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.stats-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.stats-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 20px;
}

.friends-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.friends-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.friends-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
}

.add-friend-btn {
    padding: 6px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-friend-btn:hover {
    background: #e2e8f0;
}

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.friend-item:hover {
    background: #e2e8f0;
}

.friend-avatar-container {
    flex-shrink: 0;
}

.friend-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.friend-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.friend-top-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.friend-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.friend-level {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
}

.friend-title {
    font-size: 12px;
    color: #64748b;
}

.friend-streak {
    font-size: 12px;
    font-weight: 500;
    color: #ea580c;
    white-space: nowrap;
}

.friend-score {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.avatar-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 8px;
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
}

.avatar-option {
    cursor: pointer;
    transition: transform 0.2s ease;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-option:hover {
    transform: scale(1.1);
}

.avatar-option.selected {
    border: 3px solid #0f172a;
    box-shadow: 0 0 0 2px white, 0 0 0 5px #0f172a;
}

.avatar-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: block;
    object-fit: cover;
}

.avatar-picker-scrollable {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.avatar-picker-scrollable::-webkit-scrollbar {
    width: 8px;
}

.avatar-picker-scrollable::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.avatar-picker-scrollable::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.avatar-picker-scrollable::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 15px;
    color: #64748b;
    margin-bottom: 8px;
}

.empty-state-hint {
    font-size: 13px;
    color: #94a3b8;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
    display: flex;
}

.modal-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
}

.modal-box {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUp 0.3s ease-out;
}

.modal-box-large {
    max-width: 600px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 20px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f8fafc;
    color: #64748b;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.modal-body .input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-body .input-group label {
    font-size: 14px;
    font-weight: 500;
    color: #475569;
}

.modal-body .input-group input {
    padding: 12px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    color: #0f172a;
    background: white;
    transition: all 0.2s ease;
    outline: none;
    font-family: 'DM Sans', sans-serif;
}

.modal-body .input-group input:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.1);
}

.modal-body .input-group input::placeholder {
    color: #cbd5e1;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px 24px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.modal-btn {
    flex: 1;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.cancel-btn {
    background: white;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.cancel-btn:hover {
    background: #f8fafc;
}

.create-btn-modal {
    background: #0f172a;
    color: white;
}

.create-btn-modal:hover {
    background: #1e293b;
}

.create-btn-modal:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.add-folder-card {
    background: rgba(128, 128, 128, 0.15);
    border: 2px dashed rgba(128, 128, 128, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-folder-card:hover {
    background: rgba(128, 128, 128, 0.25);
    border-color: rgba(128, 128, 128, 0.6);
    transform: translateY(-2px);
}

.add-folder-card .add-icon {
    font-size: 3rem;
    color: rgba(128, 128, 128, 0.6);
    font-weight: 300;
}

.add-folder-card h3 {
    color: rgba(0, 0, 0, 0.5);
}

.add-folder-card p {
    color: rgba(0, 0, 0, 0.4);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-row.is-me {
    background: var(--primary-light, #f0effe);
    border-radius: 8px;
    padding: 10px 8px;
}

.leaderboard-loading {
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-muted, #aaa);
    margin: 0;
}

.leaderboard-empty {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 0;
    font-size: 13px;
    color: var(--text-muted, #aaa);
}

.leaderboard-empty-icon {
    font-size: 22px;
}

.rank-number {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted, #aaa);
    text-align: center;
}

.rank-number.rank-1 { color: #f59e0b; }
.rank-number.rank-2 { color: #9ca3af; }
.rank-number.rank-3 { color: #b45309; }

.rank-medal {
    font-size: 16px;
    text-align: center;
}

.rank-user {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.rank-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--border-color, #e5e7eb);
}

.rank-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #222);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-score {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary, #639aff);
    white-space: nowrap;
}

.my-rank-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 4px;
    border-top: 1px solid var(--border-color, #f0f0f0);
    margin-top: 4px;
}

.my-rank-label {
    font-size: 12px;
    color: var(--text-secondary, #666);
}

.my-rank-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary, #63ceff);
}

.leaderboard-reset-note {
    font-size: 11px;
    color: var(--text-muted, #bbb);
    margin: 6px 0 0 0;
}

.leaderboard-load-more {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    background: var(--bg-2, #f8f8f8);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #666);
    cursor: pointer;
    transition: background 0.2s;
}

.leaderboard-load-more:hover {
    background: var(--border-color, #e5e7eb);
}

.rank-you-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: var(--primary, #6c63ff);
    background: var(--primary-light, #f0effe);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 4px;
    vertical-align: middle;
}

.friend-streak.streak-inactive {
    filter: grayscale(1);
    opacity: 0.5;
}