:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #c084fc;
    --secondary: #3b82f6;
    --accent: #f43f5e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
}

/* Animated Background Shapes */
.bg-shapes {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    overflow: hidden;
    z-index: -1;
    filter: blur(80px);
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
    animation: float 20s infinite alternate ease-in-out;
}

.shape-1 {
    width: 300px; height: 300px;
    background: var(--primary);
    top: -10%; left: -10%;
}

.shape-2 {
    width: 400px; height: 400px;
    background: var(--secondary);
    bottom: -10%; right: -10%;
    animation-delay: -5s;
}

.shape-3 {
    width: 250px; height: 250px;
    background: var(--accent);
    top: 40%; left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(100px, 50px) rotate(180deg); }
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px 25px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

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

h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--text-main);
    font-weight: 600;
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

button {
    border: none;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
}

.btn-option {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-option:hover, .btn-option:active {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Custom Cards */
.custom-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 20px;
    margin-top: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 16px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 16px;
    margin-top: 5px;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(192, 132, 252, 0.3);
}

.btn-primary:hover, .btn-primary:active {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(192, 132, 252, 0.4);
}

/* Saved Sets */
.saved-sets-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.btn-saved-set {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.btn-saved-set:hover {
    background: rgba(59, 130, 246, 0.4);
}

.save-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-buttons button {
    flex: 1;
    padding: 12px;
}

.btn-save {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}
.btn-save:hover { background: rgba(16, 185, 129, 0.4); }

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.4); }

.empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
    width: 100%;
    text-align: center;
    padding: 10px 0;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 25px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--glass-border);
}
.divider span {
    padding: 0 15px;
}

/* Views */
.view {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.view.hidden {
    display: none;
    opacity: 0;
    transform: scale(0.95);
}

/* Result View */
.gradient-text {
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    font-size: 1.6rem;
    margin-bottom: 25px;
}

.result-box {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-box.drawn {
    border: 2px solid var(--primary);
    background: rgba(192, 132, 252, 0.1);
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(192, 132, 252, 0.3);
}

#ergebnis-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
}

#ergebnis {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.hidden-result {
    display: none;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.action-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-action {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    padding: 18px;
    font-size: 1.3rem;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}
.btn-action:hover, .btn-action:active {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.6);
}

.btn-back {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 14px;
}
.btn-back:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(192, 132, 252, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(192, 132, 252, 0); }
    100% { box-shadow: 0 0 0 0 rgba(192, 132, 252, 0); }
}

/* Responsive fixes */
@media (max-width: 380px) {
    .options-grid { grid-template-columns: 1fr; }
    .glass-panel { padding: 20px 15px; }
}