:root {
    --bg-main: #F6F8FA;
    /* GitHub Light bg */
    --bg-card: #FFFFFF;
    --bg-hover: #F3F4F6;

    --border-color: #D1D5DB;
    --border-focus: #0969DA;
    /* GitHub Blue */

    --text-main: #1F2328;
    --text-muted: #656D76;

    --primary: #0969DA;
    --primary-hover: #0550AA;

    --radius: 6px;

    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-ui);
    background: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    min-height: 100vh;
}

.layout {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header */
header {
    margin-bottom: 0.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.subtitle code {
    background: var(--bg-card);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.85em;
}

/* Main Form container */
main {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.full-width {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

input[type="text"],
select,
textarea {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}

/* Options */
.radio-group,
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.radio-item,
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
}

.checkbox-item code {
    font-family: var(--font-mono);
    background: var(--bg-hover);
    padding: 0 0.2rem;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Output Area */
.output-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.output-box {
    flex: 1;
    font-family: var(--font-mono) !important;
    font-size: 1rem !important;
    background: var(--bg-hover) !important;
    color: var(--primary) !important;
    font-weight: 600;
}

.output-box::selection {
    background: rgba(9, 105, 218, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-muted);
}

.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-main);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* History */
.history-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
}

.history-panel h3 {
    font-size: 0.85rem;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

#history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#history-list li {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#history-list li:hover {
    color: var(--primary);
    background: rgba(9, 105, 218, 0.05);
}

.empty-state {
    font-family: var(--font-ui) !important;
    color: var(--text-muted) !important;
    background: transparent !important;
    cursor: default !important;
}

.empty-state:hover {
    color: var(--text-muted) !important;
    background: transparent !important;
}

@media(max-width: 500px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .output-container {
        flex-direction: column;
    }

    .btn-primary {
        width: 100%;
    }
}