:root {
    --cell-size: 60px;
    --ineq-size: 18px;
    --bg-gradient: linear-gradient(135deg, #a8c0ff 0%, #3f2b96 100%);
    --card-bg: #ffffff;
    --grid-border: #4a5568;
    --given-bg: #edf2f7;
    --given-color: #2d3748;
    --user-color: #2b6cb0;
    --hint-color: #d69e2e;
    --error-bg: #fed7d7;
    --error-color: #c53030;
    --primary-btn: #319795;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.main-container {
    background: var(--card-bg);
    padding: 28px 32px;
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    text-align: center;
    max-width: 480px;
    width: 100%;
}

header h1 {
    margin: 0 0 8px 0;
    color: #2b6cb0;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

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

.score-badge {
    background: #ebf8ff;
    color: #2b6cb0;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid #bee3f8;
}

.score-badge strong {
    color: #2c5282;
    font-size: 1.1rem;
}

.futoshiki-grid {
    display: grid;
    grid-template-columns: var(--cell-size) var(--ineq-size) var(--cell-size) var(--ineq-size) var(--cell-size) var(--ineq-size) var(--cell-size) var(--ineq-size) var(--cell-size);
    grid-template-rows: var(--cell-size) var(--ineq-size) var(--cell-size) var(--ineq-size) var(--cell-size) var(--ineq-size) var(--cell-size) var(--ineq-size) var(--cell-size);
    gap: 0;
    margin: 16px auto;
    justify-content: center;
    align-items: center;
}

.futoshiki-cell {
    width: var(--cell-size);
    height: var(--cell-size);
    border: 2px solid var(--grid-border);
    border-radius: 8px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: white;
    overflow: hidden;
    transition: transform 0.1s, border-color 0.15s;
}

.cell-input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--user-color);
    outline: none;
    cursor: pointer;
    background: transparent;
}

.cell-input:focus {
    background-color: #ebf8ff;
}

.given-cell {
    background-color: var(--given-bg);
}

.given-cell .cell-input {
    color: var(--given-color);
    font-weight: 800;
    cursor: default;
}

.hinted-cell .cell-input {
    color: var(--hint-color);
    font-weight: 800;
}

.error-cell {
    background-color: var(--error-bg) !important;
    border-color: #e53e3e !important;
}

.error-cell .cell-input {
    color: var(--error-color) !important;
}

.inequality {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #4a5568;
    user-select: none;
}

.ineq-h {
    width: var(--ineq-size);
    height: var(--cell-size);
}

.ineq-v {
    height: var(--ineq-size);
    width: var(--cell-size);
}

.rotate-v {
    display: inline-block;
    transform: rotate(270deg);
}

.numpad-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 18px 0;
}

.numpad-btn {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(145deg, #3182ce, #2b6cb0);
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    user-select: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.numpad-btn:hover {
    background: linear-gradient(145deg, #4299e1, #3182ce);
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0,0,0,0.15);
}

.numpad-btn:active {
    cursor: grabbing;
    transform: translateY(0);
}

.backspace-btn {
    background: linear-gradient(145deg, #e53e3e, #c53030);
    cursor: pointer;
}

.backspace-btn:hover {
    background: linear-gradient(145deg, #f56565, #e53e3e);
}

.controls {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.control-btn {
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.15s, opacity 0.15s;
}

.control-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.new-btn { background-color: #38a169; }
.hint-btn { background-color: #d69e2e; }
.reset-btn { background-color: #718096; }

/* --- SLOW PULSE (2.4s DURATION) --- */
#new-game-btn.btn-pulse {
    animation: fade-pulse 2.4s infinite ease-in-out !important;
}

@keyframes fade-pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.03); }
    100% { opacity: 1; transform: scale(1); }
}

.message-area {
    margin-top: 14px;
    height: 1.4rem;
    font-weight: 700;
    font-size: 1rem;
    color: #2f855a;
}