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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f4f5f7;
    color: #1a1a1a;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}

.container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    align-self: flex-start;
}

/* User bar */
.user-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.8rem;
    color: #666;
}

#btn-logout {
    padding: 0.25rem 0.6rem;
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #666;
    cursor: pointer;
}

#btn-logout:hover { background: #f4f5f7; color: #333; }

h1 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    flex: 1;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: #333; }
.tab.active { color: #0052cc; border-bottom-color: #0052cc; }

/* Tab content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Form elements */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: #444;
}

select, input[type="number"] {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    background: #fff;
}

select:focus, input:focus {
    outline: none;
    border-color: #0052cc;
    box-shadow: 0 0 0 2px rgba(0,82,204,0.2);
}

optgroup { font-weight: 600; }

.hint {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 1rem;
    font-style: italic;
}

/* Generate button */
.btn-generate {
    width: 100%;
    padding: 0.7rem;
    background: #0052cc;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-generate:hover { background: #0041a3; }
.btn-generate:active { background: #003580; }

/* Result */
#result {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #e6f4ea;
    border-radius: 4px;
}

#result label {
    color: #1a7d36;
    margin-bottom: 0.5rem;
}

.result-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#control-number {
    flex: 1;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    word-break: break-all;
}

#btn-copy {
    padding: 0.4rem 0.8rem;
    background: #1a7d36;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

#btn-copy:hover { background: #15632b; }

/* Error */
#error {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #fce8e8;
    border-radius: 4px;
    color: #c41e1e;
    font-size: 0.9rem;
}

/* Loading */
#loading {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    color: #666;
    font-size: 0.9rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #0052cc;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Utility */
.hidden { display: none !important; }
