/* The shared phrase editor (phrase-editor.js). Colors come from --pe-* so the same component sits inside the
   phone mock-up on the Fix Strip page and inside the desktop panels on Journal Mode and Review Revisions. */
:root { --pe-ink: var(--text-1); --pe-sub: var(--text-3); --pe-line: var(--border-strong); --pe-key: var(--raised); --pe-accent: var(--brand); --pe-on-accent: var(--on-brand); --pe-fix: var(--proposed); }

.pe-words { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; font-size: 15px; line-height: 22px; max-height: 160px; overflow-y: auto; color: var(--pe-ink); }
.pe-words .w { border: 0; background: none; color: var(--pe-ink); font: inherit; padding: 4px 2px; margin: 0; border-radius: 6px; cursor: pointer; min-height: 34px; }
.pe-words .w:hover { background: color-mix(in srgb, var(--hl) 50%, transparent); }
.pe-words .w[aria-pressed="true"] { background: var(--hl); color: var(--hl-ink); box-shadow: inset 0 -2px 0 #6d45a3; }
.pe-words .w[disabled] { cursor: default; }
.pe-words .w.unclear { font-family: var(--font-mono); font-size: 0.86em; color: var(--warn); }
.pe-words .p { padding: 4px 0; white-space: pre-wrap; margin-inline: -1px; }

.pe-controls, .kb { --pe-gap: 10px; }
.pe-body { display: grid; place-items: center; gap: 10px; text-align: center; width: 100%; }
.pe-say { display: grid; place-items: center; gap: 8px; }
:where(.pe-controls, .kb) .kb-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
:where(.pe-controls, .kb) button.key { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--pe-key); color: var(--pe-ink); font: 600 15px/20px var(--font-sans); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); cursor: pointer; transition: transform 100ms var(--ease-out); }
:where(.pe-controls, .kb) button.key:active { transform: scale(0.96); }
:where(.pe-controls, .kb) button.key.primary { background: var(--pe-accent); color: var(--pe-on-accent); }
:where(.pe-controls, .kb) button.key.fix { background: var(--pe-fix); color: #fff; }
:where(.pe-controls, .kb) button.key[disabled] { opacity: 0.4; cursor: not-allowed; }
:where(.pe-controls, .kb) .mic { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--pe-accent); color: var(--pe-on-accent); font: 600 13px/16px var(--font-sans); cursor: pointer; display: grid; place-items: center; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.4); }
:where(.pe-controls, .kb) .mic[disabled] { opacity: 0.35; cursor: not-allowed; }
:where(.pe-controls, .kb) .mic.listening { animation: pe-pulse 1s ease-in-out infinite; }
@keyframes pe-pulse { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--pe-accent) 25%, transparent); } }
:where(.pe-controls, .kb) .hint { font-size: 13px; line-height: 18px; color: var(--pe-sub); max-width: 320px; }
:where(.pe-controls, .kb) .sim-note { font: 600 10px/14px var(--font-mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--pe-sub); border: 1.5px dashed currentColor; border-radius: 4px; padding: 2px 6px; }
:where(.pe-controls, .kb) .pe-input { width: 100%; min-height: 44px; border-radius: 10px; border: 1px solid var(--pe-line); background: var(--pe-key); color: var(--pe-ink); padding: 8px 12px; font: 400 16px/22px var(--font-sans); }
.replace-target { font-size: 15px; color: var(--pe-ink); }
.replace-target b { background: var(--hl); color: var(--hl-ink); border-radius: 3px; padding: 0 3px; }
.swap { font-size: 17px; line-height: 24px; color: var(--pe-ink); }
.swap s { background: var(--del); border-radius: 3px; padding: 0 3px; }
.swap b { background: var(--ins); border-radius: 3px; padding: 0 3px; }

/* Desktop panel layout: words above, compact controls below */
.pe-panel { border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--proposed-soft) 40%, var(--raised)); padding: 14px 16px; display: grid; gap: 12px; animation: pe-rise 200ms var(--ease-out); }
.pe-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font: 600 11px/16px var(--font-mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
.pe-panel .pe-controls .pe-body { place-items: start; text-align: left; }
.pe-panel .pe-controls .kb-row { justify-content: flex-start; }
.pe-panel .pe-say { grid-auto-flow: column; place-items: center start; }
.pe-panel .mic { width: 56px; height: 56px; font-size: 12px; }
.pe-panel .pe-input { max-width: 420px; }
@keyframes pe-rise { from { transform: translateY(6px); opacity: 0; } }

/* Text views shared by all three pages */
.pe-text del { background: var(--del); color: var(--text-1); text-decoration-thickness: 2px; border-radius: 3px; padding: 0 2px; }
.pe-text ins { background: var(--ins); color: var(--text-1); text-decoration: none; border-radius: 3px; padding: 0 2px; font-weight: 600; }
.pe-text mark { background: var(--hl); color: var(--hl-ink); border-radius: 3px; padding: 0 1px; }
.pe-text .changed { background: var(--ins); border-radius: 3px; transition: background 1.6s ease 0.6s; }
.pe-text .changed.settled { background: transparent; }
.unclear-chip { font: 600 0.78em/1 var(--font-mono); letter-spacing: 0.03em; color: var(--warn); border: 1.5px dashed currentColor; border-radius: 4px; padding: 1px 5px; white-space: nowrap; }

/* Phrase Repair: marked spans and the repair panel */
.uncertain { border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline wavy color-mix(in srgb, #b07a12 85%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 4px; border-radius: 3px; }
.uncertain:hover, .uncertain:focus-visible { background: color-mix(in srgb, #f5d78a 35%, transparent); }
.pe-words .w.marked { text-decoration: underline wavy #b07a12; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.pe-repair { gap: 10px; }
.pe-alts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pe-alts .alt { min-height: 38px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--pe-accent); background: var(--pe-key); color: var(--pe-ink); font: 600 15px/20px var(--font-sans); cursor: pointer; }
.pe-alts .alt:hover { background: color-mix(in srgb, var(--pe-accent) 12%, var(--pe-key)); }
.pe-type { display: flex; gap: 8px; width: 100%; align-items: center; }
.pe-type .pe-input { flex: 1; min-width: 0; }
:where(.pe-controls, .kb) .pe-say .mic { width: 64px; height: 64px; font-size: 12px; line-height: 15px; }
.pe-panel .pe-alts { justify-content: flex-start; }
