:root {
    --widget-unit-width: 140px;
    --widget-unit-height: 70px;
    --widget-gap: 16px;
    --widget-padding: 12px 16px;
}

#widgets-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: var(--widget-gap);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: calc(100vw - 60px);
}

#widgets-container:not(:empty) {
    opacity: 1;
}

.widget-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-end;
    gap: var(--widget-gap);
}

.widget-column {
    display: flex;
    flex-direction: column;
    gap: var(--widget-gap);
    align-items: flex-start;
}

.widget {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    padding: var(--widget-padding);
    color: rgba(255, 255, 255, 0.9);
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
    width: calc(var(--widget-cols, 1) * var(--widget-unit-width) + (var(--widget-cols, 1) - 1) * var(--widget-gap));
    height: calc(var(--widget-rows, 1) * var(--widget-unit-height) + (var(--widget-rows, 1) - 1) * var(--widget-gap));
}

.widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.clock-container.with-widgets {
    transform: translateY(-40px);
}

.clock-container.with-widgets .date {
    margin-bottom: 5px;
}

.clock-container.with-widgets .clock {
    margin-top: 0;
}

.widget-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    height: 100%;
}

.countdown-ring {
    position: relative;
    width: 48px;
    height: 48px;
}

.countdown-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 3;
}

.ring-progress {
    fill: none;
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

.ring-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.ring-label {
    font-size: 8px;
    font-family: 'Inter', -apple-system, sans-serif;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    max-width: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.countdown-values {
    display: flex;
    gap: 12px;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.countdown-value {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
}

.countdown-unit {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
    font-family: 'Inter', -apple-system, sans-serif;
}

.widget-performance {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    height: 100%;
}

.perf-module {
    display: flex;
    align-items: center;
    gap: 8px;
}

.perf-ring-small {
    position: relative;
    width: 28px;
    height: 28px;
}

.perf-ring-small svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg-small {
    fill: none;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 2;
}

.ring-progress-small {
    fill: none;
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

.ring-label-small {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 6px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Inter', -apple-system, sans-serif;
}

.perf-value {
    font-size: 14px;
    font-weight: 500;
    min-width: 36px;
}

.perf-divider {
    width: 1px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
}

.perf-net {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.net-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.net-arrow {
    width: 12px;
    height: 12px;
    stroke: rgba(255, 255, 255, 0.6);
    stroke-width: 1.5;
    fill: none;
}

.net-arrow.up {
    transform: rotate(0deg);
}

.net-value {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    min-width: 70px;
}

.widget-unavailable {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
}

.unavailable-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Inter', -apple-system, sans-serif;
}

.widget-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.timer-setup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.timer-running {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.timer-ring {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.timer-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-ring-progress {
    stroke: rgba(46, 204, 113, 0.9);
}

.timer-time-display,
.timer-time-values {
    display: flex;
    align-items: center;
    gap: 12px;
}

.timer-time-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-time-value {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    color: rgba(255, 255, 255, 0.9);
}

.timer-time-unit {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
    font-family: 'Inter', -apple-system, sans-serif;
}

.timer-time {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}

.timer-quick-btns {
    display: flex;
    gap: 8px;
}

.timer-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
}

.timer-quick-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.timer-quick-btn.active {
    background: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 0.5);
    color: #2ecc71;
}

.timer-quick-btn .quick-value {
    font-size: 16px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
}

.timer-quick-btn .quick-unit {
    font-size: 9px;
    font-family: 'Inter', -apple-system, sans-serif;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.timer-custom {
    display: flex;
    align-items: center;
    gap: 2px;
}

.timer-input {
    width: 28px;
    padding: 4px 2px;
    font-size: 10px;
    text-align: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'JetBrains Mono', monospace;
    -moz-appearance: textfield;
}

.timer-input::-webkit-inner-spin-button,
.timer-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.timer-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-size: 8px;
}

.timer-sep {
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
}

.timer-running-controls {
    display: flex;
    gap: 6px;
}

.timer-btn {
    padding: 4px 8px;
    font-size: 10px;
    font-family: 'Inter', -apple-system, sans-serif;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.timer-start {
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid rgba(46, 204, 113, 0.4);
    color: #2ecc71;
}

.timer-start:hover {
    background: rgba(46, 204, 113, 0.3);
}

.timer-pause {
    background: rgba(241, 196, 15, 0.2);
    border: 1px solid rgba(241, 196, 15, 0.4);
    color: #f1c40f;
}

.timer-pause:hover {
    background: rgba(241, 196, 15, 0.3);
}

.timer-pause:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.timer-stop {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.timer-stop:hover {
    background: rgba(239, 68, 68, 0.3);
}

.widget.timer-complete {
    animation: timer-glow 1.5s ease-in-out infinite;
}

@keyframes timer-glow {
    0%, 100% {
        background: rgba(255, 255, 255, 0.12);
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.2), 
                    0 0 20px rgba(255, 255, 255, 0.1);
    }
    50% {
        background: rgba(255, 255, 255, 0.35);
        box-shadow: 0 0 30px rgba(255, 255, 255, 0.6), 
                    0 0 60px rgba(255, 255, 255, 0.4),
                    0 0 90px rgba(255, 255, 255, 0.2);
    }
}

.widget.timer-complete .timer-ring-progress {
    stroke: rgba(255, 255, 255, 0.9);
}

.config-hint {
    font-size: 0.85rem;
    color: #888;
}

.widget-todo {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
}

.todo-input-area {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.todo-input {
    flex: 1;
    padding: 6px 10px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Inter', -apple-system, sans-serif;
}

.todo-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.todo-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
}

.todo-add-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid rgba(46, 204, 113, 0.4);
    color: #2ecc71;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.todo-add-btn:hover {
    background: rgba(46, 204, 113, 0.3);
}

.todo-list {
    max-height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.todo-list::-webkit-scrollbar {
    display: none;
}

.todo-empty {
    text-align: center;
    padding: 20px 0;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    font-family: 'Inter', -apple-system, sans-serif;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-item.completed {
    opacity: 0.5;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
}

.todo-checkbox {
    position: relative;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.todo-checkbox input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
}

.todo-checkbox .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.todo-checkbox input:checked + .checkmark {
    background: rgba(46, 204, 113, 0.3);
    border-color: rgba(46, 204, 113, 0.6);
}

.todo-checkbox input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #2ecc71;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.todo-text {
    flex: 1;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Inter', -apple-system, sans-serif;
    word-break: break-word;
}

.todo-delete {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
}

.todo-item:hover .todo-delete {
    opacity: 1;
}

.todo-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

@media (max-width: 768px) {
    :root {
        --widget-unit-width: 120px;
        --widget-unit-height: 50px;
        --widget-gap: 12px;
        --widget-padding: 12px 16px;
    }
    
    #widgets-container {
        bottom: 20px;
        max-width: 90%;
    }
    
    .countdown-value {
        font-size: 16px;
    }
    
    .perf-value {
        font-size: 12px;
    }
    
    .clock-container.with-widgets {
        transform: translateY(-30px);
    }
}
