/* ═══════════════════════════════════════════════
   Diktat App — Play / Student Styles
   ═══════════════════════════════════════════════ */

/* ── Audio Button ── */
.btn-audio {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--color-primary);
    color: #fff;
    border: none;
    cursor: pointer;
}
.btn-audio:hover {
    background: var(--color-primary-hover);
}
.btn-audio:disabled {
    opacity: .6;
    cursor: wait;
}

.btn-audio .lucide {
    width: 14px;
    height: 14px;
}
.diktat-sentence .btn-audio {
    align-self: center;
}

/* ── Diktat Play ── */
.diktat-play {
    padding: 1rem 0 2rem;
}

.diktat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
}
.diktat-header h1 {
    font-size: 1.5rem;
}
.diktat-header-right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ── Layout Toggle ── */
.layout-toggle {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.btn-layout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: var(--color-surface);
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: background .15s, color .15s;
}
.btn-layout:hover {
    background: var(--color-background);
}
.btn-layout.active {
    background: var(--color-primary);
    color: #fff;
}
.btn-layout + .btn-layout {
    border-left: 1px solid var(--color-border);
}
.btn-layout .lucide {
    width: 16px;
    height: 16px;
}

.diktat-progress {
    background: var(--color-surface);
    padding: .4rem .8rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    font-size: .875rem;
    font-weight: 500;
}

.audio-notice {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    font-size: .875rem;
}

.diktat-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    font-size: 1.05rem;
    line-height: 2.2;
}

.diktat-sentence {
    margin-bottom: .5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px;
}

/* ── Inline (flowing) Layout ── */
.layout-inline {
    line-height: 2.6;
}
.layout-inline .diktat-sentence {
    display: inline;
    margin-bottom: 0;
}
.layout-inline .diktat-sentence:not(:has(.btn-audio)) {
    margin-right: .35em;
}
.layout-inline .diktat-sentence span {
    vertical-align: baseline;
}
.layout-inline .diktat-sentence .btn-audio {
    vertical-align: middle;
    margin-right: 2px;
    margin-left: 6px;
    position: relative;
    top: -2px;
}
.layout-inline .diktat-sentence:first-child .btn-audio {
    margin-left: 0;
}
.layout-inline .diktat-gap {
    vertical-align: baseline;
}

.diktat-gap {
    border: 2px solid var(--color-primary);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 1rem;
    font-family: var(--font);
    background: #eff6ff;
    outline: none;
    transition: border-color .15s;
    min-width: 80px;
}
.diktat-gap:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
    background: #fff;
}

.answer-correct {
    background: #dcfce7 !important;
    border-color: var(--color-success) !important;
}
.answer-wrong {
    background: #fef2f2 !important;
    border-color: var(--color-danger) !important;
}
.correction {
    font-size: .75rem;
    color: var(--color-success);
    font-weight: 600;
    margin-left: 2px;
}

/* ── Submit Section ── */
.diktat-submit {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.submit-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 1rem;
}
.submit-form .form-group {
    margin-bottom: 0;
    flex: 0 1 300px;
    min-width: 200px;
    position: relative;
    padding-bottom: 1.2rem;
}
.submit-form .btn {
    margin-bottom: 1.2rem;
    padding-top: .5rem;
    padding-bottom: .5rem;
    font-size: 1rem;
}
.submit-form label {
    font-weight: 500;
    font-size: .875rem;
}
.input-name {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
}
.input-name.input-error {
    border-color: var(--color-danger);
}
.field-error {
    position: absolute;
    bottom: 0;
    left: 0;
    color: var(--color-danger);
    font-size: .8rem;
}

/* ── Results ── */
.diktat-results {
    margin-top: 2rem;
    text-align: center;
    padding: 2rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
.diktat-results h2 {
    margin-bottom: 1rem;
}

.result-summary {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}
.result-stat {
    text-align: center;
}
.result-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}
.result-label {
    font-size: .8rem;
    color: var(--color-text-muted);
}
.result-correct .result-number { color: var(--color-success); }
.result-wrong .result-number { color: var(--color-danger); }

/* ── Responsive ── */
@media (max-width: 640px) {
    .result-summary { gap: 1rem; }
    .submit-form { flex-direction: column; align-items: stretch; }
    .submit-form .form-group { flex: none; min-width: 0; width: 100%; padding-bottom: 0; }
    .submit-form .btn { width: 100%; margin-bottom: 0; }
}
