/* Black and white personal workspace. Width and height both drive spacing. */
.neath-me-page {
    --me-ink: #111111;
    --me-muted: #737373;
    --me-line: #e8e8e8;
    --me-paper: #ffffff;
    --me-wash: #f7f7f7;
    --me-accent: #111111;
    --me-space: clamp(24px, 5.5vh, 64px);
    margin: 0;
    color: var(--me-ink);
    background: var(--me-paper);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}
.neath-me-page * { box-sizing: border-box; }
.neath-me-page .hidden { display: none !important; }
.neath-me-page :where(h1, h2, h3, p, dl, dd) { margin: 0; }
.neath-me-page :where(button, a, input, summary):focus-visible { outline: 2px solid var(--me-ink); outline-offset: 4px; }
.neath-me-page button { cursor: pointer; }
.neath-me-page button:disabled { cursor: wait; opacity: .5; }
.neath-me-page ::selection { background: #111111; color: #ffffff; }
.neath-me-page .neath-app-topbar__account-id { display: none; }
.me-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.me-shell { display: flex; flex-direction: column; min-height: calc(100svh - var(--neath-app-topbar-height)); width: 100%; padding: 0 clamp(20px, 5vw, 96px); }
.me-status { padding: 16px 0; color: var(--me-muted); font-size: 13px; }
.me-eyebrow { color: var(--me-muted); font-size: 12px; line-height: 1.5; }
.me-profile { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .7fr); gap: 32px; align-items: center; padding: var(--me-space) 0; border-bottom: 1px solid var(--me-line); }
.me-identity { display: flex; align-items: center; min-width: 0; gap: 20px; }
.me-avatar { display: grid; place-items: center; width: 64px; height: 64px; flex: 0 0 auto; background: #111111; color: #ffffff; border-radius: 50%; font-size: 28px; font-weight: 400; }
.me-identity-copy { flex: 1; min-width: 0; }
.me-name-row { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 4px; margin-top: 3px; }
.me-name-row h1 { min-width: 0; max-width: 100%; overflow-wrap: anywhere; font-size: clamp(23px, 2.3vw, 32px); line-height: 1.3; font-weight: 500; letter-spacing: -.04em; }
.me-edit { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border: 0; border-radius: 50%; background: transparent; color: var(--me-muted); }
.me-edit:hover { color: var(--me-ink); background: var(--me-wash); }
.me-edit svg { width: 15px; height: 15px; }
#membership-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 8px; border: 1px solid #e1e1e1; border-radius: 5px; font-size: 10px; line-height: 1.4; font-weight: 500; letter-spacing: 0; }
.membership-mix { background: #111111; color: #ffffff; }
.membership-ciling, .membership-normal { background: #f5f5f5; color: #555555; }
.me-membership { min-width: 0; color: var(--me-muted); text-align: right; font-size: 12px; line-height: 1.8; }
.me-upgrade { display: inline-flex; align-items: center; min-height: 32px; color: var(--me-ink); text-underline-offset: 4px; }
.me-upgrade:hover { text-decoration: underline; }
.me-account { margin-top: 4px; }
.me-account summary { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; list-style: none; color: var(--me-muted); cursor: pointer; }
.me-account summary::-webkit-details-marker { display: none; }
.me-account summary::after { content: '+'; font-size: 15px; }
.me-account[open] summary::after { content: '−'; }
.me-account-id { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
.me-nickname-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.me-input { flex: 1 1 150px; width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid #b5b5b5; border-radius: 8px; background: #ffffff; font-size: 15px; }
.me-field-error { width: 100%; font-size: 12px; color: #111111; }
.me-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 22px; border: 1px solid #111111; border-radius: 999px; background: #111111; color: #ffffff; font-size: 13px; font-weight: 500; line-height: 1.5; text-decoration: none; }
.me-button:hover { background: #333333; }
.me-button-secondary { background: #ffffff; border-color: #d5d5d5; color: #111111; }
.me-button-secondary:hover { background: #f5f5f5; }
.me-statistics { padding: var(--me-space) 0; border-bottom: 1px solid var(--me-line); }
.me-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: clamp(20px, 3.5vh, 40px); }
.me-section-heading h2, .me-vocab-heading h2 { font-size: 14px; font-weight: 500; line-height: 1.5; }
.me-text-link { display: inline-flex; align-items: center; gap: 12px; min-height: 30px; font-size: 12px; color: var(--me-muted); text-decoration: none; }
.me-text-link:hover { color: var(--me-ink); text-decoration: underline; text-underline-offset: 4px; }
.me-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: clamp(16px, 4vw, 64px); row-gap: 24px; }
.me-metrics dt { color: var(--me-muted); font-size: 12px; line-height: 1.5; }
.me-metrics dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-top: 12px; }
.me-metrics dd > span:first-child { min-width: 0; font-family: "Helvetica Neue", Arial, sans-serif; font-size: clamp(32px, 3.5vw, 52px); font-weight: 400; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.055em; overflow-wrap: anywhere; }
.me-unit { color: var(--me-muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.me-vocab { display: grid; flex: 1 0 auto; grid-template-columns: minmax(160px, .8fr) minmax(0, 3fr); grid-template-areas: 'heading data' 'actions data'; align-content: center; align-items: center; column-gap: clamp(32px, 5vw, 96px); row-gap: 20px; padding: var(--me-space) 0; }
.me-vocab-heading { grid-area: heading; align-self: end; }
.me-vocab-heading .me-small-note { margin-top: 7px; }
.me-vocab-data { grid-area: data; display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 1.6fr); gap: clamp(24px, 4vw, 72px); align-items: center; min-width: 0; }
.me-vocab-score, .me-vocab-record { min-width: 0; }
.me-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.me-number { min-width: 0; font-family: "Helvetica Neue", Arial, sans-serif; font-size: clamp(40px, 4vw, 64px); line-height: 1.1; font-weight: 400; letter-spacing: -.055em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.me-percentile { color: var(--me-muted); font-size: 12px; line-height: 1.8; margin-top: 12px !important; }
.me-vocab-details { display: grid; grid-template-columns: .8fr .8fr 1.4fr; gap: 16px; }
.me-vocab-details dt { color: var(--me-muted); font-size: 12px; line-height: 1.6; }
.me-vocab-details dd { margin-top: 10px; font-size: 17px; line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.me-small-note { color: var(--me-muted); font-size: 11px; line-height: 1.85; }
#vocab-average-note { margin-top: 20px; }
.me-vocab-actions { grid-area: actions; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; align-self: start; }
.me-vocab-actions .me-small-note { width: 100%; }
.me-vocab-empty { grid-area: data; min-width: 0; }
.me-vocab-empty h3 { font-size: 24px; line-height: 1.5; font-weight: 400; letter-spacing: -.03em; }
.me-description { margin-top: 12px !important; color: var(--me-muted); font-size: 13px; line-height: 1.85; }
.me-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; border-top: 1px solid var(--me-line); padding: 14px 0; }
.me-feedback { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; color: var(--me-muted); font-size: 12px; text-decoration: none; }
.me-feedback:hover { color: var(--me-ink); }
.me-record { color: var(--me-muted); font-size: 10px; text-decoration: none; }
.me-record:hover { text-decoration: underline; }
/* A native modal keeps focus inside the test and makes the background inert. */
.me-dialog-open { overflow: hidden; }
.me-dialog { width: min(580px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--me-line); border-radius: 20px; color: var(--me-ink); background: var(--me-paper); box-shadow: 0 24px 100px #00000026; }
.me-dialog::backdrop { background: #00000070; }
.me-dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 24px 28px; border-bottom: 1px solid var(--me-line); }
.me-dialog-header h2 { margin-top: 8px; font-size: 17px; line-height: 1.5; font-weight: 500; }
.me-dialog-close { display: grid; place-items: center; min-width: 40px; height: 40px; border: 0; border-radius: 9px; background: var(--me-wash); color: var(--me-muted); font-size: 24px; line-height: 1; }
.me-dialog-close:hover { background: #eeeeee; }
.me-dialog-state { padding: 48px 28px; text-align: center; }
.me-dialog-state p { margin: 20px 0; color: var(--me-muted); font-size: 13px; line-height: 1.8; }
.me-loading-mark { display: block; font-family: Georgia, serif; font-size: 52px; color: var(--me-accent); }
.me-quiz, .me-result { padding: 28px; }
.me-quiz-progress { display: flex; justify-content: space-between; color: var(--me-muted); font-size: 12px; }
.me-progress-track { height: 3px; background: #eeeeee; border-radius: 2px; margin-top: 12px; overflow: hidden; }
#vocab-progress-bar { height: 100%; background: var(--me-accent); }
.me-word-card { padding: 40px 16px; margin-top: 24px; background: #f6f6f6; border-radius: 12px; text-align: center; }
#test-word { font-family: Georgia, "Times New Roman", serif; font-size: clamp(32px, 7vw, 52px); letter-spacing: -.04em; line-height: 1.25; overflow-wrap: anywhere; }
.me-word-card p { display: flex; justify-content: center; gap: 16px; margin-top: 15px; font-size: 12px; color: var(--me-muted); }
.me-quiz-instruction { margin: 20px 0 !important; color: var(--me-muted); font-size: 12px; line-height: 1.85; text-align: center; }
.me-answer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.me-answer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 20px; border: 1px solid #d5d5d5; border-radius: 10px; background: white; color: var(--me-ink); font-size: 14px; }
.me-answer:hover { background: var(--me-wash); }
.me-answer-known { background: var(--me-accent); border-color: var(--me-accent); color: white; }
.me-answer-known:hover { background: #333333; }
.me-answer kbd { font-family: inherit; font-size: 16px; }
.me-quiz-footnote { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-top: 16px; font-size: 10px; line-height: 1.8; color: var(--me-muted); }
.me-result .me-total { margin-top: 18px; }
#result-vocab-caption { margin-top: 24px; font-size: 14px; }
#result-vocab-average-note { margin-top: 12px; }
.me-result-saved { margin-top: 24px !important; padding: 16px; background: var(--me-wash); border-radius: 9px; font-size: 12px; color: var(--me-muted); line-height: 1.8; }
.me-result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

/* Tablet: move test action to its own row; preserve all four metrics. */
@media (max-width: 1100px) {
    .neath-me-page { --me-space: clamp(22px, 4vh, 40px); }
    .me-vocab { grid-template-columns: 1fr; grid-template-areas: 'heading' 'data' 'actions'; gap: 24px; }
    .me-vocab-heading { display: flex; align-items: baseline; gap: 16px; }
    .me-vocab-heading .me-small-note { margin-top: 0; }
    .me-vocab-data { grid-template-columns: minmax(160px, 1fr) minmax(0, 2fr); }
    .me-vocab-actions .me-small-note { width: auto; }
}
/* Phone: two compact metric columns; test records sit below the score. */
@media (max-width: 600px) {
    .neath-me-page { --me-space: 20px; }
    .me-profile { grid-template-columns: 1fr; gap: 12px; }
    .me-identity { gap: 14px; }
    .me-avatar { width: 48px; height: 48px; font-size: 23px; }
    .me-membership { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; text-align: left; }
    .me-account { margin-top: 0; }
    .me-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 28px; }
    .me-metrics dd { margin-top: 7px; }
    .me-section-heading { margin-bottom: 20px; }
    .me-vocab { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "heading actions" "data data"; gap: 20px; }
    .me-vocab-heading { display: block; align-self: center; }
    .me-vocab-heading .me-small-note { display: none; }
    .me-vocab-data { grid-template-columns: 1fr; gap: 20px; }
    .me-vocab-score { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
    .me-percentile { margin-top: 0 !important; font-size: 11px; }
    .me-vocab-details dd { font-size: 15px; margin-top: 5px; }
    #vocab-average-note { margin-top: 12px; }
    .me-vocab-actions { gap: 0; align-self: center; }
    .me-vocab-actions .me-small-note { display: none; }
    .me-vocab-empty h3 { font-size: 21px; }
    .me-footer { gap: 10px; }
    .me-dialog-header, .me-quiz, .me-result { padding: 20px; }
    .me-word-card { padding: 28px 14px; }
    .me-answer { padding: 15px; }
}
/* Short windows compress vertical rhythm instead of adding inner scroll panes. */
@media (max-height: 740px) and (min-width: 601px) {
    .neath-me-page { --me-space: 22px; }
    .me-section-heading { margin-bottom: 18px; }
    .me-metrics dd > span:first-child { font-size: 40px; }
    .me-number { font-size: 48px; }
    .me-vocab { row-gap: 16px; }
}
@media (max-width: 600px) and (max-height: 740px) {
    .neath-me-page { --me-space: 16px; }
    .me-metrics { row-gap: 16px; }
    .me-section-heading { margin-bottom: 14px; }
    .me-vocab, .me-vocab-data { row-gap: 16px; }
    .me-footer { padding-top: 10px; padding-bottom: 10px; }
}
@media (min-width: 601px) and (max-height: 620px) {
    .neath-me-page { --me-space: 16px; }
    .me-avatar { width: 52px; height: 52px; }
}
@media (max-height: 620px) {
    .me-dialog-header { padding-top: 16px; padding-bottom: 16px; }
    .me-word-card { padding-top: 20px; padding-bottom: 20px; margin-top: 16px; }
    .me-quiz-instruction { margin: 14px 0 !important; }
}
@media (prefers-reduced-motion: reduce) {
    .neath-me-page *, .neath-me-page *::before, .neath-me-page *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
