:root {
    --bg: #f4f7fb;
    --card: #fff;
    --text: #14213d;
    --muted: #64748b;
    --primary: #2563eb;
    --primary2: #7c3aed;
    --danger: #dc2626;
    --ok: #16a34a;
    --line: #dbe3ef;
    --shadow: 0 18px 45px rgba(15, 23, 42, .12)
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text)
}

a {
    color: var(--primary);
    text-decoration: none
}

.setup-bg {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #dbeafe, #f5d0fe)
}

.setup-card {
    width: min(680px, 92vw);
    background: var(--card);
    border-radius: 28px;
    padding: 28px;
    box-shadow: var(--shadow)
}

.form {
    display: grid;
    gap: 14px
}

.form label {
    display: grid;
    gap: 6px;
    font-weight: 700
}

.form input,
.form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 13px;
    font-size: 16px
}

.check {
    display: flex !important;
    grid-template-columns: auto 1fr !important;
    align-items: center;
    gap: 10px
}

.check input {
    width: auto
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 14px;
    padding: 11px 16px;
    background: #e2e8f0;
    color: #0f172a;
    font-weight: 800;
    cursor: pointer
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white
}

.btn.danger {
    background: #fee2e2;
    color: var(--danger)
}

.notice {
    border-radius: 16px;
    padding: 12px 14px;
    margin: 12px 0;
    font-weight: 700
}

.notice.ok {
    background: #dcfce7;
    color: #166534
}

.notice.error {
    background: #fee2e2;
    color: #991b1b
}

.top {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    background: #0f172a;
    color: white;
    padding: 14px 20px;
    box-shadow: 0 8px 20px #0002
}

.top span {
    display: block;
    color: #cbd5e1;
    font-size: 13px
}

.top nav {
    display: flex;
    gap: 12px
}

.top a {
    color: white
}

.admin-wrap {
    max-width: 1100px;
    margin: 22px auto;
    padding: 0 16px;
    display: grid;
    gap: 18px
}

.card {
    background: var(--card);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--shadow)
}

.small-form {
    grid-template-columns: 1fr 1fr auto;
    align-items: end
}

.table {
    display: grid;
    gap: 10px
}

.row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.kid-body {
    background: radial-gradient(circle at top left, #dbeafe, #f8fafc 38%, #fef3c7)
}

.kid-hero {
    text-align: center;
    padding: 34px 16px 26px;
    background: linear-gradient(135deg, #1d4ed8, #7c3aed);
    color: white;
    border-bottom-left-radius: 34px;
    border-bottom-right-radius: 34px
}

.kid-hero h1 {
    font-size: clamp(28px, 5vw, 52px);
    margin: 8px 0
}

.kid-hero p {
    max-width: 720px;
    margin: 0 auto;
    color: #e0e7ff;
    font-size: 18px
}

.kid-badge {
    display: inline-block;
    background: #ffffff22;
    border: 1px solid #ffffff55;
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 800
}

.kid-wrap {
    max-width: 980px;
    margin: 22px auto;
    padding: 0 16px
}

.player-card {
    background: white;
    border-radius: 28px;
    padding: 40px 16px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    text-align: center
}

.player-card audio {
    width: min(100%, 520px);
    margin: 8px auto 0
}

.now {
    font-weight: 900;
    font-size: 20px;
    margin: 0 0 12px
}

.player-status {
    color: var(--muted);
    margin: 12px 0 0
}

.kid-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px
}

.story-btn {
    min-height: 150px;
    border: 0;
    border-radius: 28px;
    background: white;
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: left;
    display: grid;
    gap: 8px;
    cursor: pointer
}

.story-btn:focus-visible, .story-btn-selected {
    outline: 3px solid #2563eb;
    outline-offset: 2px
}

.story-btn span {
    font-size: 34px
}

.story-btn strong {
    font-size: 20px
}

.story-btn small {
    color: var(--muted);
    font-size: 14px
}

.empty {
    grid-column: 1/-1;
    background: white;
    border-radius: 24px;
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow)
}

.admin-link {
    text-align: center;
    margin: 30px;
    color: var(--muted)
}

#installBanner {
    margin: 15px auto;
    max-width: 400px;
}

.install-btn {
    width: 100%;
    background: #ffcf33;
    color: #000;
    border: none;
    padding: 15px;
    border-radius: 20px;
    font-weight: 900;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@media(max-width:700px) {
    .small-form {
        grid-template-columns: 1fr
    }
    .row {
        display: grid
    }
    .top {
        align-items: flex-start;
        flex-direction: column
    }
    .kid-hero {
        padding-top: 26px
    }
    .player-card {
        padding: 20px 10px
    }
}