:root {
    --bg-black: #050505;
    --surface-dark: #121212;
    --surface-gray: rgba(30, 30, 30, 0.6);
    --text-off-white: #e0e0e0;
    --text-muted: #888888;
    --accent-crimson: #8a1a1a;
    --accent-crimson-glow: rgba(138, 26, 26, 0.5);
    --glass-border: rgba(255, 255, 255, 0.05);
    
    --font-heading: 'Noto Serif JP', 'Cinzel', serif;
    --font-body: 'Nanum Myeongjo', serif;
    --font-handwritten: 'Reenie Beanie', cursive;
}

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

body {
    background-color: var(--bg-black);
    color: var(--text-off-white);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Film Grain */
.film-grain {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0.06;
    background: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
}

/* Rain & Dust */
#rainCanvas, #dustCanvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
}

#dustCanvas {
    z-index: 2;
    opacity: 0.5;
}

/* Background Art */
.background-art {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    transform: scale(1.05); /* Slight scale for parallax */
    transition: transform 0.1s ease-out;
}

.background-art img {
    width: 100%; height: 100%;
    object-fit: cover;
    filter: grayscale(100%) contrast(120%) brightness(40%);
}

.background-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(5,5,5,0.9) 0%, rgba(5,5,5,0.4) 50%, rgba(5,5,5,0.9) 100%);
}

/* Manga Panel Layout */
.manga-panel-container {
    position: relative;
    z-index: 10;
    display: flex;
    gap: 30px;
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    padding: 20px;
}

/* Vertical Text */
.vertical-text-accent {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    letter-spacing: 0.5rem;
    color: var(--text-muted);
    opacity: 0.7;
    margin-right: 20px;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
}

.glassmorphism {
    background: var(--surface-gray);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.panel {
    display: flex;
    flex-direction: column;
    padding: 40px;
}

/* Left Panel */
.side-panel {
    flex: 1;
    max-width: 350px;
    justify-content: space-between;
}

h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 2px;
    margin-bottom: 20px;
    text-transform: uppercase;
    color: var(--text-off-white);
    border-bottom: 1px solid var(--accent-crimson);
    padding-bottom: 10px;
    display: inline-block;
}

/* Tasks */
.task-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

input[type="text"] {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--text-muted);
    color: var(--text-off-white);
    font-family: var(--font-body);
    padding: 5px;
    outline: none;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: var(--accent-crimson);
}

#addTaskBtn {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-off-white);
    width: 30px;
    height: 30px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
}

#addTaskBtn:hover {
    background: var(--accent-crimson);
    border-color: var(--accent-crimson);
    box-shadow: 0 0 10px var(--accent-crimson-glow);
}

#taskList {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2); 
}
::-webkit-scrollbar-thumb {
    background: var(--accent-crimson); 
}

#taskList li {
    font-size: 0.9rem;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.3s;
}

#taskList li.completed {
    text-decoration: line-through;
    opacity: 0.5;
}

.stats {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Ink Divider */
.ink-divider {
    height: 2px;
    background: url('data:image/svg+xml;utf8,<svg preserveAspectRatio="none" viewBox="0 0 100 2" xmlns="http://www.w3.org/2000/svg"><path d="M0,1 C20,0 40,2 60,0.5 C80,-0.5 100,1 100,1" stroke="%238a1a1a" stroke-width="2" fill="none"/></svg>') no-repeat center;
    background-size: 100% 100%;
    margin: 20px 0;
    opacity: 0.7;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.minimal-select {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-off-white);
    padding: 5px 10px;
    font-family: var(--font-body);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 0;
}

.minimal-select option {
    background: var(--bg-black);
    color: var(--text-off-white);
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--text-off-white);
    color: var(--text-off-white);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: var(--text-off-white);
    color: var(--bg-black);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 2px;
    background: var(--text-muted);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    background: var(--accent-crimson);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px var(--accent-crimson-glow);
}

/* Center Panel - Timer */
.center-panel {
    flex: 2;
    align-items: center;
    justify-content: center;
    position: relative;
}

.app-header {
    position: absolute;
    top: 40px;
    text-align: center;
}

.app-header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    letter-spacing: 5px;
    font-weight: 200;
    text-transform: uppercase;
}

.app-header .subtitle {
    font-size: 0.9rem;
    color: var(--accent-crimson);
    letter-spacing: 3px;
    margin-top: 5px;
}

/* Timer Circle */
.timer-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
}

.progress-ring {
    position: absolute;
    top: 0; left: 0;
    transform: rotate(-90deg);
}

.progress-ring__circle {
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
    stroke-linecap: round;
    filter: drop-shadow(0 0 8px rgba(138, 26, 26, 0.4));
}

.timer-container.pulsing .progress-ring__circle {
    animation: pulse 2s infinite alternate;
}

@keyframes pulse {
    0% { filter: drop-shadow(0 0 4px rgba(138, 26, 26, 0.4)); }
    100% { filter: drop-shadow(0 0 15px rgba(138, 26, 26, 0.8)); }
}

.timer-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
}

#timeDisplay {
    font-family: var(--font-heading);
    font-size: 4.5rem;
    font-weight: 200;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(255,255,255,0.1);
}

.handwritten {
    font-family: var(--font-handwritten);
    font-size: 2rem;
    color: var(--text-muted);
    margin-top: -10px;
    transform: rotate(-5deg);
}

/* Timer Controls */
.timer-modes {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
}

.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.9rem;
    letter-spacing: 1px;
    cursor: pointer;
    padding: 5px 10px;
    position: relative;
    transition: color 0.3s;
}

.mode-btn::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    width: 0; height: 1px;
    background: var(--accent-crimson);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.mode-btn:hover, .mode-btn.active {
    color: var(--text-off-white);
}

.mode-btn.active::after {
    width: 100%;
}

.timer-controls {
    display: flex;
    gap: 20px;
}

.main-btn {
    background: transparent;
    border: 1px solid var(--text-off-white);
    color: var(--text-off-white);
    padding: 10px 30px;
    font-family: var(--font-heading);
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.4s ease;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.main-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--text-off-white);
    z-index: -1;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s ease;
}

.main-btn:hover {
    color: var(--bg-black);
}

.main-btn:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.main-btn.secondary {
    border-color: var(--text-muted);
    color: var(--text-muted);
}

.main-btn.secondary::before {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 900px) {
    .manga-panel-container {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
    }
    
    .vertical-text-accent {
        display: none;
    }

    .side-panel {
        max-width: 100%;
    }

    .app-header {
        position: relative;
        top: 0;
        margin-bottom: 30px;
    }
}

/* Settings Modal */
.modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content h2 {
    margin-bottom: 30px;
}

.time-settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-off-white);
}

.minimal-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--text-muted);
    color: var(--text-off-white);
    padding: 5px;
    width: 60px;
    text-align: center;
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.minimal-input:focus {
    border-color: var(--accent-crimson);
}

/* Hide number input spinners */
.minimal-input::-webkit-outer-spin-button,
.minimal-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.minimal-input[type=number] {
  -moz-appearance: textfield;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}
