:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --error-color: #ef4444;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

::placeholder {
    color: #cbd5e1;
    /* slategray-300 - distinctively lighter than input text */
    opacity: 1;
    /* Firefox */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.5;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.input-section {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.ip-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ip-inputs .octet {
    width: 100%;
    padding: 0.75rem;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1.1rem;
    font-family: monospace;
    transition: box-shadow 0.2s, border-color 0.2s;
}

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
}

.octet:focus,
#subnet:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ip-inputs span {
    font-weight: bold;
    color: var(--text-secondary);
}

#subnet {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
}

button {
    width: 100%;
    padding: 0.875rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

button:hover {
    background-color: var(--primary-hover);
}

button:active {
    transform: translateY(1px);
}

.result-section.hidden {
    display: none;
}

.error-message {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 500;
}

.error-message.hidden {
    display: none;
}

.success-result h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.result-card {
    background: var(--card-background);
    border: 2px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    text-align: center;
}

.result-card h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    font-family: monospace;
    margin-bottom: 0.5rem;
}

.subnet-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.neighbor-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.neighbor-item {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.neighbor-item .label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
}

.neighbor-item span:not(.label) {
    font-family: monospace;
    font-weight: 500;
    color: var(--text-primary);
}

@media (max-width: 480px) {
    body {
        padding: 1rem;
    }

    .ip-inputs {
        flex-wrap: nowrap;
    }

    .neighbor-list {
        grid-template-columns: 1fr;
    }
}