:root {
    --bg-main: #0a0a0c;
    --bg-card: #18181c;
    --text-main: #e0e0e0;
    --text-muted: #8a8a8e;
    --accent: #ff4757;
    --accent-glow: rgba(255, 71, 87, 0.2);
    --green: #2ed573;
    --yellow: #ffa502;
    --red: #ff4757;
    --border: #2f3542;
    --tab-bg: #1e1e24;
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.screen {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 80px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

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

header {
    padding: 24px 20px 16px;
    background: var(--bg-main);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.week-info {
    font-size: 14px;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.content {
    padding: 20px;
}

.subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: normal;
}

.task-section {
    margin-bottom: 24px;
}

.task-section h2 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.task-list {
    list-style: none;
}

.task-item {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.task-item:active {
    transform: scale(0.98);
}

.task-item label {
    display: flex;
    align-items: center;
    width: 100%;
    cursor: pointer;
}

.task-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-muted);
    border-radius: 6px;
    margin-right: 16px;
    position: relative;
    transition: all 0.2s ease;
}

.task-item input[type="checkbox"]:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.task-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 7px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.task-item .task-title {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    word-break: break-word;
    transition: color 0.2s;
}

.task-item input[type="checkbox"]:checked ~ .task-title {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* Vision */
.vision-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

#vision-text {
    width: 100%;
    height: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 16px;
    border-radius: var(--radius);
    font-size: 16px;
    line-height: 1.5;
    resize: none;
}

#vision-text:focus {
    outline: 2px solid var(--accent);
}

.btn {
    padding: 16px;
    border-radius: var(--radius);
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    width: 100%;
}

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

.btn.danger {
    background: transparent;
    border: 1px solid var(--red);
    color: var(--red);
}

.btn.primary.outline {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
}

.mb-10 {
    margin-bottom: 10px;
}

/* Scorecard */
.flex-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 40px;
}

.scorecard-widget {
    position: relative;
    width: 200px;
    height: 200px;
}

.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 250px;
}

.circle-bg {
    fill: none;
    stroke: var(--bg-card);
    stroke-width: 3.8;
}

.circle {
    fill: none;
    stroke: var(--green);
    stroke-width: 2.8;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease-out, stroke 0.5s ease;
}

.percentage {
    fill: var(--text-main);
    font-family: sans-serif;
    font-size: 0.5em;
    font-weight: bold;
    text-anchor: middle;
}

.score-msg {
    text-align: center;
    margin-top: 20px;
    font-size: 18px;
    font-weight: 600;
}

.score-stats {
    margin-top: 30px;
    padding: 15px 30px;
    background: var(--bg-card);
    border-radius: 20px;
}

/* Настройки */
.card {
    background: var(--bg-main);
    border-radius: var(--radius);
    padding: 10px 0;
}

.card h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.input-group input, .add-task-form input, .add-task-form select {
    width: 100%;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus, .add-task-form input:focus {
    border-color: var(--accent);
}

.add-task-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.manage-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 10px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.manage-task-info {
    display: flex;
    flex-direction: column;
}

.manage-task-info .type-badge {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-btn-danger {
    color: var(--red);
}
.icon-btn-danger svg {
    width: 20px; height: 20px;
}

.archive-list {
    list-style: none;
}

.archive-list li {
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
.archive-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 8px;
}
.archive-stats {
    font-size: 14px;
    color: var(--text-muted);
}

/* Лидерборд */
.leaderboard-list {
    list-style: none;
}

.leaderboard-list li {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
}

.lb-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lb-avatar {
    width: 40px;
    height: 40px;
    background: var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--text-main);
}

.lb-name {
    font-weight: 600;
    font-size: 16px;
}

.lb-score {
    font-weight: 800;
    font-size: 18px;
}

.score-green { color: var(--green); }
.score-yellow { color: var(--yellow); }
.score-red { color: var(--red); }

/* TAB BAR */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: var(--tab-bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
}

.tab-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 20%;
    height: 100%;
    cursor: pointer;
    transition: color 0.2s;
}

.tab-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}

.tab-item span {
    font-size: 10px;
    font-weight: 600;
}

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

.separator {
    border: 0;
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

/* Toast */
#toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 1000;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    transition: opacity 0.3s, transform 0.3s;
}
#toast.hidden {
    opacity: 0;
    transform: translate(-50%, -20px);
    pointer-events: none;
}
.loading-spinner {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 14px;
}
