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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

h1 {
    color: white;
    font-size: 2rem;
    font-weight: 300;
}

.header-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.add-btn, .mode-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.add-btn:hover, .mode-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
}

.create-form {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.create-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.create-form input:focus {
    outline: none;
    border-color: #667eea;
}

.form-buttons {
    display: flex;
    gap: 10px;
}

.form-buttons button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#saveCounter {
    background: #4CAF50;
    color: white;
}

#saveCounter:hover {
    background: #45a049;
}

#cancelCounter {
    background: #f44336;
    color: white;
}

#cancelCounter:hover {
    background: #da190b;
}

.counters-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.counter-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.counter-card:hover {
    transform: translateY(-5px);
}

.counter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.counter-name {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.hotkey-badge {
    background: #667eea;
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.counter-value {
    text-align: center;
    margin-bottom: 12px;
}

.counter-value input {
    font-size: 2rem;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 6px;
    width: 100%;
    font-weight: bold;
    color: #333;
}

.counter-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}

.counter-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.decrement-btn {
    background: #ff6b6b;
    color: white;
}

.decrement-btn:hover {
    background: #ff5252;
    transform: scale(1.1);
}

.increment-btn {
    background: #4ecdc4;
    color: white;
}

.increment-btn:hover {
    background: #26a69a;
    transform: scale(1.1);
}

.delete-btn {
    width: 100%;
    padding: 6px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.3s ease;
}

.delete-btn:hover {
    background: #da190b;
}

.hidden {
    display: none;
}

.empty-state {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    margin-top: 50px;
}

.input-mode-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1000;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    padding: 10px;
    min-height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
    align-content: start;
}

@media (min-width: 1024px) {
    .counters-container {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .input-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 5px;
        gap: 2px;
    }
}

.input-counter {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 15px 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    user-select: none;
    min-height: 120px;
    aspect-ratio: 1;
}

@media (max-width: 768px) {
    .input-counter {
        padding: 10px 5px;
        min-height: 100px;
        border-radius: 8px;
    }
}

.input-counter:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.input-counter:active {
    transform: scale(0.95);
}

.input-counter-name {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    text-align: center;
    line-height: 1.2;
}

.input-counter-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
    text-align: center;
}

@media (max-width: 768px) {
    .input-counter-name {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }

    .input-counter-value {
        font-size: 2rem;
    }
}

.input-counter-hotkey {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
}

.exit-input-mode {
    position: fixed;
    top: 15px;
    left: 15px;
    background: #333;
    color: white;
    border: 2px solid #555;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    z-index: 1001;
    font-weight: 500;
}

.exit-input-mode:hover {
    background: #555;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .exit-input-mode {
        top: 10px;
        left: 10px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}