:root {
    font-family: system-ui, sans-serif;
    color: #153b35;
    background: #faf9f5;
    color-scheme: light;
}

body {
    margin: 0;
    line-height: 1.6;
}

/* A readable column; workspace actions and feedback stay in normal document flow. */
main {
    max-width: 42rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
}

h1 {
    font-size: clamp(2.25rem, 7vw, 3.25rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
    margin: 0.5rem 0;
}

/* FocusOnNavigate in Routes.razor focuses the heading for screen readers; it needs no visible ring. */
h1:focus {
    outline: none;
}

h2 {
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
}

.eyebrow {
    margin: 0;
    font-size: 0.9rem;
    color: #52685f;
}

.notice {
    padding: 0.5rem 0.75rem;
    border-left: 4px solid #c5903f;
    background: #f3ecdf;
}

section {
    padding: 1rem 0;
    border-top: 1px solid #d9d5c7;
}

textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font: inherit;
    color: inherit;
    border: 1px solid #8a9a92;
    border-radius: 0.5rem;
    background: #fff;
    resize: vertical;
}

button {
    padding: 0.5rem 1rem;
    font: inherit;
    color: #19655b;
    border: 1px solid #19655b;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
}

button:hover {
    background: #e6f0ec;
}

a {
    color: #19655b;
}

/* The shell: the brand and the account controls above one narrow column, outside the training workspace. */
.app-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    max-width: 42rem;
    margin: 0 auto;
    padding: 0.75rem 1rem 0;
}

.app-bar nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.app-bar .brand {
    font-weight: 600;
    text-decoration: none;
}

/* A long email wraps instead of widening the page on a phone. */
.app-bar nav {
    min-width: 0;
}

.app-bar nav a {
    overflow-wrap: anywhere;
}

.loading {
    color: #52685f;
}

main.account {
    padding-bottom: 2rem;
}

.account-form {
    display: grid;
    gap: 0.4rem;
    max-width: 24rem;
    margin: 1rem 0;
}

.account-form input[type="email"],
.account-form input[type="password"] {
    box-sizing: border-box;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font: inherit;
    color: inherit;
    border: 1px solid #8a9a92;
    border-radius: 0.5rem;
    background: #fff;
}

.account-form .checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.account-form button {
    justify-self: start;
    margin-top: 0.5rem;
}

.account-form input:focus-visible {
    outline: 3px solid #c5903f;
    outline-offset: 2px;
}

.validation-errors,
.validation-message,
.alert-error {
    color: #9b2c2c;
}

.alert {
    padding: 0.5rem 0.75rem;
    border-left: 4px solid currentColor;
}

.alert-success {
    color: #19655b;
    background: #e6f0ec;
}

.alert-error {
    background: #f7e6e4;
}

.hint {
    font-size: 0.9rem;
    color: #52685f;
}

a:focus-visible {
    outline: 3px solid #c5903f;
    outline-offset: 4px;
}

button:focus-visible,
textarea:focus-visible {
    outline: 3px solid #c5903f;
    outline-offset: 2px;
}

/* Progressive workspace. Keep these styles local so account forms retain their layout. */
.workspace {
    overflow-wrap: anywhere;
}

.workspace-header {
    margin-bottom: 1.25rem;
}

.workspace-header h1 {
    font-size: clamp(2rem, 7vw, 2.75rem);
}

.workspace .demo-notice {
    margin: 0.65rem 0 0;
    padding: 0.55rem 0.75rem;
    border-radius: 0.65rem;
    background: #f1ecdf;
    color: #66532c;
    font-size: 0.8rem;
    line-height: 1.45;
}

.workspace section {
    padding: 0;
    border: 0;
}

.workspace h2 {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
    line-height: 1.4;
}

.workspace label,
.workspace .field-hint,
.workspace .source-context {
    display: block;
    margin: 0 0 0.5rem;
    color: #52685f;
    font-size: 0.9rem;
}

.workspace textarea {
    display: block;
    min-height: 6.5rem;
    padding: 0.85rem 1rem;
    border-color: #b7c8be;
    border-radius: 0.9rem;
    font-size: 1rem;
    line-height: 1.6;
}

.workspace .field-hint {
    margin-top: 0.5rem;
}

.workspace button,
.workspace summary {
    box-sizing: border-box;
    min-height: 44px;
    max-width: 100%;
    font: inherit;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.workspace button {
    padding: 0.7rem 0.9rem;
    border-radius: 0.8rem;
}

.workspace button:disabled {
    color: #68716c;
    background: #e8ebe6;
    border-color: #cbd2ca;
    cursor: default;
}

.workspace .primary-action {
    display: block;
    width: 100%;
    min-height: 3rem;
    color: #fff;
    background: #19655b;
    border: 1px solid #19655b;
    font-weight: 600;
}

.workspace .primary-action:hover:not(:disabled) {
    background: #104d45;
}

.workspace .primary-action:disabled {
    color: #59685d;
    background: #dce4dc;
    border-color: #dce4dc;
}

.workspace .recording-action {
    background: #93412f;
    border-color: #93412f;
}

.workspace .recording-action:hover:not(:disabled) {
    background: #783424;
}

.workspace .secondary-action {
    color: #19655b;
    border-color: #b7c8be;
    background: #fff;
}

.workspace .text-action {
    color: #19655b;
    background: transparent;
    border-color: transparent;
    padding-inline: 0;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.workspace .editor-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin-top: 0.75rem;
}

.workspace .phrase-editor > .primary-action {
    margin-top: 0.75rem;
}

.workspace .phrase-editor > .text-action {
    margin-top: 0.35rem;
}

.workspace .translation-result {
    margin-top: 1rem;
    padding: 1.1rem;
    background: #eaf1eb;
    border-radius: 1rem;
}

.workspace .section-caption {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
}

.workspace .section-caption h2 {
    margin: 0;
    font-size: 1rem;
}

.workspace .demo-label {
    color: #52685f;
    font-size: 0.75rem;
}

.workspace .translated-phrase,
.workspace .practice-reference {
    margin: 0.75rem 0 1rem;
    font-size: clamp(1.65rem, 6vw, 2.25rem);
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.workspace .translation-result > .primary-action {
    margin-top: 0.75rem;
}

.workspace.is-practicing .workspace-header {
    margin-bottom: 0.25rem;
}

.workspace .practice-topline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 0.5rem;
    margin-bottom: 0.4rem;
}

.workspace .practice-topline h2 {
    margin: 0;
    font-size: 0.9rem;
    color: #52685f;
    font-weight: 500;
}

.workspace .playback-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.workspace .practice-prompt {
    margin: 1rem 0;
    color: #52685f;
}

.workspace .practice-feedback {
    margin-top: 0.8rem;
    padding: 0.8rem 1rem;
    background: #eaf1eb;
    border-radius: 0.9rem;
}

.workspace .practice-feedback h3 {
    margin: 0;
    font-size: 1rem;
}

.workspace .practice-feedback p {
    margin: 0.3rem 0;
    font-size: 0.9rem;
    line-height: 1.45;
}

.workspace summary {
    padding-block: 0.65rem;
    color: #19655b;
    cursor: pointer;
}

.workspace .workspace-status {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #52685f;
}

.workspace .workspace-status:not(:empty) {
    margin-block: 0.65rem;
}

.workspace .practice-action {
    padding-top: 0.6rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

@media (max-width: 30rem) {
    .app-bar {
        gap: 0.35rem;
    }

    .app-bar nav {
        gap: 0.3rem;
    }

    .app-bar nav a {
        max-width: 5.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-bar button {
        min-height: 44px;
        padding: 0.4rem 0.6rem;
    }

    main {
        padding-top: 1rem;
    }
}
