body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #121212;
    color: #e0e0e0;
    line-height: 1.6;
}

header {
    background-color: #1e1e1e;
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid #333;
}

header h1 {
    margin: 0;
    color: #00d4aa;
}

header p {
    margin: 10px 0 0 0;
    color: #bbb;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

section {
    margin-bottom: 40px;
    background-color: #1e1e1e;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

h2 {
    color: #00d4aa;
    margin-top: 0;
}

h3 {
    color: #e0e0e0;
    margin: 0 0 8px 0;
}

.section-heading,
.label-row,
.match-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-heading h2 {
    margin-bottom: 0;
}

.info-button {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    font-weight: 700;
    color: #121212;
    background-color: #00d4aa;
}

.info-button:hover {
    background-color: #51f0d0;
}

.help-text {
    margin: 10px 0 16px 0;
    color: #c9c9c9;
}

button {
    background-color: #333;
    color: #e0e0e0;
    border: none;
    padding: 10px 15px;
    margin: 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #555;
}

#pattern-builder {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#regex-display {
    margin-top: 20px;
}

#regex-input,
#flags-input,
#phone-prefix,
#phone-digits,
#match-mode {
    width: 100%;
    padding: 10px;
    background-color: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

#flags-input {
    max-width: 180px;
}

.label-row {
    margin-top: 14px;
}

#preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#pattern-options {
    margin-top: 20px;
    border-top: 1px solid #333;
    padding-top: 16px;
}

#pattern-options p {
    color: #bbb;
    margin-top: 0;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr)) auto;
    align-items: end;
    gap: 10px;
}

.field-group {
    display: grid;
    gap: 6px;
}

.match-options {
    margin-bottom: 10px;
}

.match-options label {
    white-space: nowrap;
}

textarea {
    width: 100%;
    height: 150px;
    padding: 10px;
    background-color: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    font-family: monospace;
    resize: vertical;
    box-sizing: border-box;
}

#results {
    margin-top: 20px;
}

pre {
    background-color: #2a2a2a;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
}

#highlighted-text {
    background-color: #2a2a2a;
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    min-height: 24px;
    white-space: pre-wrap;
}

.highlight {
    background-color: #ffeb3b;
    color: #000;
    padding: 2px 4px;
    border-radius: 2px;
}

footer {
    text-align: center;
    padding: 20px;
    background-color: #1e1e1e;
    color: #bbb;
    border-top: 2px solid #333;
}

/* Responsive */
@media (max-width: 768px) {
    #pattern-builder, #preset-buttons {
        flex-direction: column;
    }
    .option-grid {
        grid-template-columns: 1fr;
    }
    button {
        width: 100%;
    }
    .info-button {
        flex: 0 0 24px;
        width: 24px;
    }
    .match-options {
        align-items: stretch;
        flex-direction: column;
    }
}
