/* ─── Reset & Base ─── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #050506;
    --surface: #111827;
    --surface-light: #1f2937;
    --accent: #00A7E1;
    --accent-glow: rgba(0, 167, 225, 0.35);
    --accent-soft: rgba(0, 167, 225, 0.15);
    --text: #eaeaea;
    --text-dim: #9ca3af;
    --danger: #ef4444;
    --radius: 16px;
    --radius-sm: 12px;
}

html,
body {
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

/* ─── Layout ─── */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 1.2rem;
}

/* ─── Header ─── */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 0 0.6rem;
    flex-shrink: 0;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #007bb5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.icon-btn {
    font-size: 1.4rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--surface-light);
}

/* ─── Main ─── */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem 0 1.5rem;
}

/* ─── Input Row ─── */
.input-row {
    display: flex;
    gap: 0.5rem;
    animation: fadeIn 0.4s ease-out;
}

.input-row input {
    flex: 1;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.input-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-row input::placeholder {
    color: var(--text-dim);
    opacity: 0.5;
}

.btn-add {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), #007bb5);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-add:hover {
    transform: scale(1.05);
}

.btn-add:active {
    transform: scale(0.95);
}

/* ─── Presets ─── */
.presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    animation: fadeIn 0.4s ease-out 0.1s backwards;
}

.preset-btn {
    padding: 0.4rem 0.8rem;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    color: var(--text-dim);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ─── Options List ─── */
.options-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 36px;
}

.empty-hint {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-style: italic;
    padding: 0.5rem 0;
}

.option-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text);
    animation: popIn 0.2s ease-out;
}

.option-tag .remove-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.option-tag .remove-btn:hover {
    color: var(--danger);
}

/* ─── Roulette ─── */
.roulette-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 0;
    animation: fadeIn 0.4s ease-out;
}

.pointer {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.8rem;
    color: var(--accent);
    z-index: 10;
    filter: drop-shadow(0 2px 6px rgba(0, 167, 225, 0.5));
    line-height: 1;
}

canvas {
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(0, 167, 225, 0.15), 0 0 60px rgba(0, 0, 0, 0.4);
}

/* ─── Spin Button ─── */
.btn-spin {
    padding: 1rem 2rem;
    width: 100%;
    background: linear-gradient(135deg, var(--accent), #007bb5);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-spin:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-spin:active:not(:disabled) {
    transform: translateY(0);
}

.btn-spin:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-spin.spinning {
    opacity: 0.6;
    pointer-events: none;
}

/* ─── Result ─── */
.result {
    text-align: center;
    padding: 1.2rem;
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    animation: popIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 20px var(--accent-glow);
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
}

.result-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
}

/* ─── Footer ─── */
footer {
    flex-shrink: 0;
    padding: 1rem 0 1.5rem;
}

.app-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.app-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

/* ─── Animations ─── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}