:root {
    --bg-color: #f0f4f8;
    --board-bg: #ffffff;
    --primary-color: #3b82f6;
    --accent-yellow: #facc15;
    --accent-yellow-dark: #eab308;
    --text-color: #334155;
    --sub-text: #64748b;
    --danger-color: #ef4444;
    --font-stack: "M PLUS Rounded 1c", sans-serif;

    --shadow-soft: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-deep: 5px 5px 15px rgba(0, 0, 0, 0.1), -5px -5px 15px rgba(255, 255, 255, 0.8);
    --shadow-inset: inset 2px 2px 5px rgba(0, 0, 0, 0.05), inset -2px -2px 5px rgba(255, 255, 255, 0.8);

    --radius-timer: 24px;
    --radius-card: 20px;
    --radius-btn: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    /* Horizontally center */
    align-items: flex-start;
    /* Start from top */
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    overflow-y: auto;
    /* Allow vertical scroll */
}

/* Scaling Wrapper for Mobile */
.app-container {
    width: 1024px;
    /* Fixed Base Width */
    position: relative;
    margin: 40px auto;
    /* Top margin + Horizontal centering */
    box-sizing: border-box;
    flex-shrink: 0;

    /* Prepare for scaling */
    transform-origin: top center;
    /* JS will apply scale() if window < 1024 */
}

.board {
    background: var(--board-bg);
    width: 100%;
    height: 100%;
    border-radius: 40px;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.1),
        inset 0 0 0 8px #f8fafc;
    padding: 30px;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
    position: relative;
}

/* --- Left Panel --- */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

/* Timer Card */
.timer-card {
    background: #f1f5f9;
    border-radius: var(--radius-timer);
    padding: 20px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--shadow-inset);
    border: 1px solid #e2e8f0;
}

.timer-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 10px;
}

.timer-display {
    width: 200px;
    height: 200px;
    position: relative;
    margin: 10px 0;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-circle-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 8;
}

.timer-circle-fg {
    fill: none;
    stroke: #1e293b;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.timer-text {
    font-size: 24px;
    font-weight: 800;
    fill: #1e293b;
    transform: rotate(90deg);
    transform-origin: 50px 50px;
}

.timer-icon {
    font-size: 16px;
    transform: rotate(90deg);
    transform-origin: 50px 50px;
}

/* Time Up Overlay - New */
.time-up-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    /* Make it round to match the timer circle */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.time-up-message {
    font-size: 1.2rem;
    font-weight: 800;
    color: #f59e0b;
    margin-bottom: 15px;
    white-space: nowrap;
}

.time-up-actions {
    display: flex;
    gap: 10px;
}

.time-up-btn {
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.8rem;
    transition: transform 0.1s;
}

.time-up-btn:active {
    transform: scale(0.95);
}

.reset-c {
    background-color: #cbd5e1;
    color: #334155;
}

.extend-c {
    background-color: #facc15;
    color: #713f12;
}

.play-c {
    background-color: #3b82f6;
    color: white;
    padding: 8px 14px;
}

.time-up-extend-form {
    display: flex;
    align-items: center;
    gap: 5px;
}

.time-up-extend-form input {
    width: 50px;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    text-align: center;
    font-weight: bold;
}

.time-up-extend-form .unit {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: bold;
}


.timer-controls {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
    background: white;
}

.control-btn:active {
    transform: scale(0.95);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.control-btn.play {
    color: #10b981;
}

.control-btn.reset {
    color: #f59e0b;
}

/* Memo Card */
.memo-card {
    flex: 1;
    background: #fff;
    border-radius: var(--radius-card);
    border: 4px solid #f1f5f9;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.memo-header {
    margin-bottom: 10px;
}

.memo-title {
    display: block;
    font-weight: 800;
    color: #f59e0b;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.memo-subtitle {
    font-size: 0.8rem;
    color: var(--sub-text);
}

#memo-area {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    outline: none;
    color: #334155;
    font-size: 1.1rem;
    line-height: 1.6;
    background: transparent;
    font-family: var(--font-stack);
}

/* --- Right Panel --- */
.right-panel {
    background: #f8fafc;
    border-radius: var(--radius-card);
    padding: 20px;
    box-shadow: var(--shadow-inset);
    overflow-y: auto;
    border: 1px solid #e2e8f0;
}

.right-panel::-webkit-scrollbar {
    width: 8px;
}

.right-panel::-webkit-scrollbar-track {
    background: transparent;
}

.right-panel::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-item {
    display: flex;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.05);
}

/* Task Left: Number & Time */
.task-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 15px;
    min-width: 60px;
}

.task-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #94a3b8;
    -webkit-text-stroke: 1px #cbd5e1;
    color: transparent;
}

.task-time {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--sub-text);
    margin-top: 4px;
    white-space: nowrap;
}

/* Task Content: Icon & Input/Image */
.task-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 12px;
    margin-right: 15px;
}

.task-icon {
    font-size: 1.5rem;
}

.task-payload {
    flex: 1;
    width: 100%;
}

.task-input {
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-color);
    width: 100%;
    outline: none;
    font-family: var(--font-stack);
}

.task-image {
    max-height: 50px;
    width: auto;
    border-radius: 8px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    object-fit: contain;
    display: block;
}

/* Task Checker: Toggle Switch */
.task-check-area {
    width: 60px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-switch {
    display: block;
    width: 50px;
    height: 30px;
    background: #e2e8f0;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background 0.3s;
}

.task-checkbox {
    display: none;
}

.slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-knob {
    font-size: 14px;
    color: #cbd5e1;
    font-weight: bold;
    user-select: none;
}

/* Checked State */
.task-checkbox:checked+.slider {
    transform: translateX(20px);
    background: var(--accent-yellow);
}

.toggle-switch:has(.task-checkbox:checked) {
    background: #fde047;
}

.task-checkbox:checked+.slider .slider-knob {
    color: #b45309;
}

/* Button Styles */
.add-task-btn {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: white;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    color: #64748b;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.add-task-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #eff6ff;
}

.add-task-btn.small {
    padding: 8px;
    font-size: 0.9rem;
}

/* --- Settings Modal --- */
.settings-modal {
    border: none;
    border-radius: 24px;
    padding: 0;
    background: transparent;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.settings-modal::backdrop {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
}

.settings-container {
    background: #fff;
    width: 90vw;
    max-width: 600px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.settings-header {
    background: #f8fafc;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
}

.settings-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section h3 {
    margin-bottom: 15px;
    color: var(--text-color);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.input-group input[type="number"] {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    width: 80px;
    font-size: 1rem;
}

.settings-task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Setting Task Row - Updated */
.settings-task-row {
    background: #f1f5f9;
    padding: 10px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-row-top {
    display: flex;
    gap: 10px;
    align-items: center;
}

.settings-row-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.settings-task-row input[type="text"] {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-family: var(--font-stack);
}

.setting-time {
    width: 100px;
}

.setting-icon-select {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.setting-type-select {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: white;
    cursor: pointer;
}

.setting-text {
    width: 100%;
}

.setting-image-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-image-preview {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    border: 1px solid #cbd5e1;
    background-color: #e2e8f0;
}

.delete-btn {
    background: #fee2e2;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-left: auto;
}

.delete-btn:hover {
    background: #fecaca;
}

.settings-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    background: #f8fafc;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.primary-btn:hover {
    filter: brightness(1.1);
}

/* Media queries removed to enforce fixed layout scaling */