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

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.page-title {
    text-align: center;
    color: #fff;
    font-size: 3rem;
    text-shadow: 4px 4px 0px rgba(0,0,0,0.2);
    margin-bottom: 40px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding: 20px;
}

.tool-card {
    background: white;
    border-radius: 25px;
    padding: 40px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: 5px solid transparent;
}

.tool-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border-color: #ffd700;
}

.tool-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    display: block;
}

.tool-title {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 10px;
}

.tool-desc {
    color: #666;
    font-size: 1.1rem;
}

.monitor-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    position: relative;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 1000;
    opacity: 0;
    transition: all 0.5s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.monitor-container {
    background: white;
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 600px;
    width: 100%;
    position: relative;
}

.mode-tabs {
    display: flex;
    background: #f8f9ff;
    border-radius: 20px;
    padding: 5px;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 15px;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    color: #666;
}

.tab-btn.active {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.tab-btn:hover:not(.active) {
    background: rgba(102, 126, 234, 0.1);
}

.monitor-title {
    text-align: center;
    color: #ff3333;
    font-size: clamp(2rem, 6vw, 3rem);
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1);
    margin-bottom: 25px;
    animation: blinkTitle 1s ease-in-out infinite;
    width: 100%;
}

@keyframes blinkTitle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.avatar-container {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
}

.avatar {
    width: clamp(220px, 50vw, 400px);
    height: clamp(220px, 50vw, 400px);
    border-radius: 50%;
    object-fit: cover;
    border: 12px solid #ffd700;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.avatar.watching {
    animation: none;
}

@keyframes blink {
    0%, 45%, 55%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.1); }
}

@keyframes nod {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

@keyframes lookAround {
    0%, 100% { transform: rotate(-5deg) translateX(-5px); }
    25% { transform: rotate(0deg) translateX(0); }
    50% { transform: rotate(5deg) translateX(5px); }
    75% { transform: rotate(0deg) translateX(0); }
}

.watching-eyes {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.timer-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.timer-display {
    font-size: clamp(3rem, 15vw, 6rem);
    font-weight: bold;
    color: #333;
    margin: 25px 0;
    font-family: 'Courier New', monospace;
    background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    width: 100%;
    display: block;
    letter-spacing: 3px;
}

.edit-countdown-text-btn {
    margin: 5px auto 15px auto;
    display: block;
    padding: 5px 15px;
    border: 2px solid #667eea;
    border-radius: 15px;
    background: white;
    color: #667eea;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.edit-countdown-text-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.camera-toggle-btn {
    margin: 10px auto;
    display: block;
    padding: 8px 20px;
    border: 2px solid #f5576c;
    border-radius: 20px;
    background: white;
    color: #f5576c;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.camera-toggle-btn:hover {
    background: #f5576c;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

.camera-toggle-btn.active {
    background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-color: transparent;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: nowrap;
    margin-top: 25px;
    width: 100%;
}

.btn {
    padding: 12px clamp(15px, 4vw, 30px);
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    flex-shrink: 0;
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.btn-primary {
    background: linear-gradient(45deg, #00c6fb 0%, #005bea 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(45deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(45deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.btn-back {
    background: white;
    color: #667eea;
    border: 3px solid #667eea;
    margin-top: 30px;
}

.countdown-setting {
    text-align: center;
    padding: 25px;
    background: #f8f9ff;
    border-radius: 20px;
    border: 2px dashed #667eea;
    margin: 20px 0;
}

.countdown-inputs {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.time-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.time-adjust {
    width: 40px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3rem;
    color: #667eea;
    border-radius: 8px;
    transition: all 0.2s ease;
    user-select: none;
}

.time-adjust:hover {
    background: #667eea;
    color: white;
}

.time-input {
    width: 70px;
    padding: 10px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #667eea;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: white;
}

.time-separator {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.status-text {
    font-size: 1.5rem;
    color: #666;
    margin-top: 20px;
    font-weight: bold;
}

.status-text.working {
    color: #38ef7d;
}

.status-text.paused {
    color: #f5576c;
}

.status-text.stopped {
    color: #666;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .page-title {
        font-size: 2rem;
        margin-bottom: 20px;
        text-shadow: 2px 2px 0px rgba(0,0,0,0.2);
    }
    
    .tools-grid {
        gap: 15px;
        padding: 10px;
    }
    
    .tool-card {
        padding: 30px 20px;
        border-radius: 20px;
    }
    
    .tool-icon {
        font-size: 4rem;
        margin-bottom: 15px;
    }
    
    .tool-title {
        font-size: 1.4rem;
    }
    
    .tool-desc {
        font-size: 1rem;
    }
    
    .monitor-page {
        min-height: auto;
        padding: 10px 0;
    }
    
    .monitor-container {
        padding: 25px 15px;
        border-radius: 20px;
    }
    
    .toggle-mode-btn {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
        top: 10px;
        right: 10px;
    }
    
    .monitor-title {
        margin-bottom: 20px;
    }
    
    .avatar {
        border-width: 6px;
    }
    
    .timer-display {
        margin: 20px 0;
        letter-spacing: 1px;
    }
    
    .edit-countdown-btn {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
        right: 5px;
    }
    
    .countdown-setting {
        padding: 20px;
        margin: 15px 0;
    }
    
    .countdown-inputs {
        gap: 10px;
    }
    
    .time-input {
        width: 55px;
        padding: 8px;
        font-size: 1.2rem;
    }
    
    .time-adjust {
        width: 35px;
        height: 25px;
        font-size: 1.1rem;
    }
    
    .time-separator {
        font-size: 1.5rem;
    }
    
    .controls {
        gap: 8px;
        margin-top: 20px;
    }
    
    .status-text {
        font-size: 1.1rem;
        margin-top: 15px;
    }
    
    .btn-back {
        margin-top: 20px;
        padding: 10px 20px;
        font-size: 0.95rem;
    }
}

/* Tools grid: phone portrait = 2 columns, landscape = auto more columns */
@media (max-width: 768px) and (orientation: portrait) {
    .tools-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tool-card {
        padding: 22px 14px;
        border-radius: 18px;
    }

    .tool-icon {
        font-size: 3.2rem;
        margin-bottom: 10px;
    }

    .tool-title {
        font-size: 1.15rem;
    }

    .tool-desc {
        font-size: 0.9rem;
    }
}

@media (max-width: 1024px) and (orientation: landscape) {
    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.6rem;
    }
    
    .time-input {
        width: 45px;
        padding: 6px;
        font-size: 1.1rem;
    }
    
    .countdown-inputs {
        gap: 8px;
    }
}
