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

:root {
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --secondary-color: #8b5cf6;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 로그인 화면 */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-screen.active {
    visibility: visible;
    opacity: 1;
}

.login-container {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    width: 90%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
}

.login-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--text-color);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-group input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.login-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0.9rem;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

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

.login-info {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

.login-info p {
    margin: 0.3rem 0;
    font-weight: 500;
}

.login-error {
    color: var(--danger-color);
    font-weight: 600;
    text-align: center;
    min-height: 1.5rem;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#mainApp {
    opacity: 0;
    transition: opacity 0.2s ease;
}

#mainApp.ready {
    opacity: 1;
}

/* 헤더 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1rem 1rem;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    flex: 1;
}

.logout-btn {
    background-color: transparent;
    color: white;
    border: none;
    padding: 0;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 포인트 표시 */
.points-display {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.points-icon {
    font-size: 1rem;
}

.points-value {
    font-size: 1rem;
    font-weight: 700;
}

.points-label {
    font-size: 0.85rem;
    font-weight: 600;
}

/* 탭 네비게이션 */
.tab-nav {
    display: flex;
    background-color: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: none;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

/* Modal (Tetris Top 10) */
.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; z-index: 2000; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(2px); }
.modal-content { position: relative; z-index: 2001; width: min(520px, 92vw); margin: 8vh auto; background: #111827; color: #fff; border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,0.45); border: 1px solid #1f2937; }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding: 14px 18px; border-bottom: 1px solid #1f2937; }
.modal-header h3 { margin:0; font-size:1.1rem; font-weight:700; }
.modal-close { background: transparent; border: none; color: #9ca3af; font-size: 22px; cursor: pointer; line-height:1; }
.modal-close:hover { color:#fff; }
.modal-body { padding: 10px 18px 18px; max-height: 60vh; overflow: auto; }
.modal-form-group { display:flex; flex-direction:column; gap:6px; margin-bottom:14px; }
.modal-form-group label { font-weight:600; color:#e5e7eb; font-size:0.85rem; letter-spacing:.2px; }
.modal-input { padding:0.7rem 0.75rem; border:2px solid #374151; border-radius:8px; font-size:0.95rem; background:#0b1220; color:#fff; font-family:inherit; transition:border-color .25s ease, background .25s ease; }
.modal-input:focus { outline:none; border-color: var(--primary-color); background:#111c2d; }
.modal-input::placeholder { color:#6b7280; }
.preset-amount-value { font-size:1.15rem; font-weight:700; color: var(--danger-color); padding:0.4rem 0.6rem; background:#0b1220; border:1px solid #1f2937; border-radius:8px; width:fit-content; }
.add-points-body, .subtract-points-body { padding-top:16px; }
.hidden { display:none !important; }

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 18px;
    border-top: 1px solid #1f2937;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 100px;
    padding: 0.6rem 1.2rem;
}

/* 타이머 종료 모달 */
/* 시간 확인 모달 */
.time-confirm-modal {
    max-width: 450px;
}

.time-confirm-modal .modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.time-confirm-modal .warning-text {
    text-align: center;
    color: #fbbf24;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.time-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.time-input-group input {
    width: 70px;
    padding: 0.5rem;
    border: 2px solid #374151;
    border-radius: 8px;
    font-size: 1rem;
    color: #fff;
    background-color: #0b1220;
    text-align: center;
    transition: border-color 0.3s ease;
}

.time-input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.stop-timer-modal {
    max-width: 450px;
}

.stop-timer-modal .modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.subject-selector-modal,
.memo-section-modal {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.subject-selector-modal label,
.memo-section-modal label {
    font-weight: 600;
    color: #e5e7eb;
    font-size: 0.95rem;
}

.subject-selector-modal select,
.memo-section-modal textarea {
    padding: 0.75rem;
    border: 2px solid #374151;
    border-radius: 8px;
    font-size: 1rem;
    color: #fff;
    background-color: #0b1220;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.subject-selector-modal select:focus,
.memo-section-modal textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.memo-section-modal textarea {
    resize: vertical;
    min-height: 100px;
}

/* 기록 수정 모달 */
.edit-record-modal {
    max-width: 500px;
}

.edit-record-modal .modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.edit-record-modal .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.edit-record-modal .form-group label {
    font-weight: 600;
    color: #e5e7eb;
    font-size: 0.95rem;
}

.edit-record-modal .form-select,
.edit-record-modal .form-input,
.edit-record-modal .form-textarea {
    padding: 0.75rem;
    border: 2px solid #374151;
    border-radius: 8px;
    font-size: 1rem;
    color: #fff;
    background-color: #0b1220;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.edit-record-modal .form-select:focus,
.edit-record-modal .form-input:focus,
.edit-record-modal .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.edit-record-modal .form-select:disabled {
    background-color: #1f2937;
    color: #9ca3af;
    cursor: not-allowed;
}

.edit-record-modal .form-textarea {
    resize: vertical;
}

.time-display-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.time-display {
    font-size: 1.1rem;
    font-weight: 600;
    color: #60a5fa;
    padding: 0.75rem;
    background-color: #0b1220;
    border: 2px solid #374151;
    border-radius: 8px;
    flex-shrink: 0;
}

.time-display-row .arrow {
    font-size: 1.5rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.time-display-row .form-input {
    flex: 1;
    min-width: 0;
}

.helper-text {
    font-size: 0.85rem;
    color: #fbbf24;
    margin-top: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.subject-display-modal {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.subject-display-modal label {
    font-weight: 600;
    color: #e5e7eb;
    font-size: 0.95rem;
}

.subject-label {
    padding: 0.75rem;
    border: 2px solid #374151;
    border-radius: 8px;
    font-size: 1rem;
    color: #fff;
    background-color: #0b1220;
    font-weight: 600;
}

/* 기록 추가 버튼과 헤더 */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-header h2 {
    margin: 0;
}

.add-manual-record-btn {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.add-manual-record-btn:hover {
    background-color: #5b51d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

/* 수동 기록 추가 모달 */
.manual-record-modal {
    max-width: 450px;
}

.manual-record-modal .modal-header {
    padding: 1rem 1.25rem;
}

.manual-record-modal .modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.manual-record-modal .modal-body {
    padding: 1rem 1.25rem;
}

.manual-record-modal .modal-footer {
    padding: 1rem 1.25rem;
}

.manual-record-modal .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
}

.manual-record-modal .form-group label {
    font-weight: 600;
    color: #e5e7eb;
    font-size: 0.85rem;
}

.manual-record-modal .form-select,
.manual-record-modal .form-input,
.manual-record-modal .form-textarea {
    padding: 0.5rem 0.65rem;
    border: 2px solid #374151;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #fff;
    background-color: #0b1220;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.manual-record-modal .form-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}

.manual-record-modal .form-group-inline {
    flex: 1;
    margin-bottom: 0;
}

.manual-record-modal .form-select:focus,
.manual-record-modal .form-input:focus,
.manual-record-modal .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.manual-record-modal .form-textarea {
    resize: vertical;
}

.datetime-inputs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.datetime-picker-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.form-input-date {
    flex: 1;
    padding: 0.5rem 0.65rem;
    border: 2px solid #374151;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #fff;
    background-color: #0b1220;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-input-date:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-select-time {
    padding: 0.5rem 0.5rem;
    border: 2px solid #374151;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #fff;
    background-color: #0b1220;
    font-family: inherit;
    transition: border-color 0.3s ease;
    min-width: 60px;
}

.form-select-time:focus {
    outline: none;
    border-color: var(--primary-color);
}

.time-separator {
    font-size: 1rem;
    font-weight: 700;
    color: #9ca3af;
}

.duration-display {
    margin-top: 0.4rem;
    padding: 0.4rem 0.6rem;
    background-color: #1f2937;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #60a5fa;
    text-align: center;
}

.form-input-small {
    flex: 1;
    min-width: 60px;
    padding: 0.75rem;
    border: 2px solid #374151;
    border-radius: 8px;
    font-size: 1rem;
    color: #fff;
    background-color: #0b1220;
    font-family: inherit;
    transition: border-color 0.3s ease;
    text-align: center;
}

.form-input-small:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-input-small::placeholder {
    color: #6b7280;
    font-size: 0.875rem;
}

/* 승인 모달 */
.approval-modal {
    max-width: 450px;
}

.approval-modal .modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.approval-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background-color: #0b1220;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid #374151;
}

.approval-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.approval-label {
    font-weight: 600;
    color: #9ca3af;
    font-size: 0.875rem;
    flex-shrink: 0;
    min-width: 60px;
}

.approval-value {
    font-weight: 500;
    color: #e5e7eb;
    font-size: 0.875rem;
    text-align: right;
    word-break: break-word;
}

.approval-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
}

.approval-footer .btn {
    flex: 1;
}

/* 승인 상태 표시 */
.approval-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.approval-status.pending {
    background-color: #fef3c7;
    color: #92400e;
}

.approval-status.approved {
    background-color: #d1fae5;
    color: #065f46;
}

.approval-status.rejected {
    background-color: #fee2e2;
    color: #991b1b;
}

/* 승인 대기 중 포인트 표시 (연하게) */
.record-points.pending {
    opacity: 0.5;
}

/* 거절된 포인트 표시 (취소선) */
.record-points.rejected {
    text-decoration: line-through;
    opacity: 0.6;
}

/* 승인 대기 섹션 (부모 모드) */
.pending-approval-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #fbbf24;
}

.pending-approval-section h3 {
    color: #f59e0b;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.points-item.pending-approval {
    background-color: #fef3c7;
    border: 2px solid #fbbf24;
}

.points-item-type.pending {
    background-color: #fbbf24;
    color: #78350f;
}

.points-item-amount.pending {
    color: #f59e0b;
    opacity: 0.7;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-success {
    background-color: #10b981;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.leaderboard-list { display: grid; gap: 10px; }
.leaderboard-item { display:flex; justify-content: space-between; align-items:center; padding: 12px 14px; border-radius: 10px; background: #0b1220; border: 1px solid #1f2937; transition: background .2s ease; }
.leaderboard-item:hover { background:#142033; }
.leaderboard-left { display:flex; gap:12px; align-items:center; }
.rank-badge { width: 26px; height:26px; display:flex; align-items:center; justify-content:center; border-radius:999px; background:#374151; color:#fff; font-weight:700; font-size:12px; }
.leaderboard-name { font-weight:600; color:#e5e7eb; }
.leaderboard-score { font-weight:700; color:#60a5fa; text-align:right; }
.leaderboard-date { color:#9ca3af; font-size:11px; text-align:right; margin-top:2px; }

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
    color: var(--primary-color);
}

/* 탭 콘텐츠 */
.tab-content {
    display: none;
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

/* 사용자 선택 버튼 */
.user-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.user-btn {
    flex: 1;
    min-width: 70px;
    padding: 0.6rem 0.8rem;
    border: 2px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.user-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 부모 포인트 탭: 자녀 포인트 뱃지 */
.child-btn { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; padding:0.75rem 0.85rem; border:2px solid var(--border-color); background:var(--card-bg); color:var(--text-light); font-size:0.9rem; font-weight:600; border-radius:12px; cursor:pointer; transition:all .2s ease; min-width:90px; }
.child-btn.active { background: var(--primary-color); color:#fff; border-color: var(--primary-color); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }
.child-btn:hover { border-color: var(--primary-color); color: var(--primary-color); transform: translateY(-2px); }
.child-btn.active .child-points-badge { background:#fff; color: var(--primary-color); border-color: #fff; }
.child-name-label { line-height:1; font-size: 0.95rem; }
.child-points-badge { display:inline-block; padding:5px 12px; font-size:1.05rem; font-weight:700; background:#0b1220; color:#10b981; border:1px solid #1f2937; border-radius:999px; letter-spacing:.3px; }

/* 타이머 섹션 */
.timer-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 버튼 그룹 */
.button-group {
    display: flex;
    gap: 1rem;
}

.play-pause-btn {
    flex: 2;
    font-size: 1.4rem;
    padding: 1rem;
}

.stop-btn {
    flex: 1;
    font-size: 1.4rem;
    padding: 1rem;
}

.reset-btn {
    flex: 0.8;
    font-size: 1.3rem;
    padding: 1rem;
}

.timer-display {
    padding: 3rem 1.5rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    transition: background 0.5s ease;
}

/* 타이머 실행 중 애니메이션 */
.timer-display.running {
    background: linear-gradient(
        -45deg,
        var(--primary-color) 0%,
        var(--primary-light) 25%,
        var(--secondary-color) 50%,
        var(--primary-light) 75%,
        var(--primary-color) 100%
    );
    background-size: 300% 300%;
    animation: timerFlow 3s ease infinite;
}

/* 배경 색상 흐르는 애니메이션 */
@keyframes timerFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.timer-display .time {
    font-size: 4rem;
    font-weight: 700;
    color: white;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1em;
}

/* 과목 선택 */
/* 입력 필드 표시/숨김 */
#input-fields {
    transition: all 0.3s ease;
    max-height: 500px;
    opacity: 1;
}

#input-fields.input-fields-hidden {
    display: none;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.subject-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.subject-selector label {
    font-weight: 600;
    color: var(--text-color);
}

.subject-selector select {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-color);
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.subject-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 버튼 그룹 */
.button-group {
    display: flex;
    gap: 0.75rem;
}

.btn {
    flex: 1;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--text-light);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    width: 100%;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 메모 섹션 */
.memo-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.memo-section label {
    font-weight: 600;
    color: var(--text-color);
}

.memo-section textarea {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    color: var(--text-color);
    transition: border-color 0.3s ease;
}

.memo-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 기록 섹션 */
.history-section h2,
.stats-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background-color: white;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 500;
    transition: all 0.3s ease;
    color: var(--text-color);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-btn:hover {
    border-color: var(--primary-color);
}

/* 기록 리스트 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
    margin-bottom: 0.75rem;
}

.history-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-item-row-2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.history-item-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.history-item-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.history-item-subject {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.history-item-duration {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
}

.history-item-points {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--success-color);
}

.history-item-memo {
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 0.5rem 0;
    display: block;
    width: 100%;
}

.history-item-date {
    color: var(--text-light);
    font-size: 0.75rem;
}

.history-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* 날짜 구분선 */
.date-separator {
    text-align: center;
    margin: 1.5rem 0 1rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.date-separator::before {
    margin-right: 1rem;
}

.date-separator::after {
    margin-left: 1rem;
}

.date-divider {
    height: 1.5rem;
}

/* 통계 섹션 */
.period-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.period-btn {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    background-color: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    color: var(--text-color);
}

.period-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.period-btn:hover {
    border-color: var(--primary-color);
}

/* 날짜 네비게이션 */
.date-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.nav-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background-color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    transition: all 0.2s ease;
    min-width: 48px;
}

.nav-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.nav-btn:active {
    transform: scale(0.95);
}

.period-display {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    min-width: 200px;
    text-align: center;
}

/* 통계 카드 */
.stats-cards {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    padding: 1rem 0.75rem;
    border-radius: 15px;
    text-align: center;
    color: white;
    box-shadow: var(--shadow-lg);
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-bottom: 0.4rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* 차트 섹션 */
.chart-section {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.chart-section h3 {
    margin-bottom: 1rem;
    text-align: center;
}

.chart-section canvas {
    max-height: 300px;
}

/* 통계 비교 섹션 */
.stats-comparison {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.total-hours-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    min-width: 100px;
    padding-right: 2rem;
    border-right: 2px solid var(--border-color);
}

.total-hours-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.total-hours-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.comparison-stats {
    display: flex;
    gap: 2rem;
    flex: 1;
    justify-content: space-around;
}

.comparison-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    align-items: center;
}

.comparison-label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    text-align: center;
}

.comparison-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.comparison-value.positive {
    color: #10b981;
}

.comparison-value.negative {
    color: #ef4444;
}

.comparison-value.equal {
    color: #6b7280;
}

/* 과목별 통계 */
.subject-stats {
    margin-top: 2rem;
}

.subject-stats h3 {
    margin-bottom: 1rem;
}

.subject-list {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 새로운 가로 바 스타일 */
.subject-bar-row {
    display: grid;
    grid-template-columns: 100px 1fr 80px;
    align-items: center;
    gap: 1rem;
}

.subject-bar-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.subject-bar-container {
    width: 100%;
    height: 24px;
    background-color: var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.subject-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 12px;
    transition: width 0.3s ease;
    min-width: 2%;
}

.subject-bar-time {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
    text-align: right;
}

/* 기존 스타일 (사용하지 않지만 호환성 유지) */
.subject-item {
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subject-item-name {
    font-weight: 600;
    color: var(--text-color);
}

.subject-item-hours {
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-weight: 600;
}

.subject-item-bar {
    width: 100%;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.subject-item-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* 반응형 디자인 */
@media (max-width: 600px) {
    .container {
        max-width: 100%;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .timer-display .time {
        font-size: 3rem;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    /* 모바일 통계 비교 섹션 */
    .stats-comparison {
        flex-direction: column;
        gap: 1rem;
    }

    .total-hours-section {
        padding-right: 0;
        border-right: none;
        border-bottom: 2px solid var(--border-color);
        padding-bottom: 1rem;
    }

    .comparison-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .comparison-item {
        min-width: 0;
    }
}

/* 애니메이션 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-item {
    animation: slideIn 0.3s ease;
}

.edit-btn {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.edit-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.delete-btn {
    background: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.delete-btn:hover {
    background: var(--danger-color);
    color: #fff;
}

/* 쉬어가기 섹션 */
.break-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.break-menu {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.break-menu-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--border-color);
    background-color: white;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
    transition: all 0.3s ease;
    color: var(--text-color);
    font-size: 0.95rem;
}

.break-menu-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.break-menu-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.break-menu-btn.active:hover {
    color: white;
}

.break-content {
    display: none;
}

.break-content.active {
    display: block;
    animation: slideIn 0.3s ease;
}

/* 토막상식 카드 */
.fact-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    border-radius: 20px;
    color: white;
    box-shadow: var(--shadow-lg);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.fact-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.fact-description {
    font-size: 1rem;
    line-height: 1.7;
    opacity: 0.95;
    flex: 1;
    display: flex;
    align-items: center;
}

@media (max-width: 600px) {
    .fact-card {
        min-height: auto;
        padding: 1.5rem;
    }

    .fact-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .fact-description {
        font-size: 0.95rem;
    }
}

/* O/X 퀴즈 카드 */
.ox-quiz-card {
    background: linear-gradient(135deg, #6b7280 0%, #374151 100%);
    padding: 2rem;
    border-radius: 20px;
    color: white;
    box-shadow: var(--shadow-lg);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.quiz-question {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    line-height: 1.6;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.quiz-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.quiz-buttons .btn-success {
    background-color: #10b981;
    border-color: #10b981;
    flex: 1;
    min-width: 80px;
}

.quiz-buttons .btn-success:hover:not(:disabled) {
    background-color: #059669;
}

.quiz-buttons .btn-danger {
    background-color: #ef4444;
    border-color: #ef4444;
    flex: 1;
    min-width: 80px;
}

.quiz-buttons .btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

.quiz-buttons .btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.quiz-feedback {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-line;
}

.quiz-score {
    color: white;
    font-size: 1rem;
}

@media (max-width: 600px) {
    .ox-quiz-card {
        min-height: auto;
        padding: 1.5rem;
    }

    .quiz-question {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
        min-height: 60px;
    }

    .quiz-feedback {
        font-size: 0.9rem;
        padding: 1rem;
    }
}

/* 테트리스 게임 */
.tetris-layout {
    display: grid;
    grid-template-columns: 70% 30%; /* enforce 7:3 percentage */
    gap: 20px;
    align-items: start;
    width: 100%;
}

.tetris-game-area { /* left board cell */
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

.tetris-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.tetris-next-block {
    text-align: center;
}

.next-block-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.8rem;
}

.next-block-canvas {
    border: 2px solid var(--border-color);
    background-color: #f5f5f5;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
    max-width: 100%;
}

.tetris-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.tetris-canvas {
    border: 3px solid var(--primary-color);
    background-color: #1a1a1a;
    border-radius: 12px;
    width: 100%;
    max-width: 380px; /* slightly larger board */
    aspect-ratio: 10 / 20; /* width:height ratio consistent */
    box-shadow: var(--shadow-lg);
}

/* Tetris overlay (right column) */
.tetris-overlay {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 140px; /* slightly slimmer */
    margin: 0 auto;
    height: 100%; /* allow children to stretch and bottom-align items */
}

.tetris-overlay-next {
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid #1f2937;
    border-radius: 12px;
    padding: 8px 8px 10px;
    backdrop-filter: blur(2px);
}
.tetris-overlay-next .next-block-canvas {
    width: 80px !important;
    height: 80px !important;
    display: block;
    margin: 0 auto;
}

.tetris-overlay-next .next-block-label {
    color: #9ca3af;
    font-size: 11px;
    margin-bottom: 4px;
    text-align: right;
}

.tetris-overlay-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1; /* fill remaining space so ranking can sit at bottom */
}

/* Ranking button inline under stats, bottom-aligned */
.tetris-ranking-inline {
    margin-top: auto; /* push to bottom within stats column */
    display: flex;
    justify-content: flex-end;
}
.tetris-ranking-inline .tetris-ranking-btn {
    padding: 6px 12px;
    font-size: 14px;
}

.tetris-overlay-stats .stat-item {
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid #1f2937;
    border-radius: 12px;
    padding: 10px 12px 8px 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.tetris-overlay-stats .stat-label {
    color: #9ca3af;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .5px;
}

.tetris-overlay-stats .stat-value {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.4rem;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Controls under the grid */
.tetris-control-area {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.tetris-start-btn {
    width: min(420px, 90%);
}

.tetris-ranking-container {
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

.tetris-ranking-btn {
    min-width: 100px;
}

/* Make 최고 점수 clickable affordance */
#tetrisbest {
    cursor: pointer;
}
#tetrisbest:hover {
    color: #60a5fa;
}

.tetris-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.control-text {
    font-size: 0.9rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.5;
    margin: 0;
}

.tetris-game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    color: white;
    z-index: 1000;
}

.tetris-game-over h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* 테트리스 터치 컨트롤 */
.tetris-touch-controls {
    width: 100%;
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
}

/* 왼쪽 그룹: 좌우 이동 버튼 (좌우로 배치) */
.button-group-left {
    display: flex;
    gap: 0.5rem;
    flex-direction: row;
    align-items: center;
}

/* 오른쪽 그룹: 회전, 아래 버튼 (상하로 배치) */
.button-group-right {
    display: flex;
    gap: 0.5rem;
    flex-direction: column;
    align-items: center;
}

.control-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.touch-btn {
    padding: 1.3rem 1.6rem;
    border: 2px solid var(--primary-color);
    background-color: white;
    color: var(--primary-color);
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    flex: 1;
    max-width: 120px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.touch-btn:active {
    background-color: var(--primary-color);
    color: white;
    transform: scale(0.95);
}

/* 좌/우 버튼: 100x100px 정사각형 */
.touch-btn.touch-left,
.touch-btn.touch-right {
    width: 100px !important;
    height: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    min-height: 100px !important;
    max-height: 100px !important;
    padding: 0 !important;
    flex: 0 !important;
}

/* 회전/내리기 버튼: 100x67px (높이 2/3) */
.touch-btn.touch-rotate,
.touch-btn.touch-down {
    width: 100px !important;
    height: 67px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    min-height: 67px !important;
    max-height: 67px !important;
    padding: 0 !important;
    flex: 0 !important;
}

@media (max-width: 600px) {
    .tetris-layout {
        display: grid;
        grid-template-columns: 70% 30%;
        gap: 12px;
    }
    .tetris-game-area {
        width: 100%;
        display: block; /* allow canvas to fill first grid column */
    }
    .tetris-canvas {
        max-width: 100%;
        aspect-ratio: 10 / 20;
    }
    .tetris-overlay {
        flex-direction: column;
        gap: 10px;
        max-width: 130px;
        margin: 0 auto;
    }

    .tetris-control-area {
        grid-column: 1 / -1;
        gap: 10px;
    }
    .tetris-start-btn {
        width: 100%;
        max-width: 420px;
    }

    .tetris-sidebar {
        width: 100%;
        flex: none;
        gap: 1rem;
        align-items: center;
    }

    .tetris-next-block {
        text-align: center;
        width: 100%;
        order: 1;
    }

    .next-block-canvas {
        width: 80px;
        height: 80px;
        max-width: 80px;
    }

    .next-block-label {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }

    .tetris-stats {
        flex-direction: row;
        gap: 1rem;
        padding: 0;
        background-color: transparent;
        justify-content: center;
        width: 100%;
        order: 3;
    }

    .stat-item {
        gap: 0.2rem;
        flex: 1;
        min-width: 80px;
        text-align: center;
    }

    .stat-label {
        font-size: 0.65rem;
        color: var(--text-light);
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .tetris-touch-controls {
        gap: 0.3rem;
        width: 100%;
        order: 2;
    }

    .control-row {
        gap: 0.2rem;
    }

    .touch-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
        max-width: 70px;
    }

    .touch-down {
        flex: 3;
        max-width: none;
    }

    #tetrisStartBtn {
        width: 100%;
        order: 4;
    }
}

/* 현재 공부 중인 과목 표시 */
.current-subject-display {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: 12px;
    border: 2px solid rgba(99, 102, 241, 0.2);
}

#currentSubjectText {
    display: block;
    font-size: 1.3rem;
    white-space: nowrap;
}

.current-subject-display.hidden {
    display: none;
}

/* 학원 시작 시간 표시 */
.academy-start-time {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.85;
}

.academy-start-time.hidden {
    display: none;
}

/* 쉬는 시간 표시 */
.break-time {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.75;
    color: #f59e0b;
}

.break-time.hidden {
    display: none;
}

/* 시작 모달 - 공부 방법 선택 */
.study-method-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.study-method-selector label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-weight: 600;
}

.study-method-selector input[type="radio"] {
    display: none;
}

.study-method-selector span {
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

/* 학원 버튼 - 오렌지 */
.study-method-selector label:has(#methodAcademy) {
    background: rgba(251, 146, 60, 0.15);
    border-color: rgba(251, 146, 60, 0.3);
    color: #ea580c;
}

.study-method-selector label:has(#methodAcademy):hover {
    background: rgba(251, 146, 60, 0.25);
    border-color: rgba(251, 146, 60, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 146, 60, 0.2);
}

.study-method-selector label:has(#methodAcademy:checked) {
    background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
    border-color: #ea580c;
    color: white;
    box-shadow: 0 6px 16px rgba(251, 146, 60, 0.4);
}

/* 독서 버튼 - 초록 */
.study-method-selector label:has(#methodReading) {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #16a34a;
}

.study-method-selector label:has(#methodReading):hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.study-method-selector label:has(#methodReading:checked) {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: #16a34a;
    color: white;
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
}

/* 공부 버튼 - 파랑 */
.study-method-selector label:has(#methodStudy) {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #4f46e5;
}

.study-method-selector label:has(#methodStudy):hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.study-method-selector label:has(#methodStudy:checked) {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-color: #4f46e5;
    color: white;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

/* 과목 드롭다운 래퍼 */
.subject-dropdown-wrapper {
    margin-top: 1rem;
}

.subject-dropdown-wrapper label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.subject-dropdown-wrapper select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--card-bg);
    transition: border-color 0.2s ease;
}

.subject-dropdown-wrapper select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.subject-dropdown-wrapper.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* 종료 모달 - 과목 레이블 표시 */
.subject-display-modal {
    margin-bottom: 1.5rem;
}

.subject-display-modal label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #9ca3af;
    font-size: 0.9rem;
}

.subject-label {
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* 부모 모드 스타일 */
.parent-section {
    padding: 0;
}

.parent-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

/* 아이 선택 탭 */
.child-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.child-btn {
    flex: 1;
    min-width: 70px;
    padding: 0.6rem 0.8rem;
    border: 2px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.child-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.child-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 부모 모드: 포인트 관리 */
.parent-points-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.parent-points-header h2 {
    margin: 0;
}

.parent-points-actions {
    display: flex;
    gap: 0.5rem;
}

.parent-points-actions .btn {
    min-width: 48px;
    height: 48px;
    font-size: 1.5rem;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 포인트 거래 목록 */
.points-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.points-item {
    background-color: var(--card-bg);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.points-item.earn {
    border-left-color: var(--success-color);
}

.points-item.spend {
    border-left-color: var(--danger-color);
}

/* 삭제된 포인트 항목 스타일 */
.points-item.deleted {
    opacity: 0.6;
    background-color: #f3f4f6;
}

.points-item.deleted .points-item-type,
.points-item.deleted .points-item-amount,
.points-item.deleted .points-item-reason {
    text-decoration: line-through;
}

.points-deleted-label {
    color: var(--text-light);
    font-size: 0.75rem;
    font-style: italic;
}

/* 2줄 레이아웃 */
.points-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.points-item-row-2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.points-item-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.points-item-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.points-item-type {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.points-item-type.earn {
    background-color: var(--success-color);
    color: white;
}

.points-item-type.spend {
    background-color: var(--danger-color);
    color: white;
}

.points-item-reason {
    color: var(--text-color);
    font-size: 0.9rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.points-item-duration {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
}

.points-item-amount {
    font-size: 1.1rem;
    font-weight: 700;
}

.points-item-amount.earn {
    color: var(--success-color);
}

.points-item-amount.spend {
    color: var(--danger-color);
}

.points-item-memo {
    color: var(--text-light);
    font-size: 0.85rem;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.points-item-date {
    color: var(--text-light);
    font-size: 0.75rem;
}

.points-item-creator {
    color: var(--text-light);
    font-size: 0.75rem;
}

.points-delete-btn {
    background: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.points-delete-btn:hover {
    background: var(--danger-color);
    color: #fff;
}

.points-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* 포인트 모달 */
/* 간편입력 버튼 */
.quick-reason-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-reason-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-reason-btn:hover {
    border-color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.05);
    color: var(--primary-color);
}

.quick-reason-btn:active {
    transform: scale(0.98);
}

.preset-reasons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.preset-reason-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-reason-item:hover {
    border-color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.05);
}

.preset-reason-item input[type="radio"] {
    margin-right: 0.75rem;
    cursor: pointer;
}

.preset-reason-item input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--primary-color);
}

/* 포인트 추가 모달 - 녹색 계열 */
#addPointsModal .modal-content {
    border: 2px solid #059669;
    box-shadow: 0 12px 32px rgba(5, 150, 105, 0.3);
}

#addPointsModal .modal-header {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-bottom: 1px solid #047857;
}

#addPointsModal .modal-header h3 {
    color: #fff;
}

#addPointsModal .modal-close {
    color: rgba(255, 255, 255, 0.8);
}

#addPointsModal .modal-close:hover {
    color: #fff;
}

/* 포인트 사용 모달 - 빨간색 계열 */
#subtractPointsModal .modal-content {
    border: 2px solid #dc2626;
    box-shadow: 0 12px 32px rgba(220, 38, 38, 0.3);
}

#subtractPointsModal .modal-header {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    border-bottom: 1px solid #b91c1c;
}

#subtractPointsModal .modal-header h3 {
    color: #fff;
}

#subtractPointsModal .modal-close {
    color: rgba(255, 255, 255, 0.8);
}

#subtractPointsModal .modal-close:hover {
    color: #fff;
}

/* 포인트 입력 필드 스타일 */
.points-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.points-input-icon {
    font-size: 1.5rem;
    font-weight: bold;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
}

.plus-icon {
    background: #059669;
    color: #fff;
}

.minus-icon {
    background: #dc2626;
    color: #fff;
}

.points-input-small {
    width: 100px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
}

/* 뱃지 시스템 스타일 */
.stats-header-with-badges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.stats-header-with-badges h2 {
    margin: 0;
}

.badges-display {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.badge-item:hover {
    opacity: 0.8;
}

.badge-item.badge-grayscale {
    opacity: 0.4;
}

.badge-item.badge-grayscale .badge-icon {
    filter: grayscale(100%);
}

.badge-item.badge-grayscale:hover {
    opacity: 0.6;
}

.badge-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
}

.badge-item:hover .badge-icon {
    transform: scale(1.1);
}

.badge-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.2);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}

.badge-count-zero {
    color: #6b7280;
    background: rgba(107, 114, 128, 0.2);
}

/* 뱃지 획득 모달 */
.badge-earned-modal {
    max-width: 400px;
    text-align: center;
}

.badge-earned-content {
    padding: 1rem;
}

.badge-celebration {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: celebration 0.6s ease-in-out;
}

@keyframes celebration {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-10deg); }
    75% { transform: scale(1.2) rotate(10deg); }
}

.badge-earned-modal h2 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    color: #fbbf24;
}

.earned-badge-display {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.earned-badge-icon {
    font-size: 5rem;
    animation: badgePop 0.5s ease-out;
}

@keyframes badgePop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.earned-badge-message {
    font-size: 1.1rem;
    color: #e5e7eb;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* 뱃지 상세 정보 모달 */
.badge-detail-modal {
    max-width: 450px;
}

.badge-detail-icon {
    font-size: 5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.badge-detail-name {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: #fbbf24;
    margin-bottom: 0.5rem;
}

.badge-detail-description {
    font-size: 1rem;
    text-align: center;
    color: #d1d5db;
    margin-bottom: 1.5rem;
}

.badge-detail-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.badge-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.badge-stat-label {
    font-size: 0.95rem;
    color: #9ca3af;
}

.badge-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fbbf24;
}
