.btn {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    gap: 0.45rem;
    font-weight: 800;
    justify-content: center;
    line-height: 1.2;
    min-height: 3rem;
    padding: 0.85rem 1.25rem;
    text-align: center;
    transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #22d3ee, #6366f1);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.btn-danger {
    background: rgba(244, 63, 94, 0.18);
    color: #fecdd3;
}

.btn-sm {
    font-size: 0.875rem;
    min-height: 2.35rem;
    padding: 0.55rem 0.85rem;
}

.action-bar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.dashboard-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
    min-width: max-content;
}

.nav-link,
.link {
    color: #93c5fd;
    font-weight: 700;
}

.nav-link:hover,
.link:hover {
    color: #bfdbfe;
}

.brand-link {
    flex: 0 0 auto;
}

.top-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

.card {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.82));
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1.6rem;
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.34);
    padding: 1.65rem;
}

.hover-card {
    display: block;
    transition: border 0.15s ease, transform 0.15s ease;
}

.hover-card:hover {
    border-color: rgba(34, 211, 238, 0.55);
    transform: translateY(-2px);
}

.page-head {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.eyebrow {
    color: #67e8f9;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    margin-bottom: 0.45rem;
    text-transform: uppercase;
}

.metric {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 1.25rem;
}

.metric span {
    display: block;
    font-size: 2.5rem;
    font-weight: 900;
}

.metric p {
    color: #94a3b8;
}

.row-card {
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.13);
    border-radius: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.95rem 1rem;
}

.row-card small,
.empty {
    color: #94a3b8;
}

.practice-option {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 1.25rem;
    display: grid;
    gap: 0.35rem;
    padding: 1.1rem;
    transition: border 0.15s ease, transform 0.15s ease;
}

.practice-option:hover {
    border-color: rgba(34, 211, 238, 0.55);
    transform: translateY(-1px);
}

.practice-option span {
    color: #cbd5e1;
    font-weight: 800;
}

.practice-option strong {
    font-size: 2rem;
    line-height: 1;
}

.practice-option small {
    color: #94a3b8;
}

.practice-actions {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pill {
    background: rgba(34, 211, 238, 0.16);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 999px;
    color: #a5f3fc;
    display: inline-flex;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.35rem 0.7rem;
}

.pill.muted {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}

.copy-input {
    background: rgba(2, 6, 23, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    color: #cbd5e1;
    flex: 1;
    min-width: 0;
    min-height: 3rem;
    padding: 0.8rem 1rem;
}

.invite-copy-row {
    min-width: 0;
}

.copy-status {
    color: #67e8f9;
    font-size: 0.8rem;
    min-height: 1.1rem;
}

.copy-status-error {
    color: #fde68a;
}

.form-grid {
    display: grid;
    gap: 1rem;
}

.form-grid p {
    display: grid;
    gap: 0.4rem;
}

.form-grid label {
    color: #e2e8f0;
    font-weight: 800;
}

.form-grid input:not([type="checkbox"]):not([type="radio"]),
.form-grid select,
.form-grid textarea {
    background: rgba(2, 6, 23, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1rem;
    color: white;
    padding: 0.85rem 1rem;
    width: 100%;
}

.form-grid textarea {
    min-height: 9rem;
}

.form-grid input[type="checkbox"],
.form-grid input[type="radio"] {
    margin-right: 0.45rem;
}

.form-grid .helptext,
.form-grid ul {
    color: #94a3b8;
    font-size: 0.875rem;
}

.form-grid .errorlist {
    color: #fca5a5;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 0.25rem;
}

.color-field {
    display: grid;
    gap: 0.7rem;
}

.color-field-label {
    color: #e2e8f0;
    font-weight: 800;
}

.color-palette {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.color-choice {
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 1rem;
    cursor: pointer;
    display: flex;
    gap: 0.7rem;
    min-width: 0;
    padding: 0.8rem 0.9rem;
    transition: border 0.15s ease, transform 0.15s ease;
}

.color-choice span:last-child {
    font-size: 0.95rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.color-choice:hover {
    transform: translateY(-1px);
}

.color-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.color-choice:has(input:checked) {
    border-color: var(--group-color);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--group-color), transparent 40%);
}

.color-swatch,
.group-dot {
    background: var(--group-color);
    border-radius: 999px;
    box-shadow: 0 0 22px color-mix(in srgb, var(--group-color), transparent 45%);
    display: inline-flex;
    flex: 0 0 auto;
}

.color-swatch {
    height: 1.25rem;
    width: 1.25rem;
}

.group-dot {
    height: 0.75rem;
    width: 0.75rem;
}

.group-card {
    border-color: color-mix(in srgb, var(--group-color), transparent 68%);
}

.group-title {
    align-items: center;
    display: flex;
    font-size: 2.25rem;
    font-weight: 900;
    gap: 0.75rem;
}

.group-accent-cyan {
    --group-color: #22d3ee;
}

.group-accent-blue {
    --group-color: #60a5fa;
}

.group-accent-violet {
    --group-color: #8b5cf6;
}

.group-accent-emerald {
    --group-color: #34d399;
}

.group-accent-amber {
    --group-color: #f59e0b;
}

.group-accent-rose {
    --group-color: #fb7185;
}

.group-accent-orange {
    --group-color: #f97316;
}

.group-accent-lime {
    --group-color: #84cc16;
}

.card-image-frame,
.study-image-frame {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.8)),
        radial-gradient(circle at top, rgba(34, 211, 238, 0.12), transparent 45%);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 1.25rem;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.card-image-frame {
    height: 12rem;
    margin-bottom: 1rem;
    padding: 0.6rem;
}

.card-image-frame img,
.study-image-frame img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.study-image-frame {
    height: min(18rem, 42vh);
    margin-bottom: 1.25rem;
    max-width: 100%;
    padding: 0.75rem;
    width: min(100%, 36rem);
}

.study-card {
    cursor: pointer;
    min-height: 28rem;
    perspective: 1400px;
}

.study-card-inner {
    min-height: 28rem;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.45s ease;
}

.study-card.flipped .study-card-inner {
    transform: rotateY(180deg);
}

.study-face {
    align-items: center;
    backface-visibility: hidden;
    background: radial-gradient(circle at top, rgba(34, 211, 238, 0.18), rgba(15, 23, 42, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 2rem;
    display: flex;
    flex-direction: column;
    inset: 0;
    justify-content: center;
    padding: 2rem;
    position: absolute;
    text-align: center;
}

.study-back {
    background: radial-gradient(circle at top, rgba(99, 102, 241, 0.22), rgba(15, 23, 42, 0.98));
    transform: rotateY(180deg);
}

@media (max-width: 900px) {
    .app-header-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.8rem;
    }

    .top-nav {
        justify-content: flex-start;
        width: 100%;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .action-bar {
        align-items: stretch;
        width: 100%;
    }

    .action-bar .btn {
        flex: 1 1 auto;
    }

    .invite-copy-row {
        flex-direction: column;
    }

    .invite-copy-row .btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .main-shell {
        padding-block: 1.25rem;
    }

    .btn {
        min-height: 2.85rem;
        padding-inline: 1rem;
    }

    .action-bar,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-actions {
        min-width: 0;
    }

    .action-bar .btn,
    .form-actions .btn {
        width: 100%;
    }

    .practice-actions {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1.2rem;
    }

    .page-head h1,
    .group-title {
        font-size: 2rem;
        line-height: 1.1;
    }

    .metric span {
        font-size: 2rem;
    }

    .row-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid textarea {
        min-height: 7rem;
    }

    .study-card,
    .study-card-inner {
        min-height: 24rem;
    }

    .study-face {
        padding: 1.2rem;
    }

    .study-face h2 {
        font-size: 2rem;
        line-height: 1.15;
    }

    .study-image-frame {
        height: min(14rem, 34vh);
    }
}
