/* ==========================================================================
   "Is This Person Tickled?" — Styles
   ========================================================================== */

:root {
    --bg:         #0f0f0f;
    --surface:    #1a1a2e;
    --card:       #16213e;
    --text:       #e0e0e0;
    --text-muted: #8a8a9a;
    --accent:     #7f5af0;
    --alive:      #2cb67d;
    --dead:       #e53170;
    --unknown:    #f0a500;
    --border:     #2a2a4a;
    --input-bg:   #0f1127;
    --radius:     12px;
    --shadow:     0 8px 32px rgba(0, 0, 0, .45);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1rem;
}

/* ── Header / Brand ──────────────────────────────────────────────────────── */

.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent), var(--dead));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: var(--text-muted);
    margin-top: .4rem;
    font-size: .95rem;
}

/* ── Search Form ─────────────────────────────────────────────────────────── */

.search-box {
    width: 100%;
    max-width: 560px;
    display: flex;
    gap: .5rem;
}

.search-box input {
    flex: 1;
    padding: .85rem 1.1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--input-bg);
    color: var(--text);
    outline: none;
    transition: border-color .2s;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    border-color: var(--accent);
}

.search-box button {
    padding: .85rem 1.6rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    white-space: nowrap;
}

.search-box button:hover {
    opacity: .88;
    transform: translateY(-1px);
}

.search-box button:active {
    transform: translateY(0);
}

.search-box button:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

/* ── Result Area ─────────────────────────────────────────────────────────── */

#result {
    width: 100%;
    max-width: 560px;
    margin-top: 2rem;
}

/* ── Loading Spinner ─────────────────────────────────────────────────────── */

.loading {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: .95rem;
}

.loading .spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin-bottom: .6rem;
}

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


.loading-card {
    background: linear-gradient(180deg, rgba(26, 26, 46, .98), rgba(22, 33, 62, .96));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.6rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.loading-card::before {
    content: '';
    position: absolute;
    inset: -40% -20%;
    background: radial-gradient(circle, rgba(127, 90, 240, .18), transparent 45%);
    animation: loadingGlow 3s ease-in-out infinite alternate;
    pointer-events: none;
}

.tickle-orb {
    width: 54px;
    height: 54px;
    margin: 0 auto .9rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--dead));
    box-shadow: 0 0 28px rgba(127, 90, 240, .35);
    animation: tickleBob 1.2s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

.loading-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: .35rem;
    position: relative;
    z-index: 1;
}

.loading-message {
    min-height: 1.5rem;
    color: var(--text-muted);
    font-size: .95rem;
    position: relative;
    z-index: 1;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: .4rem;
    margin: 1rem 0 .9rem;
    position: relative;
    z-index: 1;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    opacity: .35;
    animation: dotPulse 1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: .15s; }
.loading-dots span:nth-child(3) { animation-delay: .3s; }

.loading-bar {
    height: 6px;
    background: rgba(255, 255, 255, .08);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.loading-bar span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--dead));
    animation: loadingSweep 1.35s ease-in-out infinite;
}

.loading-note {
    color: var(--text-muted);
    font-size: .78rem;
    margin-top: .85rem;
    position: relative;
    z-index: 1;
}

@keyframes loadingGlow {
    from { transform: translateX(-8%) rotate(0deg); opacity: .7; }
    to { transform: translateX(8%) rotate(8deg); opacity: 1; }
}

@keyframes tickleBob {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-5px) rotate(4deg); }
}

@keyframes dotPulse {
    0%, 100% { opacity: .25; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}

@keyframes loadingSweep {
    0% { transform: translateX(-110%); }
    100% { transform: translateX(250%); }
}

/* ── Result Card ─────────────────────────────────────────────────────────── */

.result-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.6rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.result-card.alive::before {
    background: var(--alive);
}

.result-card.dead::before {
    background: var(--dead);
}

.result-card.unknown::before {
    background: var(--unknown);
}

/* ── Badge ───────────────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 1rem;
}

.badge.alive {
    background: rgba(44, 182, 125, .15);
    color: var(--alive);
}

.badge.dead {
    background: rgba(229, 49, 112, .15);
    color: var(--dead);
}

.badge.unknown {
    background: rgba(240, 165, 0, .15);
    color: var(--unknown);
}

/* ── Thumbnail ───────────────────────────────────────────────────────────── */

.thumb {
    float: right;
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    margin: 0 0 .8rem 1rem;
    border: 2px solid var(--border);
}

/* ── Text content ────────────────────────────────────────────────────────── */

.result-card .person-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.result-card .ai-text {
    line-height: 1.65;
    color: var(--text);
    font-size: .95rem;
}

.result-card .meta {
    margin-top: 1rem;
    padding-top: .8rem;
    border-top: 1px solid var(--border);
    font-size: .82rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.4rem;
}

.result-card .meta span {
    white-space: nowrap;
}

/* ── Days counter (big number) ───────────────────────────────────────────── */

.days-counter {
    display: flex;
    align-items: baseline;
    gap: .4rem;
    margin-top: .8rem;
}

.days-counter .number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--dead);
}

.days-counter .label {
    font-size: .85rem;
    color: var(--text-muted);
}

/* ── Tickled Shortly (90+ warning) ───────────────────────────────────────── */

.tickled-soon {
    margin-top: .8rem;
    padding: .6rem 1rem;
    border-radius: 8px;
    background: rgba(240, 165, 0, .12);
    color: var(--unknown);
    font-size: .9rem;
    font-weight: 600;
    text-align: center;
}

/* ── Disambiguation List ─────────────────────────────────────────────────── */

.disambiguation {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow);
}

.disambiguation h3 {
    font-size: 1rem;
    margin-bottom: .8rem;
    color: var(--text-muted);
}

.disambiguation ul {
    list-style: none;
}

.disambiguation li {
    padding: .65rem .8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
    font-size: .95rem;
}

.disambiguation li:hover {
    background: rgba(127, 90, 240, .12);
}

.disambiguation li .title {
    font-weight: 600;
    color: var(--accent);
}

.disambiguation li .snippet {
    display: block;
    color: var(--text-muted);
    font-size: .82rem;
    margin-top: .15rem;
}

/* ── Error Message ───────────────────────────────────────────────────────── */

.error-msg {
    background: rgba(229, 49, 112, .1);
    border: 1px solid rgba(229, 49, 112, .3);
    color: var(--dead);
    border-radius: var(--radius);
    padding: 1rem 1.4rem;
    font-size: .92rem;
    line-height: 1.5;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .78rem;
}

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

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

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    body {
        padding: 2rem .75rem;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box button {
        width: 100%;
    }

    .thumb {
        width: 70px;
        height: 70px;
    }
}
