/* 口试练习 — layout B "Focus" (after Speak / Duolingo): one thing at a time,
   centred, almost no text. A breathing orb is the examiner; the big ring is
   the mic. Loaded after speaking.css, only when this layout is picked. */

/* ---------- Home ---------- */
.sp-ui-b .sp-hero { padding-top: 28px; text-align: center; }
.sp-ui-b .sp-eyebrow,
.sp-ui-b .sp-hero p,
.sp-ui-b .sp-modes legend,
.sp-ui-b .sp-mode-desc,
.sp-ui-b .sp-checklist,
.sp-ui-b .sp-topic label { display: none; }
.sp-ui-b .sp-hero h1 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }

.sp-ui-b .sp-lang-seg {
    position: relative;
    display: flex;
    width: min(320px, 100%);
    margin: 22px auto 0;
    padding: 4px;
    border-radius: 999px;
    background: var(--soft);
}
.sp-ui-b .sp-lang-seg button {
    position: relative;
    z-index: 1;
    flex: 1;
    padding: 9px 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.25s;
}
.sp-ui-b .sp-lang-seg button.is-active { color: var(--ink); }
.sp-ui-b .sp-lang-seg i {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    border-radius: 999px;
    background: var(--surface);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.sp-ui-b .sp-start[data-lang="ms"] .sp-lang-seg i { transform: translateX(100%); }
.sp-ui-b .sp-start[data-lang="en"] fieldset[data-lang="ms"],
.sp-ui-b .sp-start[data-lang="ms"] fieldset[data-lang="en"] { display: none; }

.sp-ui-b .sp-modes { margin-top: 18px; gap: 12px; }
.sp-ui-b .sp-mode {
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 148px;
    border: 0;
    border-radius: 24px;
    background: var(--soft);
    text-align: center;
    transition: background 0.25s, color 0.25s, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.sp-ui-b .sp-mode .sp-mode-tag { align-self: center; }
.sp-ui-b .sp-mode strong { font-size: 18px; }
.sp-ui-b .sp-mode-time { margin: 0; padding: 0; }
.sp-ui-b .sp-mode:hover { background: #efece7; }
.sp-ui-b .sp-mode:has(input:checked) { background: var(--ink); color: #fff; transform: scale(1.03); }
.sp-ui-b .sp-mode:has(input:checked) .sp-mode-time { color: rgba(255, 255, 255, 0.65); }
.sp-ui-b .sp-mode.is-soon { background: transparent; border: 1.5px dashed var(--line); }

.sp-ui-b .sp-topic { align-items: center; margin-top: 18px; }
.sp-ui-b .sp-topic select { width: auto; max-width: 100%; min-height: 40px; padding: 0 34px 0 16px; border: 0; border-radius: 999px; background-color: var(--soft); font-size: 14px; font-weight: 600; text-align: center; }

.sp-ui-b .sp-start-btn {
    position: sticky;
    bottom: 16px;
    z-index: 4;
    display: flex;
    width: min(320px, 100%);
    min-height: 56px;
    margin: 28px auto 0;
    font-size: 17px;
    transition: transform 0.2s;
}
.sp-ui-b .sp-start-btn:hover { transform: translateY(-1px); }

.sp-ui-b .sp-history { margin-top: 48px; }
.sp-ui-b .sp-history h2 { color: var(--muted); font-size: 13px; font-weight: 600; }
.sp-ui-b .sp-history-row { border-top: 0; border-radius: 14px; padding: 12px 10px; }

/* ---------- Runner ---------- */

.sp-ui-b .sp-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: min(640px, calc(100dvh - 180px));
    padding: 8px 0 24px;
    border: 0;
    background: transparent;
    text-align: center;
}
/* The runner hides the stage once the last answer is in; keep that winning over display: flex above. */
.sp-ui-b .sp-stage[hidden] { display: none; }
/* No timer / mic bar behind the start screen: it appears once 开始 is tapped (speaking.js adds .is-running).
   visibility, not display, so the layout doesn't shift when it comes in. */
.sp-ui-b .sp-stage:not(.is-running) .sp-answer { visibility: hidden; }
.sp-ui-b .sp-status { width: min(420px, 100%); margin: 0 auto 28px; }

/* The examiner: a breathing orb */
.sp-ui-b .sp-examiner { flex-direction: column; gap: 10px; }
.sp-ui-b .sp-examiner-name { display: none; }
.sp-ui-b .sp-part { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.sp-ui-b .sp-avatar {
    width: 112px;
    height: 112px;
    background:
        radial-gradient(circle at 30% 30%, #f3fbfa 0 12%, transparent 46%),
        conic-gradient(from 0deg, #bfe8e4, #d9d2f6, #fbd3dd, #fff0b8, #bfe8e4);
    color: transparent;
    animation: spb-breathe 5s ease-in-out infinite, spb-spin 18s linear infinite;
}
.sp-ui-b .sp-avatar .material-symbols-outlined { display: none; }
.sp-ui-b .sp-avatar::after { border-color: #9fd8d2; }
.sp-ui-b .sp-examiner[data-state="speaking"] .sp-avatar { animation: spb-talk 0.9s ease-in-out infinite, spb-spin 6s linear infinite; }
.sp-ui-b .sp-examiner .sp-icon-btn { width: 32px; height: 32px; background: transparent; color: var(--muted); }

.sp-ui-b .sp-caption {
    max-width: 560px;
    min-height: 3em;
    margin: 18px auto 0;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: -0.01em;
}

.sp-ui-b .sp-card { width: min(560px, 100%); margin-top: 18px; text-align: left; }

.sp-ui-b .sp-stage:not(.has-card) .sp-answer { margin-top: auto; padding-top: 28px; }
.sp-ui-b .sp-stage:not(.has-card) .sp-ring { width: 176px; height: 176px; transition: transform 0.12s linear; }
.sp-ui-b .sp-ring circle { stroke-width: 5; }
/* The mic glows and swells with your voice while recording. */
.sp-ui-b .sp-ring::before {
    content: "";
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    background: var(--pink-bg);
    opacity: 0;
    transform: scale(calc(1 + var(--lvl, 0) * 0.35));
    transition: opacity 0.3s, transform 0.12s linear;
}
.sp-ui-b .sp-answer[data-state="recording"] .sp-ring::before { opacity: 1; }
.sp-ui-b .sp-answer[data-state="prep"] .sp-ring::before { opacity: 1; background: var(--butter-bg); transform: none; }
.sp-ui-b .sp-ring svg { position: relative; }
.sp-ui-b .sp-ring-center { z-index: 1; }
.sp-ui-b .sp-stage:not(.has-card) .sp-time { font-size: 30px; }
.sp-ui-b .sp-ring-icon { display: block; --icon-size: 34px; font-size: 34px; color: var(--muted); }
.sp-ui-b .sp-answer[data-state="recording"] .sp-ring-icon,
.sp-ui-b .sp-answer[data-state="prep"] .sp-ring-icon { display: none; }
.sp-ui-b .sp-answer:not([data-state="recording"]):not([data-state="prep"]) .sp-time { display: none; }
.sp-ui-b .sp-answer[data-state="listening"] .sp-ring { opacity: 0.45; }
.sp-ui-b .sp-state { font-size: 14px; }
.sp-ui-b .sp-answer[data-state="listening"] .sp-state { color: var(--muted); font-weight: 500; }
.sp-ui-b .sp-hint { font-size: 12.5px; }

/* Start screen: just one big round button. */
.sp-ui-b .sp-gate { background: rgba(255, 255, 255, 0.97); gap: 18px; }
.sp-ui-b .sp-gate p { display: none; }
.sp-ui-b .sp-gate h2 { font-size: 24px; }
.sp-ui-b .sp-gate .sp-btn {
    width: 104px;
    height: 104px;
    padding: 0;
    border-radius: 50%;
    font-size: 15px;
    flex-direction: column;
    gap: 2px;
    animation: spb-breathe 2.6s ease-in-out infinite;
}
.sp-ui-b .sp-gate .sp-btn .material-symbols-outlined { --icon-size: 30px; font-size: 30px; }

.sp-ui-b .sp-scoring { border: 0; padding-top: 80px; }

/* ---------- Report ---------- */
.sp-ui-b .sp-score { grid-template-columns: 1fr; justify-items: center; gap: 22px; padding: 28px 20px; text-align: center; }
.sp-ui-b .sp-score-main { display: grid; justify-items: center; gap: 4px; }
.sp-ui-b .sp-score-ring { display: block; grid-area: 1 / 1; width: 168px; height: 168px; transform: rotate(-90deg); }
.sp-ui-b .sp-score-ring circle { fill: none; stroke-width: 7; }
.sp-ui-b .sp-score-ring-track { stroke: rgba(255, 255, 255, 0.7); }
.sp-ui-b .sp-score-ring-bar { stroke: var(--ink); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 1.3s cubic-bezier(0.22, 1, 0.36, 1); }
.sp-ui-b .sp-score-ring-bar.is-in { stroke-dashoffset: calc(100 - var(--pct)); }
.sp-ui-b .sp-score-num { grid-area: 1 / 1; align-self: center; font-size: 46px; }
.sp-ui-b .sp-score-num small { display: block; margin: -6px 0 0; font-size: 14px; }
.sp-ui-b .sp-score-label { display: none; }
.sp-ui-b .sp-band { align-self: center; }
.sp-ui-b .sp-criteria { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 440px; }
.sp-ui-b .sp-criteria li { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.7); text-align: left; }
.sp-ui-b .sp-crit-name small { display: none; }
.sp-ui-b .sp-crit-name { font-size: 12.5px; color: rgba(31, 29, 26, 0.7); }
.sp-ui-b .sp-crit-val { order: -1; font-size: 22px; text-align: left; }
.sp-ui-b .sp-crit-bar { width: 100%; gap: 2px; }
.sp-ui-b .sp-crit-bar i { flex: 1; width: auto; height: 5px; background: rgba(31, 29, 26, 0.1); }

.sp-ui-b .sp-summary { text-align: center; color: #45413b; }
.sp-ui-b .sp-list.is-good { display: none; }
.sp-ui-b .sp-lists { grid-template-columns: 1fr; }
.sp-ui-b .sp-list { border: 0; background: var(--lilac-bg); }

.sp-ui-b .sp-section-title { text-align: center; color: var(--muted); font-size: 13px; }
.sp-ui-b .sp-turn { padding: 0; border-top: 0; }
.sp-ui-b .sp-turn + .sp-turn { margin-top: 8px; }
.sp-ui-b .sp-turn-fold { border-radius: 18px; background: var(--soft); }
.sp-ui-b .sp-turn-fold > :not(summary) { margin-left: 16px; margin-right: 16px; }
.sp-ui-b .sp-turn-fold[open] { padding-bottom: 16px; }
.sp-ui-b .sp-turn-fold .sp-transcript { background: var(--surface); }
.sp-ui-b .sp-turn-fold .sp-read { background: var(--surface); }

@keyframes spb-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes spb-talk { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.09); } 60% { transform: scale(0.98); } }
@keyframes spb-spin { to { rotate: 360deg; } }

@media (max-width: 720px) {
    .sp-ui-b .sp-hero { padding-top: 12px; }
    .sp-ui-b .sp-hero h1 { font-size: 26px; }
    .sp-ui-b .sp-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sp-ui-b .sp-mode { min-height: 120px; padding: 12px; }
    .sp-ui-b .sp-mode strong { font-size: 16px; }
    .sp-ui-b .sp-start-btn { bottom: calc(var(--dock-h, 0px) + 12px); }
    .sp-ui-b .sp-caption { font-size: 19px; }
    .sp-ui-b .sp-avatar { width: 92px; height: 92px; }
    .sp-ui-b .sp-stage:not(.has-card) .sp-ring { width: 150px; height: 150px; }
}

/* The stage has no padding here, so the sticky bar (card showing) sits flush instead of bleeding out. */
.sp-ui-b .sp-stage.has-card .sp-answer { margin: 16px 0 0; border: 1px solid var(--line); border-radius: 22px; text-align: left; }
@media (max-width: 720px) {
    .sp-ui-b .sp-stage.has-card .sp-answer { margin: 14px 0 0; border-radius: 20px; }
}
