* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
    touch-action: none;
}

:root {
    --bg-gradient: radial-gradient(circle at top, #1c4434 0%, #07131f 40%, #03060b 100%);
    --card-bg: rgba(8, 18, 28, 0.96);
    --card-bg-alt: rgba(8, 29, 22, 0.96);
    --card-border: rgba(255, 255, 255, 0.08);
    --accent: #f94144;
    --accent-soft: #f9c74f;
    --text-main: #f5f7fa;
    --text-muted: #a8b5c3;
    --input-bg: rgba(6, 14, 22, 0.9);
}

html {
    height: 100%;
    background: var(--bg-gradient);
    background-color: #03060b;
}

body {
    font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-gradient);
    background-color: #03060b;
    color: var(--text-main);
    overflow-x: hidden;
    margin: 0;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(2px 2px at 10% 20%, rgba(255, 255, 255, 0.25) 50%, transparent 50%),
        radial-gradient(2px 2px at 80% 30%, rgba(255, 255, 255, 0.18) 50%, transparent 50%),
        radial-gradient(3px 3px at 50% 80%, rgba(255, 255, 255, 0.16) 50%, transparent 50%);
    opacity: 0.5;
}

.page-container {
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    position: relative;
    z-index: 1;
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.container {
    width: 100%;
    max-width: 460px;
    background: linear-gradient(145deg, var(--card-bg), var(--card-bg-alt));
    border-radius: 20px;
    padding: 28px 22px 24px;
    border: 1px solid var(--card-border);
    box-shadow:
        0 18px 45px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(255, 255, 255, 0.02);
    text-align: left;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: radial-gradient(circle at 2% 10%, #ededed, #ff6600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(255, 130, 77, 0.6);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-name {
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #ffffff;
}

.brand-tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.title-text {
    font-size: 1.7rem;
    margin: 0 0 10px;
    color: #ffffff;
}

h1, h2 {
    font-weight: 600;
}

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

input {
    padding: 12px 14px;
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 0.95rem;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder {
    color: rgba(200, 210, 225, 0.65);
}

input:focus {
    outline: none;
    border-color: var(--accent-soft);
    box-shadow: 0 0 0 1px rgba(249, 199, 79, 0.35);
    background: rgba(10, 24, 36, 0.95);
}

button {
    padding: 12px 20px;
    margin: 0;
    background: linear-gradient(135deg, #f94144, #f3722c);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, opacity 0.16s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(249, 65, 68, 0.45);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.primary-button {
    background: linear-gradient(135deg, #f94144, #f8961e);
}

.secondary-button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-main);
    padding-inline: 18px;
}

.secondary-button:hover {
    background: rgba(255, 255, 255, 0.04);
    box-shadow: none;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.input-group input {
    flex: 1;
}

#name-list {
    margin-top: 12px;
    margin-bottom: 8px;
}

#name-list ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#name-list li {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-main);
    background: rgba(10, 24, 36, 0.9);
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

#name-list li + li {
    margin-top: 6px;
}

#name-list li:hover {
    background-color: rgba(18, 34, 50, 0.96);
    border-color: rgba(249, 199, 79, 0.4);
    transform: translateY(-1px);
}

.new-name {
    animation: fadeIn 0.18s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.remove-btn {
    color: #ffccd5;
    cursor: pointer;
    font-size: 0.8rem;
}

.error-message {
    font-size: 0.9rem;
    margin-top: 10px;
    color: #ffe5e9;
    background: linear-gradient(135deg, rgba(180, 42, 52, 0.9), rgba(200, 52, 70, 0.9));
    padding: 9px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
}

#name-result {
    display: none;
    font-size: 0.95rem;
    margin-top: 12px;
    color: var(--text-main);
    transition: opacity 0.25s ease, transform 0.25s ease;
    opacity: 0;
    transform: translateY(4px);
}

#name-result.is-visible {
    display: none;
    opacity: 1;
    transform: translateY(0);
}

.code-list {
    padding: 10px 12px;
    margin-top: 18px;
    border-radius: 14px;
    background-color: rgba(10, 24, 36, 0.96);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
    list-style: none;
}

.code-list li {
    font-size: 0.9rem;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-main);
}

.code-list li:last-child {
    border-bottom: none;
}

.info-text {
    color: #b7f5c4;
    font-size: 0.95rem;
    margin-top: 18px;
}

.loader {
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid #3498db;
    width: 18px;
    height: 18px;
    animation: spin 0.8s linear infinite;
    display: none;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.footer {
    text-align: center;
    padding: 18px 10px 6px;
    background-color: transparent;
    color: var(--text-muted);
    width: 100%;
    font-size: 0.8rem;
}

.footer a {
    color: var(--accent-soft);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.big-divider {
    border: none;
    height: 3px;
    background: linear-gradient(90deg, rgba(30, 60, 114, 0.62), rgba(152, 42, 134, 0.76));
    margin: 20px 0;
}

/* Zentrales Modal für Fehlermeldungen */
.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(3, 10, 18, 0.7);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.modal-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 360px;
    padding: 20px 18px 16px;
    border-radius: 18px;
    background: linear-gradient(145deg, var(--card-bg), var(--card-bg-alt));
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.9);
}

.modal-title {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: #ffffff;
}

.modal-message {
    margin: 0 0 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.modal-close {
    width: 100%;
    margin-top: 4px;
}

@media (max-width: 600px) {
    .page-container {
        padding-top: calc(16px + env(safe-area-inset-top));
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .brand-name {
        font-size: 0.8rem;
    }

    .brand-tagline {
        font-size: 0.55rem;
    }

    .title-text {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.8rem;
        margin-bottom: 18px;
    }

    .container {
        padding: 22px 18px 20px;
        max-width: 100%;
    }

    .brand {
        margin-bottom: 18px;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .input-group button {
        width: 100%;
    }

    .input-group .loader {
        margin-left: 0;
        margin-top: 6px;
        align-self: center;
    }

    .secondary-button {
        width: 100%;
    }

    .code-list li {
        font-size: 0.75rem;
    }

    .footer {
        font-size: 0.65rem;
        padding: 2px 0px 2px;
    }
}
