/* home.css
   Home dashboard, saved words, classes, owner page, help and FAQ.
   Part of the old features.css, split in load order: see index.html. */

/* ==========================================
   HOME (personal dashboard)
   ========================================== */

.home-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 22px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.home-kicker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.home-greeting {
    margin: 6px 0 6px;
    font-size: 40px;
    letter-spacing: -0.02em;
}

.home-sub {
    color: var(--ink-2);
    font-size: 16px;
}

.home-voice-left {
    color: var(--muted);
}

.home-actions {
    display: flex;
    gap: 10px;
}

.home-go {
    padding: 12px 22px;
    cursor: pointer;
}

.home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 16px;
}

.home-card {
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.home-card h3 {
    margin: 0;
    font-size: 17px;
}

.home-card > h3 {
    margin-bottom: 8px;
}

.home-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.home-today-count {
    color: var(--success-ink);
    font-size: 13px;
    font-weight: bold;
}

.home-today-bar {
    height: 6px;
    margin-bottom: 8px;
    border-radius: 6px;
    background: var(--surface-2);
    overflow: hidden;
}

#home-today-fill {
    height: 100%;
    width: 0;
    border-radius: 6px;
    background: var(--success);
    transition: width 0.4s;
}

.home-plan {
    margin: 0;
    padding: 0;
    list-style: none;
}

.home-plan-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.home-plan-item:last-child {
    border-bottom: none;
}

.home-plan-check {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid var(--line-strong);
    border-radius: 50%;
    color: var(--ink);
    font-size: 13px;
    font-weight: bold;
}

.home-plan-item.is-done .home-plan-check {
    border-color: var(--success);
    background: var(--success);
}

.home-plan-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
}

.home-plan-title {
    font-weight: bold;
}

.home-plan-item.is-done .home-plan-title {
    color: var(--muted);
}

.home-plan-note {
    color: var(--muted);
    font-size: 13px;
}

.home-plan-item .convo-go {
    padding: 7px 14px;
    font-size: 13px;
}

.home-bars {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    height: 120px;
    margin-bottom: 14px;
}

.home-bar {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}

.home-bar-fill {
    width: 100%;
    max-width: 30px;
    border-radius: 6px 6px 3px 3px;
    background: var(--surface-2);
}

.home-bar.is-today .home-bar-fill {
    background: var(--primary);
}

.home-bar-day {
    color: var(--muted);
    font-size: 12px;
}

.home-numbers {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    text-align: center;
}

.home-numbers b {
    display: block;
    font-size: 24px;
}

.home-numbers span {
    color: var(--muted);
    font-size: 12px;
}

.home-word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.home-word {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--ink);
    text-decoration: none;
}

.home-word:hover {
    border-color: var(--primary);
}

.home-word span {
    color: var(--muted);
    font-size: 12px;
}

.home-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.home-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--ink);
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
}

.home-link:hover {
    border-color: var(--primary);
}

.home-link > span:first-child {
    font-size: 22px;
}

/* ---- saving words ---- */

.word-tip {
    margin: -6px 0 10px;
    color: var(--muted);
    font-size: 12px;
}

.transcript-message .original-text,
.write-message .write-text {
    cursor: pointer;
}

.word-pop {
    position: fixed;
    z-index: 950;
    width: 240px;
    padding: 14px 16px;
    border: 1px solid var(--primary);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    color: var(--ink);
}

.word-pop-word {
    font-size: 18px;
    font-weight: bold;
}

.word-pop-meaning {
    margin-top: 4px;
    color: var(--ink-2);
    font-size: 14px;
}

.word-pop-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.word-pop-actions .convo-go {
    padding: 6px 12px;
    font-size: 13px;
}

/* ---- saved words page ---- */

.words-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.word-search {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.word-search input {
    flex: 1;
    min-width: 0;
}

.word-search-result {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.word-search-result span {
    flex: 1 1 160px;
    color: var(--ink-2);
}

.words-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.word-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.word-card.is-due {
    border-left: 3px solid var(--warning);
}

.word-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.word-card-word {
    font-size: 17px;
}

.word-card-remove {
    border: none;
    background: none;
    color: var(--muted);
    font-size: 20px;
    cursor: pointer;
}

.word-card-remove:hover {
    color: var(--danger-ink);
}

.word-card-meaning {
    color: var(--ink-2);
}

.word-card-note {
    color: var(--muted);
    font-size: 12px;
}

.word-card-context {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    font-style: italic;
}

.words-cards {
    max-width: 560px;
    margin-bottom: 20px;
}

.word-flash {
    padding: 30px 26px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    text-align: center;
}

.word-flash-word {
    font-size: 34px;
    font-weight: bold;
}

.word-flash-context {
    margin-top: 8px;
    color: var(--muted);
    font-style: italic;
}

.word-flash-meaning {
    margin-top: 18px;
    color: var(--success-ink);
    font-size: 22px;
    font-weight: bold;
}

.word-flash-note {
    color: var(--muted);
}

.word-flash .convo-actions {
    margin-top: 22px;
}

/* ---- classes ---- */

.classes-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.class-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 6px;
}

.class-form input,
.class-form select {
    flex: 1;
    min-width: 120px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--ink);
    font-family: inherit;
    font-size: 14px;
}

#join-code {
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.class-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.class-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface-2);
}

.class-row-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.class-row-text .settings-help {
    margin: 0;
}

.class-code-inline {
    color: var(--warning-ink);
    font-weight: bold;
    letter-spacing: 0.1em;
}

.class-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 18px;
}

.class-head h2 {
    margin-bottom: 2px;
}

.class-code-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1px dashed var(--warning);
    border-radius: 12px;
}

.class-code-box .settings-help {
    margin: 0;
}

#class-code {
    color: var(--warning-ink);
    font-size: 24px;
    letter-spacing: 0.18em;
}

.table-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    color: var(--muted);
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--surface);
}

.data-table tr.is-quiet td:first-child::after {
    content: " ·";
    color: var(--danger-ink);
}

.class-topics {
    margin-bottom: 18px;
}

.class-topic-list {
    display: grid;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.class-topic {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--surface-2);
}

.class-topic .settings-help {
    margin: 0;
}

/* ---- owner ---- */

.owner-cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.owner-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.owner-card-value {
    font-size: 24px;
}

.owner-card-label {
    color: var(--muted);
    font-size: 13px;
}

.owner-card-note {
    color: var(--success-ink);
    font-size: 13px;
    font-weight: bold;
}

.owner-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 160px;
}

.owner-bar {
    display: flex;
    flex: 1;
    align-items: flex-end;
    height: 100%;
}

.owner-bar-fill {
    width: 100%;
    border-radius: 4px 4px 2px 2px;
    background: var(--primary);
}

.owner-bar[data-tip] {
    cursor: default;
}

.owner-bar:hover .owner-bar-fill,
.owner-bar:hover .owner-stack-fill {
    filter: brightness(1.25);
}

#view-owner > .home-card {
    margin-bottom: 16px;
}

.owner-accounts-search {
    width: 100%;
    max-width: 360px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

.owner-accounts-wrap {
    max-height: 480px;
    overflow-y: auto;
}

.owner-accounts-wrap th {
    position: sticky;
    top: 0;
}

.owner-list {
    display: grid;
    gap: 8px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.owner-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--surface-2);
}

.accent-row {
    margin-top: 16px;
}

.accent-row .auth-error:empty {
    display: none;
}

@media (max-width: 1100px) {
    .home-grid,
    .classes-grid {
        grid-template-columns: 1fr;
    }

    .owner-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .home-greeting {
        font-size: 30px;
    }

    .home-actions,
    .home-go {
        width: 100%;
    }

    .home-go {
        text-align: center;
    }

    .home-links {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- Need help? ---- */

.help-link {
    display: inline-block;
    padding: 6px 10px;
    border: none;
    background: none;
    color: var(--primary-ink);
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

.help-link::before {
    content: "?";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    font-size: 11px;
}

.help-link:hover {
    color: var(--ink);
}

#view-speak .help-link {
    margin: -14px 0 18px;
}

.help-link-head {
    margin-left: auto;
}

.help-card {
    width: min(560px, 100%);
}

.help-card .about-mode-head h3 {
    margin: 0;
    padding-right: 30px;
}

.help-card .about-steps {
    margin-bottom: 14px;
}

/* ---- FAQ (About) ---- */

.faq {
    display: grid;
    gap: 8px;
    margin-bottom: 28px;
}

.faq-item {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    font-weight: bold;
    cursor: pointer;
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    color: var(--primary-ink);
    font-size: 20px;
    line-height: 1;
}

.faq-item[open] summary::after {
    content: "−";
}

.faq-item[open] {
    border-color: var(--primary);
}

.faq-item p {
    padding: 0 18px 16px;
    color: var(--ink-2);
    line-height: 1.55;
}

/* ---- classes on the profile page ---- */

.profile-classes .class-form {
    max-width: 420px;
}

.classes-single {
    grid-template-columns: minmax(0, 640px);
}

/* ---- hovering a word in a conversation ---- */

::highlight(word-hover) {
    background-color: rgba(18, 124, 181, 0.45);
    color: var(--ink);
}

.word-hover-tip,
.owner-bar-tip {
    position: fixed;
    z-index: 940;
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-width: 240px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    color: var(--ink-2);
    font-size: 13px;
    pointer-events: none;
}

.word-hover-tip b,
.owner-bar-tip b {
    color: var(--primary-ink);
    font-size: 12px;
}

.owner-bar-tip {
    white-space: nowrap;
    max-width: none;
}

/* ---- welcome page: who it's for ---- */

.audience-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 22px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.audience-tab {
    padding: 10px 18px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

.audience-tab:hover {
    color: var(--ink);
}

.audience-tab.active {
    background: var(--primary);
    color: var(--on-color);
}

.audience-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 36px;
    align-items: start;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(150deg, var(--surface), var(--surface) 65%);
}

.audience-panel.is-hidden {
    display: none;
}

.audience-copy h3 {
    margin: 0 0 12px;
    font-size: 26px;
    line-height: 1.25;
}

.audience-copy p {
    margin-bottom: 22px;
    color: var(--ink-2);
    font-size: 16px;
    line-height: 1.6;
}

.audience-copy .landing-primary {
    border: none;
    font-family: inherit;
    cursor: pointer;
}

.audience-points {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.audience-points li {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-left: 16px;
    border-left: 3px solid var(--success);
}

.audience-points span {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

/* ---- teach a class (profile) ---- */

.profile-teach {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px dashed var(--success);
    border-radius: 12px;
}

.profile-teach .settings-help {
    margin: 2px 0 0;
}

@media (max-width: 800px) {
    .audience-panel {
        grid-template-columns: 1fr;
        gap: 22px;
        padding: 20px;
    }

    .audience-tabs {
        display: flex;
    }

    .audience-tab {
        flex: 1;
        padding: 10px 8px;
        font-size: 13px;
    }
}


/* Word tips: "hover" with a mouse, "tap" on touch screens */
.word-tip-touch { display: none; }

@media (hover: none) and (pointer: coarse) {
    .word-tip-mouse { display: none; }
    .word-tip-touch { display: block; }
}

/* Home: today's minutes against the daily goal */
.home-goal {
    display: flex;
    align-items: center;
    gap: 14px;
}

.home-goal:empty {
    display: none;
}

.goal-ring {
    --share: 0;
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    flex: none;
    border-radius: 50%;
    background: conic-gradient(var(--primary) calc(var(--share) * 360deg), var(--track) 0);
}

.goal-ring.is-reached {
    background: conic-gradient(var(--success) 360deg, var(--track) 0);
}

.goal-ring-inner {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bg);
    line-height: 1.05;
    text-align: center;
}

.goal-ring-inner b {
    font-size: 20px;
}

.goal-ring-inner span {
    font-size: 10.5px;
    color: var(--muted);
}

.goal-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.goal-choices {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.goal-choice {
    padding: 5px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.goal-choice:hover {
    border-color: var(--primary);
}

.home-freezes {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-ink);
}

.goal-note {
    max-width: 300px;
    margin-top: 4px;
    font-size: 12px;
}

/* Help: the questions grouped by topic */
.faq-group {
    margin: 18px 0 4px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--primary-ink);
}

.faq-group:first-child {
    margin-top: 0;
}
