:root {
  color-scheme: light;
  --ink: #193f59;
  --ink-2: #355b73;
  --muted: #527084;
  --line: #cedfe9;
  --soft: #e8f3fa;
  --paper: #fff;
  --canvas: #e8f3fa;
  --cell: 26px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
html.creator-page, body.creator-page { overflow-x: clip; overflow-y: visible; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font-size: 16px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { min-height: 64px; background: #f4f9fc; color: var(--ink); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 24px; position: sticky; top: 0; z-index: 20; }
.topbar-leading { display: flex; align-items: center; gap: 14px; min-width: 0; margin-right: auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 750; letter-spacing: -.02em; color: inherit; text-decoration: none; }
.brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { display: block; width: 32px; height: 32px; flex-shrink: 0; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; flex-shrink: 0; min-width: 0; max-width: 100%; margin-left: auto; }
.local-badge { font-size: 12px; color: var(--muted); margin-right: 8px; }
.button { border: 1px solid #abc5d6; border-radius: 8px; padding: 9px 13px; background: white; color: var(--ink); }
.button.ghost { color: var(--ink); background: transparent; }
#save-project { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#save-project.has-unsaved-changes { border-color: #93afc2; }
.save-project-status { display: block; flex: none; width: 7px; height: 7px; overflow: hidden; font-size: 0; border-radius: 50%; background: #b84a4a; }
.save-project-status:empty { display: none; }
#browser-save-settings { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
#browser-save-settings svg { width: 18px; height: 18px; flex: none; }
.browser-save-indicator { width: 6px; height: 6px; flex: none; border-radius: 50%; background: #8b9ca7; }
#browser-save-settings[data-state="off"] .browser-save-indicator { background: #b84a4a; }
#browser-save-settings[data-state="saved"] .browser-save-indicator { background: #387b59; }
#browser-save-settings[data-state="pending"] .browser-save-indicator { background: #3576a3; }
#browser-save-settings[data-state="error"] .browser-save-indicator,
#browser-save-settings[data-state="delete-error"] .browser-save-indicator,
#browser-save-settings[data-state="conflict"] .browser-save-indicator { background: #b08037; }
#browser-save-dialog { width: min(540px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 1px solid #aac8dc; border-radius: 14px; padding: 22px; color: var(--ink); background: #f4f9fc; }
#browser-save-dialog::backdrop { background: #142f4966; }
.browser-save-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.browser-save-heading h2 { margin: 0; font-size: 23px; }
#browser-save-dialog p { font-size: 14px; line-height: 1.6; }
.browser-save-choice { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0; font-weight: 700; line-height: 1.5; cursor: pointer; }
.browser-save-choice input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: #193f59; }
#browser-save-dialog a { color: #245776; }
#browser-save-dialog button { min-height: 44px; }
#browser-save-dialog :focus-visible { outline: 3px solid #3576a3; outline-offset: 2px; }
#browser-save-status { font-weight: 700; }
.browser-save-note { color: var(--muted); }
@media print { #browser-save-dialog { display: none !important; } }
.sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 40px; min-height: 40px; padding: 8px; flex-shrink: 0; font-size: 14px; font-weight: 650; }
.sidebar-toggle svg { width: 22px; height: 22px; flex-shrink: 0; }
.sidebar-toggle:hover { background: #d8ebf7; border-color: #99bad0; }
.sidebar-toggle:focus-visible { outline: 2px solid #2670a5; outline-offset: 3px; }
.sidebar-toggle .sidebar-expand-icon, .sidebar-toggle[aria-expanded="false"] .sidebar-collapse-icon { display: none; }
.sidebar-toggle[aria-expanded="false"] .sidebar-expand-icon { display: block; }
.workspace { min-height: calc(100vh - 64px); display: grid; grid-template-columns: minmax(340px, 430px) minmax(0, 1fr); }
.workspace.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
.editor { background: #f9fcfe; border-right: 1px solid var(--line); padding: 20px; overflow-y: auto; }
.editor[hidden] { display: none; }
.panel { border-bottom: 1px solid #dce9f2; padding: 18px 0; }
.intro-panel { display: flex; justify-content: space-between; align-items: flex-start; padding-top: 4px; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: 27px; margin-bottom: 0; letter-spacing: -.03em; }
.step-badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: white; font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: 1fr 92px 92px; gap: 12px; }
.settings-grid label, .image-size label { display: grid; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 650; }
.settings-grid .wide { grid-column: 1 / -1; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: white; padding: 10px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 2px #dce9f2; }
.image-panel, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.image-panel { align-items: flex-start; flex-wrap: wrap; }
.image-copy { min-width: 112px; }
.image-controls { display: grid; justify-items: end; gap: 7px; }
.image-help { flex-basis: 100%; display: grid; gap: 5px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.image-help p { margin: 0; }
#image-recommendation { color: #476b84; }
.image-size { display: flex; align-items: end; gap: 6px; }
.image-size label { width: 66px; }
.image-size input { padding: 7px 8px; }
.image-size span { padding-bottom: 7px; color: var(--muted); }
.section-title { margin: 0 0 3px; font-size: 14px; font-weight: 800; }
.muted { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.field-note { display: block; margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.35; }
.upload-button, .suggest-button { border: 1px dashed #a7c6dc; border-radius: 8px; background: #f4f9fc; padding: 10px 12px; font-size: 13px; font-weight: 700; }
.image-section.is-drag-over .upload-button { border-color: #245b7c; color: #193f59; background: #dceefa; }
.text-button { border: 0; padding: 0; background: transparent; color: var(--muted); font-size: 12px; text-decoration: underline; }
.icon-button { width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--line); background: white; font-size: 20px; }
.word-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.clear-entries-button { height: 34px; border: 1px solid #b9cddb; border-radius: 7px; padding: 0 10px; background: #f4f9fc; color: #527084; font-size: 12px; font-weight: 750; }
.clear-entries-button:hover { border-color: #527084; background: #e3eff7; color: var(--ink); }
.clear-entries-button:disabled { opacity: .45; cursor: default; }
.word-list { display: grid; gap: 9px; margin: 15px 0 12px; max-height: 388px; overflow-y: auto; padding-right: 3px; }
.word-row { display: grid; grid-template-columns: 96px .85fr 1.25fr 30px; gap: 7px; align-items: center; padding-bottom: 7px; border-bottom: 1px solid #e3eff7; }
.word-row.personal-included { background: #eef6ef; border-bottom-color: #c4d9c7; border-radius: 6px; }
.word-row.personal-omitted { background: #fbefed; border-bottom-color: #e2c5c1; border-radius: 6px; }
.entry-placement-status { text-align: center; font-size: 11px; font-weight: 700; }
.personal-included .entry-placement-status { color: #386044; }
.personal-omitted .entry-placement-status { color: #884b45; }
.personal-coverage { margin-top: 10px; }
.word-row.fixed-definition .definition-alternatives { display: none; }
.definition-lock-note { color: #476b84; }
.answer-suggestions { position: fixed; z-index: 50; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #b9cddb; border-radius: 9px; background: #fff; box-shadow: 0 8px 24px #0002; }
.answer-suggestions[hidden] { display: none; }
.answer-suggestion { display: grid; gap: 3px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid #e3eff7; background: white; text-align: left; }
.answer-suggestion strong { font-size: 14px; }
.answer-suggestion span { color: #527084; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.answer-suggestion:hover, .answer-suggestion[aria-selected="true"] { background: #e3eff7; }
#answer-suggestion-status { margin: 0; padding: 10px 12px; color: #527084; font-size: 12px; line-height: 1.4; }
.word-row input, .word-row textarea, .word-row select { padding: 8px; font-size: 13px; }
.word-row textarea { min-height: 36px; resize: none; overflow: hidden; line-height: 1.25; }
.word-row .definition-alternatives { grid-column: 3; grid-row: 2; min-height: 44px; border-style: dashed; background: #f4f9fc; }
.source-label { grid-column: 2 / 4; grid-row: 3; display: flex; flex-wrap: wrap; gap: 3px 8px; color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.25; }
.source-label a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.source-label .license-flag { color: #193f59; font-weight: 850; text-transform: uppercase; letter-spacing: .035em; }
.source-label .license-flag.ready { color: #527084; }
.remove-entry { width: 28px; height: 30px; border: 0; border-radius: 6px; color: #527084; background: transparent; font-size: 18px; }
.remove-entry:hover { background: #e3eff7; color: var(--ink); }
.priority { padding: 6px 7px; border-radius: 99px; text-align: center; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.priority.must { background: #245b7c; color: white; }
.priority.good { border: 1px solid #b9cddb; color: #527084; }
.suggest-button { width: 100%; }
.auto-fill { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.35; cursor: pointer; }
.auto-fill input { flex: 0 0 auto; width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--ink); }
.rights-confirmation { display: flex; align-items: flex-start; gap: 8px; margin-top: 11px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f4f9fc; color: #476b84; font-size: 12px; line-height: 1.4; cursor: pointer; }
.rights-confirmation input { flex: 0 0 auto; width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--ink); }
.rights-confirmation[hidden] { display: none; }
.source-details { margin-top: 10px; border-top: 1px solid #dce9f2; color: var(--muted); font-size: 12px; }
.source-details summary { padding: 10px 0 2px; color: #355b73; cursor: pointer; font-weight: 750; }
#source-details { box-sizing: border-box; width: 210mm; max-width: 100%; margin-top: 8px; }
#source-details p { margin: 6px 0; }
#source-details-text { max-height: 240px; overflow: auto; padding: 8px 10px; background: #f7fbfe; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.source-register { display: grid; gap: 8px; padding: 9px 0 2px; }
.source-register article { padding-left: 9px; border-left: 2px solid #c5dce9; line-height: 1.4; }
.source-register strong { display: block; color: #285773; font-size: 12px; }
.source-register a { color: inherit; }
.source-register .source-help { margin: 2px 0 0; color: #527084; font-size: 12px; }
.generate-button { width: 100%; margin-top: 18px; border: 0; border-radius: 9px; background: var(--ink); color: white; padding: 14px 16px; display: flex; justify-content: space-between; font-weight: 800; }
.generate-button:disabled { opacity: .55; cursor: not-allowed; }
.regenerate-button { width: 100%; margin-top: 8px; border: 1px solid #b9cddb; border-radius: 9px; background: #f4f9fc; color: #355b73; padding: 10px 14px; font-size: 13px; font-weight: 750; }
.regenerate-button:hover { border-color: #527084; background: #e3eff7; color: var(--ink); }
.regenerate-button:disabled { opacity: .55; cursor: not-allowed; }
.generation-status { min-height: 34px; margin: 9px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.generation-status.error { color: #193f59; font-weight: 700; }
.generation-details { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; background: #f4f9fc; font-size: 12px; }
.generation-details summary { cursor: pointer; padding: 9px 11px; color: #355b73; font-weight: 750; }
.generation-log { display: grid; gap: 6px; margin: 0; padding: 0 14px 12px 31px; color: var(--muted); line-height: 1.35; }
.generation-log li.current { color: var(--ink); font-weight: 750; }
.generation-log li.done::marker { content: "✓  "; }
.preview-area { min-width: 0; display: flex; flex-direction: column; }
/* View tabs, zoom and the fill tools stay under the sticky page header while the puzzle scrolls (2026-11-01). */
/* On phones the header alone is tall: there they scroll with the sheet. */
@media (min-width: 761px) { .preview-sticky { position: sticky; top: var(--creator-header-height, 64px); z-index: 15; background: #f4f9fc; } }
.preview-toolbar { height: 64px; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #c7dce9; }
.tabs { display: flex; flex-wrap: wrap; min-width: 0; max-width: 100%; padding: 3px; background: #d6e8f4; border-radius: 9px; }
.tab { border: 0; background: transparent; padding: 8px 13px; border-radius: 7px; color: #527084; font-size: 13px; font-weight: 750; }
.tab.active { background: white; color: var(--ink); box-shadow: 0 1px 3px #0001; }
.preview-toolbar { flex-wrap: wrap; gap: 10px; height: auto; min-height: 64px; }
.pencil-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 24px; border-bottom: 1px solid #c7dce9; background: #f4f9fc; color: #355b73; }
.pencil-tools { display: flex; flex-wrap: wrap; gap: 5px; }
.pencil-tools button, .pencil-view-tools button { min-height: 40px; padding: 7px 11px; border: 1px solid #b7cedd; border-radius: 7px; background: #fff; color: #193f59; font-size: 13px; font-weight: 700; }
.pencil-tools button[aria-pressed="true"], .pencil-view-tools button[aria-pressed="true"] { background: #193f59; color: #fff; border-color: #193f59; }
.pencil-tools button:disabled { opacity: .45; cursor: default; }
.pencil-tools button:focus-visible, .pencil-view-tools button:focus-visible { outline: 3px solid #3576a3; outline-offset: 2px; }
.pencil-history-tools { display: inline-flex; gap: 5px; }
.pencil-tools .pencil-history-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; padding: 8px; }
.pencil-history-button svg { width: 20px; height: 20px; }
.pencil-color-control { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 3px 8px; border: 1px solid #b7cedd; border-radius: 7px; background: #fff; color: #193f59; font-size: 13px; font-weight: 700; }
.pencil-color-control input[type="color"] { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 4px; cursor: pointer; background: transparent; }
.pencil-color-control:focus-within { outline: 3px solid #3576a3; outline-offset: 2px; }
.pencil-width-control { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 3px 8px; border: 1px solid #b7cedd; border-radius: 7px; background: #fff; color: #193f59; font-size: 13px; font-weight: 700; }
.pencil-width-control[hidden], .pencil-color-control[hidden] { display: none; }
.pencil-width-control select { min-height: 32px; padding: 2px 4px; border: 1px solid #b7cedd; border-radius: 5px; background: #fff; color: #193f59; font: inherit; }
.pencil-width-control:focus-within { outline: 3px solid #3576a3; outline-offset: 2px; }
#pencil-help { flex: 1 1 260px; margin: 0; font-size: 12px; line-height: 1.45; }
/* The clue magnifier is a reading aid, not a fill tool: it sits apart, at the right end. */
.pencil-view-tools { display: flex; margin-left: auto; }
#send-feedback { margin-right: auto; }
.service-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; font-size: 14px; }
.service-links a { color: #355b73; }
#feedback-dialog { width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 22px; border: 1px solid #a7c6dc; border-radius: 12px; color: #193f59; background: #fff; font-size: 16px; }
#feedback-dialog::backdrop { background: #142f4966; }
.feedback-heading { display: flex; gap: 16px; align-items: start; justify-content: space-between; }
.feedback-heading h2 { margin: 0 0 16px; font-size: 20px; }
#feedback-fields { display: grid; gap: 14px; border: 0; margin: 0; padding: 0; min-width: 0; }
#feedback-fields label { display: grid; gap: 6px; font-size: 14px; }
#feedback-fields select, #feedback-fields textarea { width: 100%; min-width: 0; font: inherit; padding: 10px; border: 1px solid #b9cddb; border-radius: 6px; }
#feedback-fields .feedback-consent { display: block; line-height: 1.5; }
#feedback-fields input[type="checkbox"] { width: 18px; height: 18px; margin-right: 8px; vertical-align: middle; }
.feedback-clue { margin: 0; padding: 12px; background: #e8f3fa; border-radius: 6px; font-weight: 700; overflow-wrap: anywhere; }
.feedback-privacy, #feedback-own-note { margin: 0; color: #527084; font-size: 14px; line-height: 1.5; }
#feedback-fields .feedback-honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
#feedback-status { line-height: 1.5; }
#feedback-receipt { overflow-wrap: anywhere; font-size: 14px; }
#feedback-dialog [hidden] { display: none !important; }
#feedback-dialog button { min-height: 44px; }
#feedback-dialog :focus-visible { outline: 3px solid #245ba2; outline-offset: 2px; }
#rating-dialog { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; overflow: auto; border: 1px solid #a7c6dc; border-radius: 20px; color: #193f59; background: #fff; box-shadow: 0 28px 90px #102f4566; }
#rating-dialog::backdrop { background: #142f4973; backdrop-filter: blur(3px); }
.rating-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; padding: 24px 26px 17px; border-bottom: 1px solid #dce9f2; background: linear-gradient(135deg,#f7fbfe,#eaf5fb); }
.rating-heading .eyebrow { margin: 0 0 4px; color: #527084; }
.rating-heading h2 { margin: 0; font: 700 clamp(21px,4vw,27px)/1.2 Georgia,"Times New Roman",serif; }
.rating-close { width: 44px; min-width: 44px; height: 44px; border: 1px solid #b8cedc; border-radius: 50%; color: #31566e; background: #fff; font-size: 27px; line-height: 1; cursor: pointer; }
#rating-question, .rating-finished { padding: 21px 26px 10px; }
.rating-intro { margin: 0 0 16px; color: #527084; line-height: 1.55; }
.rating-progress { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: #527084; font-size: 13px; font-weight: 800; }
#rating-progress-dots { display: flex; gap: 5px; }
#rating-progress-dots i { width: 8px; height: 8px; border-radius: 50%; background: #c9dce7; }
#rating-progress-dots i.done { background: #3f7a55; }
#rating-progress-dots i.current { background: #245b7c; box-shadow: 0 0 0 3px #dceaf2; }
.rating-pair { display: grid; gap: 9px; min-height: 126px; padding: 20px; border: 1px solid #bdd4e2; border-radius: 14px; background: #f4f9fc; text-align: center; place-content: center; }
.rating-pair p { margin: 0; font: 700 20px/1.4 Georgia,"Times New Roman",serif; overflow-wrap: anywhere; }
.rating-pair strong { color: #245b7c; font-size: 17px; letter-spacing: .08em; }
.rating-question-text { margin: 17px 0 11px; text-align: center; font-weight: 750; }
.rating-main-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rating-main-actions button, .rating-reason-grid button, .rating-finished-actions button { min-height: 48px; border: 1px solid #aac5d7; border-radius: 10px; padding: 10px 14px; color: #193f59; background: #fff; font: 750 15px/1.25 inherit; cursor: pointer; }
.rating-main-actions button:hover, .rating-reason-grid button:hover, .rating-reason-grid button.selected { border-color: #245b7c; background: #e8f3fa; }
.rating-main-actions span { display: block; margin-bottom: 3px; font-size: 24px; }
.rating-reasons { margin-top: 16px; padding-top: 15px; border-top: 1px solid #dce9f2; }
.rating-reasons h3 { margin: 0 0 10px; font-size: 15px; }
.rating-reason-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.rating-reason-grid button { min-height: 40px; padding: 7px 11px; font-size: 13px; }
.rating-rewrite { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 12px; }
.rating-rewrite label { display: grid; gap: 5px; font-size: 13px; font-weight: 750; }
.rating-rewrite input, .rating-rewrite textarea { width: 100%; border: 1px solid #aac5d7; border-radius: 8px; padding: 9px; font: inherit; resize: vertical; }
.rating-submit { width: 100%; margin-top: 12px; }
.rating-consent { display: block; margin: 16px 0 0; color: #527084; font-size: 12px; line-height: 1.5; }
.rating-consent input { width: 17px; height: 17px; margin-right: 7px; vertical-align: middle; }
.rating-consent a { color: inherit; }
#rating-status { min-height: 22px; margin: 8px 0 0; color: #8a3d37; font-size: 13px; }
.rating-finished { padding-top: 30px; text-align: center; }
.rating-thanks { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; color: #fff; background: #3f7a55; font-size: 27px; }
.rating-finished h3 { margin: 0 0 7px; font: 700 24px/1.25 Georgia,"Times New Roman",serif; }
.rating-finished p { color: #527084; }
.rating-finished-actions { display: grid; gap: 9px; margin-top: 18px; }
.rating-skip { display: block; margin: 4px auto 18px; border: 0; padding: 9px 14px; color: #527084; background: transparent; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.rating-withdraw { margin-top: 13px; border: 0; padding: 6px; color: #6d7981; background: transparent; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
#rating-dialog [hidden] { display: none !important; }
#rating-dialog button:disabled { opacity: .55; cursor: wait; }
#rating-dialog :focus-visible { outline: 3px solid #245ba2; outline-offset: 2px; }
#rewarded-ad-dialog { width: min(660px, calc(100vw - 24px)); padding: 0; overflow: hidden; border: 1px solid #8fb4ca; border-radius: 20px; color: #193f59; background: #fff; box-shadow: 0 28px 90px #102f456e; }
#rewarded-ad-dialog::backdrop { background: #102f497a; backdrop-filter: blur(3px); }
.rewarded-ad-shell { display: grid; gap: 14px; padding: 18px; }
.rewarded-ad-topline { display: flex; justify-content: space-between; gap: 18px; color: #527084; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.rewarded-ad-stage { position: relative; isolation: isolate; display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 26px; min-height: 270px; padding: 34px; overflow: hidden; border-radius: 15px; color: #fff; background: radial-gradient(circle at 18% 18%, #3d7596 0 5%, transparent 35%), #193f59; }
.rewarded-ad-stage::after { content: ""; position: absolute; z-index: -1; right: -70px; bottom: -115px; width: 300px; height: 300px; border: 1px solid #bfe0f450; border-radius: 50%; box-shadow: inset 0 0 0 38px #9ecae514, inset 0 0 0 78px #9ecae510; }
.rewarded-ad-stage p { margin: 0 0 8px; color: #bfe0f4; font-size: 12px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.rewarded-ad-stage h2 { margin: 0 0 13px; color: #fff; font: 650 clamp(26px, 4.6vw, 42px)/1.06 "Segoe UI", system-ui, sans-serif; letter-spacing: -.045em; }
.rewarded-ad-stage span { color: #d9ebf5; font-size: 15px; }
.rewarded-ad-grid { display: grid; grid-template-columns: repeat(3, 42px); grid-template-rows: repeat(3, 42px); gap: 5px; transform: rotate(-5deg); }
.rewarded-ad-grid i { border: 1px solid #d9ebf5b8; border-radius: 4px; background: #ffffff12; animation: rewarded-cell 2.7s ease-in-out infinite; }
.rewarded-ad-grid i:nth-child(2n) { animation-delay: -.7s; }
.rewarded-ad-grid i:nth-child(3n) { background: #bfe0f4; animation-delay: -1.4s; }
@keyframes rewarded-cell { 0%, 72%, 100% { transform: scale(1); opacity: .72; } 36% { transform: scale(.82); opacity: 1; } }
#rewarded-ad-progress { width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 99px; background: #d7e6ef; accent-color: #245b7c; }
#rewarded-ad-progress::-webkit-progress-bar { background: #d7e6ef; }
#rewarded-ad-progress::-webkit-progress-value { border-radius: 99px; background: #245b7c; }
#rewarded-ad-progress::-moz-progress-bar { border-radius: 99px; background: #245b7c; }
.rewarded-ad-note { margin: 0; color: #527084; font-size: 13px; line-height: 1.5; }
#rewarded-ad-continue { width: 100%; min-height: 48px; }
#rewarded-ad-continue:disabled { opacity: .58; cursor: wait; }
#rewarded-ad-dialog :focus-visible { outline: 3px solid #6ca2c3; outline-offset: 2px; }
#open-puzzle-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 26px; border: 1px solid #aac8dc; border-radius: 12px; color: #193f59; background: #f4f9fc; }
#open-puzzle-dialog::backdrop { background: #142f4966; }
#open-puzzle-dialog p { line-height: 1.65; }
#open-puzzle-dialog a { color: #245776; }
.open-puzzle-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.open-puzzle-heading h2 { margin: 0; font-size: 23px; }
#open-puzzle-dialog button { min-height: 44px; }
.open-puzzle-drop { display: grid; justify-items: center; gap: 12px; padding: 26px 18px; border: 2px dashed #8fb2c9; border-radius: 12px; background: #fff; text-align: center; }
.open-puzzle-drop p { margin: 0; }
#open-puzzle-dialog.dragging .open-puzzle-drop { border-color: #245b7c; background: #e5f0f6; }
#choose-puzzle-file { background: #193f59; color: white; }
#puzzle-metadata-dialog { width: min(1040px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 24px; border: 1px solid #aac8dc; border-radius: 14px; background: #f4f9fc; color: var(--ink); }
#puzzle-metadata-dialog::backdrop { background: #142f4973; }
#puzzle-metadata-dialog .dialog-heading { position: sticky; top: -24px; z-index: 1; padding-top: 12px; background: #f4f9fc; }
#puzzle-metadata-dialog button { min-height: 44px; }
#puzzle-metadata-dialog :focus-visible { outline: 3px solid #245ba2; outline-offset: 2px; }
.metadata-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.metadata-title { margin-bottom: 6px; font-size: 20px; font-weight: 750; overflow-wrap: anywhere; }
.metadata-note, .metadata-notice { font-size: 14px; line-height: 1.6; }
.metadata-notice { border-left: 3px solid #ac7737; padding: 10px 14px; background: #fff3df; }
.metadata-section { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; overflow: hidden; }
.metadata-section > summary { padding: 14px 16px; cursor: pointer; font-weight: 750; }
.metadata-values { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 1.3fr); gap: 8px 20px; margin: 0; padding: 0 16px 16px; font-size: 14px; line-height: 1.5; }
.metadata-values:empty { display: none; }
.metadata-values dt { color: var(--muted); }
.metadata-values dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.metadata-section > input { width: calc(100% - 32px); margin: 0 16px 14px; }
.metadata-table-wrap { overflow-x: auto; padding: 0 16px 16px; }
.metadata-table-wrap table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 13px; line-height: 1.5; }
.metadata-table-wrap th, .metadata-table-wrap td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.metadata-table-wrap td span, .metadata-table-wrap td small { display: block; }
.metadata-table-wrap td small { color: var(--muted); }
.metadata-section pre { max-height: 420px; overflow: auto; margin: 0; padding: 16px; font-size: 12px; background: #eef5f9; }
@media (max-width: 600px) {
  #puzzle-metadata-dialog { padding: 16px; }
  #puzzle-metadata-dialog .dialog-heading { top: -16px; gap: 12px; }
  #puzzle-metadata-dialog .dialog-heading h2 { font-size: 21px; }
  .metadata-values { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .metadata-values dd { margin-bottom: 12px; }
}
@media print { #puzzle-metadata-dialog { display: none !important; } }
html.player-open-only, html.player-open-only body { min-height: 100%; background: #e9f3f8; }
html.player-open-only body > :not(#open-puzzle-dialog):not(script) { display: none !important; }
html.player-open-only #open-puzzle-dialog::backdrop { background: #e9f3f8; }
.sheet-wrap { flex: 1; overflow: auto; display: grid; place-items: start center; align-content: start; padding: 34px; }
.puzzle-sheet { position: relative; width: 210mm; min-width: 210mm; height: 297mm; min-height: 297mm; padding: 5mm 10mm; overflow: hidden; --grid-height: 267mm; background: var(--puzzle-paper, #ffffff); color: var(--puzzle-heading, #193f59); box-shadow: 0 15px 45px #0002; zoom: var(--preview-zoom, 1); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.puzzle-sheet.is-printing { zoom: 1 !important; }
.sheet-head { position: relative; display: grid; place-items: center; min-height: 7.5mm; padding-bottom: 1.5mm; border-bottom: var(--puzzle-head-line, 3px) solid var(--puzzle-grid, #193f59); }
.sheet-head h2 { width: 125mm; max-height: 2.2em; margin: 0; overflow: hidden; overflow-wrap: anywhere; font-family: Georgia, "Times New Roman", serif; font-size: var(--title-font, 20px); line-height: 1.1; text-align: center; white-space: normal; }
.sheet-head h2[contenteditable="true"] { cursor: text; }
.sheet-head h2[contenteditable="true"]:hover { outline: 1px dashed #527084; outline-offset: 2px; }
.sheet-head h2[contenteditable="true"]:focus { outline: 2px solid #245b7c; outline-offset: 2px; background: #fff8cf; }
.sheet-meta { position: absolute; right: 0; bottom: 1.8mm; display: grid; justify-items: end; gap: 2px; font-size: 11px; color: var(--puzzle-muted, #527084); }
.puzzle-sheet[data-paper="landscape"] { width: 297mm; min-width: 297mm; height: 210mm; min-height: 210mm; --grid-width: 276mm; --grid-height: 181mm; page: ahagrid-landscape; }
.example-loading .workspace { visibility: hidden; }
.example-load-status { padding: 24px; text-align: center; }
.preview-grid { --cell: min(calc(var(--grid-width, 189mm) / var(--cols, 13)), calc(var(--grid-height, 272mm) / var(--rows, 19))) !important; position: relative; margin: 1.5mm auto 0; display: grid; grid-template-columns: repeat(var(--cols, 13), var(--cell)); grid-template-rows: repeat(var(--rows, 19), var(--cell)); width: max-content; border-top: var(--puzzle-frame-line, 2px) solid var(--puzzle-grid, #171717); border-left: var(--puzzle-frame-line, 2px) solid var(--puzzle-grid, #171717); background: var(--puzzle-block, #333333); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.preview-grid.is-empty { background: var(--puzzle-block, #333333); }
.preview-grid .draft-cell { background: var(--puzzle-cell, #ffffff); }
.cell { position: relative; display: grid; place-items: center; width: var(--cell); height: var(--cell); border-right: var(--puzzle-cell-line, 1px) solid var(--puzzle-grid, #171717); border-bottom: var(--puzzle-cell-line, 1px) solid var(--puzzle-grid, #171717); font-family: Arial, sans-serif; font-weight: 700; font-size: calc(var(--cell) * .52); }
.preview-grid.is-generating .cell::after { content: ""; position: absolute; inset: 0; z-index: 6; pointer-events: none; background: color-mix(in srgb, var(--puzzle-selection, #555555) 62%, var(--puzzle-cell, #ffffff)); opacity: 0; transition: opacity .28s ease, background-color .28s ease; will-change: opacity; }
.preview-grid.is-generating .draft-image-placeholder { visibility: hidden; opacity: 0; }
.preview-grid.is-generating .cell.search-built::after { opacity: .18; }
.preview-grid.is-generating .cell.search-neighbor::after { background: color-mix(in srgb, var(--puzzle-selection, #555555) 42%, var(--puzzle-cell, #ffffff)); animation: recorded-search-neighbor .86s ease-out both; }
.preview-grid.is-generating .cell.search-probe::after { background: color-mix(in srgb, var(--puzzle-selection, #555555) 86%, var(--puzzle-cell, #ffffff)); animation: recorded-search-probe .69s cubic-bezier(.32, 0, .22, 1) both; }
.preview-grid.is-generating .cell.search-reject::after { background: color-mix(in srgb, var(--puzzle-muted, #737373) 72%, var(--puzzle-cell, #ffffff)); animation: recorded-search-reject .8s ease-out both; }
@keyframes recorded-search-probe {
  0% { opacity: .12; }
  34% { opacity: .68; }
  70% { opacity: .34; }
  100% { opacity: .18; }
}
@keyframes recorded-search-reject {
  0% { opacity: .5; }
  46% { opacity: .24; }
  100% { opacity: .03; }
}
@keyframes recorded-search-neighbor {
  0% { opacity: .04; }
  38% { opacity: .24; }
  100% { opacity: .03; }
}
.cell.letter { background: var(--puzzle-cell, #ffffff); cursor: text; outline: none; }
.cell.letter.filled { color: var(--puzzle-letter, #111111); }
.cell.letter.active-word { box-shadow: inset 0 0 0 3px var(--puzzle-selection, #555555); }
.cell.letter:focus, .cell.letter:focus-within { background: var(--puzzle-focus, #e8e8e8); box-shadow: inset 0 0 0 1.5px var(--puzzle-selection, #555555); z-index: 1; }
.cell .letter-input { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; color: transparent; caret-color: transparent; font-size: 16px; outline: none; cursor: text; }
.pencil-layer { position: absolute; inset: 0; z-index: 15; width: 100%; height: 100%; overflow: hidden; pointer-events: none; color: var(--puzzle-letter, #303030); }
.pencil-layer path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pencil-layer.pencil-active { pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.pencil-layer.pencil-erasing { cursor: cell; }
@media print { .cell .letter-input { display: none; } }
.cell.clue { z-index: 2; padding: 2px; align-items: center; background: var(--puzzle-clue, #e6e6e6); color: var(--puzzle-clueText, #171717); font-family: "Arial Narrow", Arial, sans-serif; font-size: max(6px, calc(var(--cell) * .16)); line-height: 1.04; font-weight: 750; text-align: center; overflow: visible; overflow-wrap: anywhere; hyphens: auto; }
.cell.clue .clue-part { position: relative; display: flex; align-items: center; justify-content: center; justify-self: center; width: var(--clue-width, 100%); height: 100%; overflow: hidden; transform: scaleX(var(--clue-scale-x, 1)); transform-origin: center; font-size: var(--clue-font, inherit) !important; }
.cell.clue .direction-marker { --marker-depth: calc(var(--cell) * .135); --marker-half: calc(var(--cell) * .085); position: absolute; z-index: 7; width: 0; height: 0; pointer-events: none; }
.cell.clue .direction-marker.across { right: calc(0px - var(--marker-depth)); top: 50%; transform: translateY(-50%); border-top: var(--marker-half) solid transparent; border-bottom: var(--marker-half) solid transparent; border-left: var(--marker-depth) solid var(--puzzle-arrow, #111111); }
.cell.clue .direction-marker.down { bottom: calc(0px - var(--marker-depth)); left: 50%; transform: translateX(-50%); border-left: var(--marker-half) solid transparent; border-right: var(--marker-half) solid transparent; border-top: var(--marker-depth) solid var(--puzzle-arrow, #111111); }
.cell.clue .direction-marker.left { left: calc(0px - var(--marker-depth)); top: 50%; transform: translateY(-50%); border-top: var(--marker-half) solid transparent; border-bottom: var(--marker-half) solid transparent; border-right: var(--marker-depth) solid var(--puzzle-arrow, #111111); }
.cell.clue .direction-marker.up { top: calc(0px - var(--marker-depth)); left: 50%; transform: translateX(-50%); border-left: var(--marker-half) solid transparent; border-right: var(--marker-half) solid transparent; border-bottom: var(--marker-depth) solid var(--puzzle-arrow, #111111); }
.cell.clue.double { padding: 0; grid-template-rows: repeat(2, minmax(0, 1fr)); background: var(--puzzle-clue, #e6e6e6); color: var(--puzzle-clueText, #171717); }
.cell.clue.double .clue-part { position: relative; height: 100%; min-height: 0; padding: 1px 2px; line-height: 1.02; }
.cell.clue .clue-part { cursor: pointer; }
.cell.clue.double .clue-part.part-0 { grid-row: 1; }
.cell.clue.double .clue-part.part-1 { grid-row: 2; border-top: 1px solid var(--puzzle-clueDivider, #555555); }
.cell.clue.double .direction-marker.across.part-0 { top: 25%; }
.cell.clue.double .direction-marker.across.part-1 { top: 75%; }
.cell.clue.double .direction-marker.left.part-0 { top: 25%; }
.cell.clue.double .direction-marker.left.part-1 { top: 75%; }
.cell.clue.double .direction-marker.up.part-0 { left: 25%; }
.cell.clue.double .direction-marker.up.part-1 { left: 75%; }
/* Keep arrows beside the answer's starting row when a clue spans two cells. */
.cell.clue.extended-clue .direction-marker.across,
.cell.clue.extended-clue .direction-marker.left,
.cell.clue.double.extended-clue .direction-marker.across,
.cell.clue.double.extended-clue .direction-marker.left { top: var(--clue-anchor-y, 50%); }
.cell.clue.extended-clue .direction-marker.down,
.cell.clue.extended-clue .direction-marker.up,
.cell.clue.double.extended-clue .direction-marker.down,
.cell.clue.double.extended-clue .direction-marker.up { left: var(--clue-anchor-x, 50%); }
/* A bent arrow starts in the upper clue and enters the adjacent lower row. */
.cell.clue .direction-marker.corner {
  --corner-size: calc(var(--cell) * .32);
  width: var(--corner-size);
  height: var(--corner-size);
  right: calc(var(--corner-size) * -.6);
  border: 0;
  color: var(--puzzle-arrow, #111111);
  transform: translateY(-50%);
}
.cell.clue .direction-marker.corner svg { display: block; width: 100%; height: 100%; }
.cell.clue .direction-marker.corner.corner-up { transform: translateY(-50%) scaleY(-1); }
.cell.clue .direction-marker.corner.left { left: calc(var(--corner-size) * -.6); right: auto; transform: translateY(-50%) scaleX(-1); }
.cell.clue .direction-marker.corner.left.corner-up { transform: translateY(-50%) scale(-1, -1); }
.cell.clue .direction-marker.routed { width: calc(var(--cell) * .24); height: calc(var(--cell) * .6); border: 0; color: var(--puzzle-arrow, #111111); }
.cell.clue .direction-marker.routed svg { display: block; width: 100%; height: 100%; overflow: visible; }
/* Turning arrows sit in the answer's first cell, along the shared edge, ending before its letter. */
.cell.clue .direction-marker.down-across { left: calc(var(--cell) * .02); top: 100%; }
.cell.clue .direction-marker.up-across { left: calc(var(--cell) * .02); bottom: 100%; }
.cell.clue .direction-marker.across-down,
.cell.clue .direction-marker.left-down { width: calc(var(--cell) * .6); height: calc(var(--cell) * .24); top: calc(var(--cell) * .02); }
.cell.clue .direction-marker.across-down { left: 100%; }
.cell.clue .direction-marker.left-down { right: 100%; }
.theme-word-badge { color: #165a43; font-weight: 700; }
.theme-coverage { font-size: 13px; color: #165a43; }
.theme-word-list { font-size: 13px; margin: 8px 0; }
.theme-word-list summary { cursor: pointer; font-weight: 600; color: #165a43; }
.theme-word-list ul { padding-left: 20px; line-height: 1.5; }
@media print { .theme-coverage { display: none; } }
.cell.highlight { background: var(--puzzle-highlight, #bcbcbc); box-shadow: inset 0 0 0 1.5px var(--puzzle-highlightBorder, #555555); }
.cell.highlight.active-word { box-shadow: inset 0 0 0 3px var(--puzzle-selection, #555555); }
.cell.letter.highlight:focus, .cell.letter.highlight:focus-within { background: var(--puzzle-highlightFocus, #a8a8a8); }
.cell.letter.highlight .letter-value { position: relative; z-index: 2; }
.solution-turn-arrow { position: absolute; left: 1px; bottom: 1px; z-index: 1; width: 38%; height: 38%; color: var(--puzzle-arrow, #111111); pointer-events: none; }
.solution-turn-arrow svg, .solution-start-direction svg { display: block; width: 100%; height: 100%; }
.cell.letter.given { cursor: default; background: var(--puzzle-given, #aaaaaa); }
.cell.letter.given .letter-value { font-weight: 900; }
.cell .letter-value { line-height: 1; color: var(--entered-letter-color, inherit); }
.cell.letter.answer-correct .letter-value { color: var(--puzzle-correct, #17602f); }
.cell.letter.answer-incorrect .letter-value { color: var(--puzzle-incorrect, #a32626); }
.cell.block { background: var(--puzzle-block, #333333); }
.cell.block .block-icon { color: var(--puzzle-blockIcon, #fff); font-family: Georgia, "Times New Roman", serif; font-size: max(10px, calc(var(--cell) * .29)); font-weight: 700; line-height: 1; text-shadow: 0 1px 1px #0009; pointer-events: none; }
.cell.block .block-icon svg, .block-icon-sample svg, .preset-block svg { display: block; width: max(11px, calc(var(--cell) * .46)); height: max(11px, calc(var(--cell) * .46)); }
.icon-fill { fill: currentColor; }
.icon-stroke { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cell.block .block-icon:has(svg) { text-shadow: none; filter: drop-shadow(0 1px 1px #0008); }
.cell.solution-start { background: var(--puzzle-start, #111111); color: var(--puzzle-startText, #ffffff); }
.cell.solution-start[role="button"] { cursor: pointer; }
.cell.solution-start[role="button"]:focus-visible { outline: 3px solid #2670a5; outline-offset: -3px; }
.cell .solution-start-number { font-family: Georgia, serif; font-size: max(13px, calc(var(--cell) * .38)); font-weight: 900; line-height: 1; }
.cell.solution-start.diagonal-start .solution-start-number { position: absolute; top: 12%; left: 13%; font-size: max(12px, calc(var(--cell) * .32)); }
.solution-start-direction { position: absolute; right: 2%; bottom: 2%; width: 63%; height: 63%; pointer-events: none; }
.image-placeholder { z-index: 3; display: grid; place-items: center; overflow: hidden; background: var(--puzzle-imageSpace, #f4f4f4); border: var(--puzzle-frame-line, 2px) solid var(--puzzle-grid, #171717); border-top-width: var(--puzzle-cell-line, 1px); border-left-width: var(--puzzle-cell-line, 1px); font-size: 12px; font-weight: 800; color: var(--puzzle-muted, #737373); }
.image-placeholder img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(var(--puzzle-grayscale, 0)); }
.draft-image-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; text-align: center; line-height: 1.35; }
.draft-image-placeholder span { max-width: 22ch; font-size: 11px; font-weight: 500; }
.draft-image-placeholder.has-image { padding: 0; }
.draft-image-placeholder.has-image img { display: block; min-height: 0; flex: 1 1 auto; }
.starter-watermark { position: absolute; inset: 0; z-index: 12; width: 100%; height: 100%; overflow: hidden; pointer-events: none; user-select: none; color: var(--puzzle-watermark, #52606b); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
/* Per-text alpha, no group opacity or pattern tile: a PDF holds many separate marks, not one removable layer. */
.starter-watermark text { fill: currentColor; fill-opacity: .18; stroke: var(--puzzle-watermark-halo, #fff); stroke-opacity: .28; stroke-width: 1.6px; paint-order: stroke; font: 700 26px Arial, sans-serif; letter-spacing: .035em; text-anchor: middle; }
.starter-watermark[hidden] { display: none; }
.puzzle-sheet[data-watermark-tone="dark"] .starter-watermark text { fill-opacity: .17; }
/* Paper motifs repeat in a fixed physical tile, so the margins around a large grid still show
   several of them; the preset previews use the same tile. Centring the tiles cuts both edges alike. */
:is(.puzzle-sheet, .preset-paper)[data-pattern] { --paper-tile: 13mm; background: var(--puzzle-pattern-image, none) 50% 0 / var(--paper-tile) auto repeat, var(--puzzle-paper, #fff); }
:is(.puzzle-sheet, .preset-paper)[data-pattern="dots"] { --paper-tile: 5mm; }
:is(.puzzle-sheet, .preset-paper)[data-pattern="linen"] { --paper-tile: 6mm; }
:is(.puzzle-sheet, .preset-paper)[data-pattern="waves"] { --paper-tile: 17mm; }
:is(.puzzle-sheet, .preset-paper)[data-pattern="fireworks"] { --paper-tile: 30mm; }
/* Graph paper keeps visible strokes even in a tiny preview; scaling an SVG thinned them away. */
:is(.puzzle-sheet, .preset-paper)[data-pattern="grid"] { background: linear-gradient(var(--puzzle-pattern) var(--paper-grid-line, .25mm), transparent var(--paper-grid-line, .25mm)) 50% 0 / var(--paper-grid-step, 5mm) var(--paper-grid-step, 5mm), linear-gradient(90deg, var(--puzzle-pattern) var(--paper-grid-line, .25mm), transparent var(--paper-grid-line, .25mm)) 50% 0 / var(--paper-grid-step, 5mm) var(--paper-grid-step, 5mm), var(--puzzle-paper); }
.preset-paper[data-pattern="grid"] { --paper-grid-line: 1px; --paper-grid-step: 8px; }
:is(.puzzle-sheet, .preset-paper)[data-pattern="cobweb"] { background: var(--puzzle-pattern-image) right top / 30% auto no-repeat, var(--puzzle-paper); }
.puzzle-sheet[data-tone="dark"] .sheet-head h2[contenteditable="true"]:focus { background: #2b2338; }
/* A soft paper-coloured halo keeps the title and date readable over the paper motifs. */
.puzzle-sheet[data-pattern]:not([data-pattern="plain"]) :is(.sheet-head h2, .sheet-meta), .preset-paper[data-pattern]:not([data-pattern="plain"]) .preset-paper-title {
  text-shadow: 0 0 2px var(--puzzle-paper), 0 0 4px var(--puzzle-paper), 0 0 7px var(--puzzle-paper), 0 0 10px var(--puzzle-paper); }
.puzzle-sheet[data-heading="book"] .sheet-head h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: .025em; }
.puzzle-sheet[data-heading="modern"] .sheet-head h2 { font-family: "Segoe UI", Arial, sans-serif; font-weight: 750; letter-spacing: -.025em; }
.puzzle-sheet[data-heading="playful"] .sheet-head h2 { font-family: "Trebuchet MS", "Segoe UI", sans-serif; font-weight: 750; letter-spacing: -.015em; }
.appearance-preset-section { margin-top: 18px; }
.appearance-preset-section h3 { margin: 0 0 10px; font-size: 14px; font-weight: 750; }
.appearance-file-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid #193f5922; }
.appearance-file-section h3 { margin: 0 0 6px; font-size: 14px; font-weight: 750; }
.appearance-file-section p { margin: 0 0 10px; font-size: 13px; }
.appearance-file-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.appearance-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.appearance-preset { position: relative; display: flex; flex-direction: column; align-items: stretch; min-width: 0; padding: 8px 8px 12px; border: 1px solid #d7e1e7; border-radius: 12px; color: var(--ink); background: #fff; text-align: left; box-shadow: 0 2px 6px #193f5907; }
.appearance-preset:hover { border-color: #6c94ae; background: #f8fbfd; }
.appearance-preset[aria-pressed="true"] { border-color: #245b7c; box-shadow: 0 0 0 1px #245b7c; background: #f0f7fb; }
.appearance-preset[aria-pressed="true"]::after { content: "✓"; position: absolute; top: 5px; right: 5px; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; color: #fff; background: #245b7c; font-size: 12px; font-weight: 800; }
.appearance-preset:focus-visible { outline: 3px solid #245b7c; outline-offset: 3px; }
.preset-paper { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; min-height: 138px; padding: 14px 8px 10px; border: 1px solid #193f5914; border-radius: 5px; overflow: hidden; background: var(--puzzle-paper); color: var(--puzzle-heading); }
.preset-paper-title { width: 100%; padding-bottom: 5px; color: var(--puzzle-heading); font: 600 11px/1.2 Georgia, serif; text-align: center; overflow-wrap: anywhere; }
.preset-paper[data-heading="book"] .preset-paper-title { font-weight: 500; }
.preset-paper[data-heading="modern"] .preset-paper-title { font-family: "Segoe UI", Arial, sans-serif; font-weight: 750; }
.preset-paper[data-heading="playful"] .preset-paper-title { font-family: "Trebuchet MS", sans-serif; }
.appearance-preset-preview { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; width: 100%; max-width: 116px; align-self: center; padding: 1px; background: var(--puzzle-grid); }
.preset-cell { display: grid; place-items: center; aspect-ratio: 1; background: var(--puzzle-cell); font: 700 11px Georgia, serif; }
.preset-block svg { width: 80%; height: 80%; color: var(--puzzle-blockIcon); }
.style-setting select { grid-column: -3 / -1; min-width: 0; min-height: 32px; border: 1px solid #b9cddb; border-radius: 6px; background: #fff; color: var(--ink); font: inherit; }
.preset-clue { background: var(--puzzle-clue); }
.preset-clue { align-content: center; gap: 3px; }
.preset-clue i { display: block; width: 65%; height: 1px; background: var(--puzzle-clueText); opacity: .55; }
.preset-highlight { background: var(--puzzle-highlight); }
.preset-start { color: var(--puzzle-startText); background: var(--puzzle-start); }
.preset-block { background: var(--puzzle-block); }
.appearance-preset-name { margin-top: 8px; font-size: 13px; font-weight: 750; overflow-wrap: anywhere; }
.appearance-preset-description { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.appearance-preset-status { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.appearance-colors { display: grid; gap: 16px; margin: 18px 0; }
.appearance-colors fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.appearance-colors legend { margin-bottom: 8px; padding: 0; font-size: 13px; font-weight: 750; }
.color-setting { display: grid; grid-template-columns: minmax(0, 1fr) 34px 86px; align-items: center; gap: 8px; margin-top: 7px; }
.color-setting label { min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.color-setting input[type="color"] { height: 32px; padding: 3px; cursor: pointer; }
.color-setting input[type="text"] { padding: 7px; font: 12px ui-monospace, monospace; }
.color-setting input[aria-invalid="true"] { border-color: #a32626; }
.feedback-key { font-weight: 750; }
.feedback-key.correct { color: var(--puzzle-correct, #17602f); }
.feedback-key.incorrect { color: var(--puzzle-incorrect, #a32626); }
.empty-state { grid-column: 1 / -1; padding: 72px 28px; text-align: center; color: var(--puzzle-muted, #737373); background: var(--puzzle-paper, #ffffff); border-right: 2px solid var(--puzzle-grid, #171717); border-bottom: 2px solid var(--puzzle-grid, #171717); }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--puzzle-heading, #171717); font-family: Georgia, serif; font-size: 20px; }
.preview-notes { display: flex; justify-content: space-between; gap: 20px; width: 210mm; margin-top: 14px; color: #527084; font-size: 11px; }
.puzzle-sheet .eyebrow { color: var(--puzzle-muted, #737373); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 40; transform: translate(-50%, 20px); max-width: calc(100vw - 32px); padding: 11px 15px; border-radius: 8px; background: #181818; color: white; font-size: 13px; opacity: 0; pointer-events: none; transition: .18s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.block-icon-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.block-icon-options button { display: grid; justify-items: center; gap: 4px; min-width: 0; min-height: 58px; padding: 5px 2px; border: 1px solid #c3d4de; border-radius: 7px; background: #f7fafb; color: #17394d; cursor: pointer; }
.block-icon-options button:hover { border-color: #527f98; background: #eef5f8; }
.block-icon-options button[aria-pressed="true"] { border-color: #17394d; box-shadow: inset 0 0 0 2px #17394d; }
.block-icon-options button:focus-visible { outline: 3px solid #4a88ad; outline-offset: 2px; }
.block-icon-sample { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 2px; background: var(--puzzle-block, #333); color: var(--puzzle-blockIcon, #fff); --cell: 29px; font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1; }
.block-icon-sample.empty { color: #bbc4c8; }
.block-icon-label { max-width: 100%; overflow: hidden; font-size: 9px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) {
  .topbar { height: auto; min-height: 64px; flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .top-actions { width: 100%; flex-wrap: wrap; justify-content: flex-end; }
  .top-actions .button { min-height: 44px; }
  .sidebar-toggle-label { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .editor { border-right: 0; border-bottom: 1px solid var(--line); }
  .preview-area { min-height: 720px; }
  .local-badge { display: none; }
}
@media (max-width: 560px) {
  .topbar { padding: 10px 14px; }
  .topbar-leading { gap: 9px; }
  .brand-mark { display: none; }
  .top-actions { gap: 4px; }
  .button.ghost { padding: 8px 10px; }
  .editor { padding: 16px; }
  .settings-grid { grid-template-columns: 1fr 74px 74px; }
  .word-row { grid-template-columns: 76px 1fr; }
  .word-row textarea { grid-column: 2; }
  .word-row .definition-alternatives { grid-column: 2; grid-row: auto; }
  .remove-entry { grid-column: 1; grid-row: 2; }
  .source-label { grid-column: 2; grid-row: auto; }
  .preview-toolbar { padding: 10px 14px; }
  .sheet-wrap { padding: 18px; justify-content: start; }
}
@media print {
  #feedback-dialog, #rating-dialog, #rewarded-ad-dialog, #open-puzzle-dialog, .service-links { display: none !important; }
  .answer-suggestions { display: none !important; }
  /* A nulla oldalmargó a böngésző URL/dátum/oldalszám fejlécét is elhagyja;
     a tényleges, nyomtatóbarát margót maga a rejtvénylap adja. */
  @page { size: A4; margin: 0; }
  @page ahagrid-landscape { size: A4 landscape; margin: 0; }
  html, body { width: auto; min-width: 0; height: auto; background: white; }
  .topbar, .editor, .preview-sticky, .preview-toolbar, .pencil-toolbar, .toast { display: none !important; }
  .workspace { display: block; min-height: 0; }
  .preview-area, .sheet-wrap { display: block; min-height: 0; overflow: visible; padding: 0; }
  .puzzle-sheet { box-shadow: none; zoom: 1 !important; break-inside: avoid; page-break-inside: avoid; }
  .preview-notes, #source-details { display: none !important; }
  .sheet-head h2[contenteditable="true"] { outline: 0; background: transparent; }
}
/* Modern creator workspace, aligned with the public AhaGrid visual system. */
[hidden] { display: none !important; }
body.creator-setup { --settings-width: clamp(340px, 31vw, 430px); background: #f4f9fc; }
body.creator-setup .topbar { width: calc(100% - var(--settings-width) - 32px); min-height: 76px; margin-left: calc(var(--settings-width) + 32px); padding: 10px 24px; color: #193f59; background: #f4f9fcf2; border-bottom-color: #cedfe9; backdrop-filter: blur(14px); transition: width .32s ease, margin-left .32s ease; }
body.creator-setup:has(.creator-workspace.sidebar-collapsed) .topbar { width: calc(100% - 32px); margin-left: 32px; }
body.creator-setup .brand { font-size: 20px; }
body.creator-setup .brand-mark { color: #193f59; background: #d8ebf7; border-color: #9fc1d8; border-radius: 9px; }
body.creator-setup .local-badge { color: #527084; }
body.creator-setup .button.ghost { min-height: 42px; padding: 10px 14px; color: #193f59; border-color: #b7cedd; border-radius: 9px; background: #fff; }
body.creator-setup .button.ghost:hover { background: #e4f0f7; border-color: #8fb2c9; }
.creator-section-heading > span i { font: inherit; font-style: normal; }
.plan-inline-note { margin: 10px 0 0; padding: 9px 11px; border-left: 3px solid #77a8c7; color: #355b73; background: #eef7fc; font-size: 13px; line-height: 1.45; }
.plan-inline-note.limit-reached { border-left-color: #bb7b2f; color: #68491f; background: #fff8e9; }
.plan-free .pro-only, .plan-pro .free-only { display: none !important; }
.plan-free .dimension-number, .plan-free .dimension-separator { display: none; }
.plan-pro .grid-preset-field { display: none; }
.plan-free .dimension-field { display: block; }
.plan-free .dimension-field .grid-preset-field { width: 100%; }
.topic-field, .accent-field, .sensitive-field { display: grid; grid-column: 1 / -1; gap: 8px; min-width: 0; color: #355b73; font-size: 14px; font-weight: 700; }
.topic-field select, .accent-field select { width: 100%; }
.topic-field > label { display: flex; align-items: center; gap: 8px; }
.topic-heading { display: flex; align-items: center; gap: 8px; }
.solution-input-error { margin: 8px 0; color: #9c3434; font-size: 13px; line-height: 1.4; }
:is(.topic-picker, .excluded-topic-picker) { border: 1px solid #bfd1de; border-radius: 8px; background: #fff; min-width: 0; }
:is(.topic-picker, .excluded-topic-picker) summary { cursor: pointer; padding: 11px 12px; overflow-wrap: anywhere; }
.topic-count { color: #527084; font-size: 12px; font-weight: 600; white-space: nowrap; }
:is(.topic-picker, .excluded-topic-picker) summary:focus-visible { outline: 2px solid #247bad; outline-offset: 2px; }
:is(#puzzle-topic, #excluded-topics) { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(135px, 100%), 1fr)); gap: 6px; margin: 0; padding: 10px; border: 0; }
/* Rebuilt topic fieldsets must relayout when the picker opens. */
.topic-picker:not([open]) > #puzzle-topic { display: none; }
.excluded-topic-picker:not([open]) > #excluded-topics { display: none; }
:is(#puzzle-topic, #excluded-topics) legend { padding: 4px 0; font-size: 12px; font-weight: 400; }
:is(#puzzle-topic, #excluded-topics) label { display: flex; flex-direction: row; align-items: center; gap: 8px; padding: 6px 2px; min-width: 0; min-height: 38px; font-size: 13px; cursor: pointer; overflow-wrap: anywhere; }
:is(#puzzle-topic, #excluded-topics) input { width: 17px; height: 17px; min-height: 17px; padding: 0; margin: 0; flex: 0 0 auto; accent-color: #247bad; }
#puzzle-topic .topic-group { min-width: 0; padding-top: 4px; border-top: 1px solid #d9e6ee; }
#puzzle-topic .topic-group > label { font-weight: 750; }
:is(#puzzle-topic, #excluded-topics):disabled { opacity: .65; }
:is(#puzzle-topic, #excluded-topics) label:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.beta-badge { display: inline-flex; align-items: center; min-height: 21px; padding: 2px 7px; border: 1px solid #b9d5e7; border-radius: 999px; color: #245b7c; background: #e8f3fa; font-size: 10px; font-weight: 800; line-height: 1; letter-spacing: .02em; }
.plan-free .topic-picker { color: #527084; background: #eef4f7; }
.plan-free #puzzle-topic:disabled label { cursor: not-allowed; }
.creator-workspace { display: grid; grid-template-columns: minmax(0, var(--settings-width)) 32px minmax(0, 1fr); min-height: calc(100vh - 76px); align-items: stretch; transition: grid-template-columns .32s ease; }
.creator-workspace:not(.player-workspace) { min-height: 100vh; margin-top: calc(0px - var(--creator-header-height, 76px)); }
.creator-workspace.sidebar-collapsed { grid-template-columns: minmax(0, 0px) 32px minmax(0, 1fr); }
.creator-workspace .creator-view { position: sticky; top: 0; align-self: start; width: var(--settings-width); height: 100dvh; min-height: 0; padding: 14px 12px 28px; border: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; background: #f4f9fc; transition: transform .32s ease; }
.creator-workspace .creator-view:focus-visible { outline: 2px solid #7fa6be; outline-offset: -2px; }
.creator-workspace:not(.player-workspace) .creator-view { padding-top: 14px; }
.creator-workspace.sidebar-collapsed .creator-view { pointer-events: none; transform: translateX(-100%); }
.creator-workspace .preview-area { display: flex; min-height: calc(100vh - 76px); }
.creator-workspace:not(.player-workspace) .preview-area { min-height: 100vh; padding-top: var(--creator-header-height, 76px); }
.creator-workspace.player-workspace, .creator-workspace.player-workspace.sidebar-collapsed { display: block; }
.creator-workspace.player-workspace .creator-view, .creator-workspace.player-workspace .sidebar-curtain-rail { display: none; }
.sidebar-curtain-rail { position: relative; z-index: 21; grid-column: 2; grid-row: 1; width: 32px; height: 100%; min-height: 0; border-left: 1px solid #a8c9dd; border-right: 1px solid #a8c9dd; border-radius: 0; background: #d8ebf7; box-shadow: 5px 0 12px #193f591c; }
.sidebar-curtain-toggle { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: center; width: 30px; height: 100dvh; padding: 10px 3px; border: 0; border-radius: 0; color: #193f59; background: #d8ebf7; }
.sidebar-curtain-toggle:hover { background: #bfdded; }
.sidebar-curtain-toggle:focus-visible { outline: 3px solid #2670a5; outline-offset: -3px; }
.sidebar-curtain-toggle svg { width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .32s ease; }
.sidebar-curtain-toggle[aria-expanded="false"] svg { transform: rotate(180deg); }
.creator-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; width: 100%; margin: 0; border: 0; background: transparent; overflow: visible; }
.sidebar-scroll-top { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; font-size: 14px; font-weight: 650; }
.sidebar-scroll-top svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-scroll-top:hover { background: #d8ebf7; border-color: #99bad0; }
.sidebar-scroll-top:focus-visible { outline: 2px solid #2670a5; outline-offset: 3px; }
.creator-intro { position: relative; isolation: isolate; grid-column: 1; display: grid; grid-template-columns: 1fr; align-items: end; gap: 12px; min-height: 0; padding: 22px; overflow: hidden; color: #fff; background: #193f59; border: 1px solid #193f59; border-radius: 16px; box-shadow: 0 24px 60px -42px #193f59aa; }
.creator-intro::after { content: ""; position: absolute; z-index: -1; top: -105px; right: -55px; width: 310px; height: 310px; border: 1px solid #bfe0f455; border-radius: 50%; box-shadow: inset 0 0 0 36px #9ecae51c, inset 0 0 0 74px #9ecae516; }
.creator-intro .eyebrow { grid-column: 1 / -1; margin: 0; color: #bfe0f4; font-size: 12px; letter-spacing: .16em; }
.creator-intro h1 { margin: 0; max-width: 680px; color: #fff; font-family: "Segoe UI", system-ui, sans-serif; font-size: 30px; font-weight: 600; line-height: 1.08; letter-spacing: -.045em; }
.creator-intro h1 em { color: #c7e5f7; font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
.creator-intro p:last-child { position: relative; max-width: 380px; margin: 0; padding: 12px; border: 1px solid #bfe0f438; border-radius: 10px; color: #d9ebf5; background: #ffffff0d; font-size: 13px; line-height: 1.5; backdrop-filter: blur(4px); }
.creator-section { grid-column: 1; min-width: 0; overflow: hidden; background: #fff; border: 1px solid #cedfe9; border-radius: 14px; box-shadow: 0 18px 50px -42px #193f5988; }
.image-section.is-drag-over { border-color: #245b7c; box-shadow: 0 0 0 3px #b8dbea, 0 18px 50px -42px #193f5988; }
.creator-section[aria-labelledby="image-heading"] { grid-column: 1; }
.creator-section.generation-section { grid-column: 1; }
.creator-section-heading { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 10px; margin: 0; padding: 16px; border: 0; border-bottom: 1px solid #dce9f2; background: #f8fbfd; cursor: pointer; }
.creator-section-heading:hover { background: #eef6fb; }
.creator-section-heading > span { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #b9d5e7; border-radius: 12px; color: #245b7c; background: #e8f3fa; font-size: 13px; font-weight: 800; line-height: 1; }
.creator-section-heading h2 { margin: 0 0 3px; color: #193f59; font-family: "Segoe UI", system-ui, sans-serif; font-size: 20px; font-weight: 700; letter-spacing: -.025em; }
.creator-section-heading .creator-section-toggle { display: block; width: 100%; margin: 0; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; letter-spacing: inherit; text-align: left; }
.creator-section-heading .creator-section-toggle:hover { color: #2670a5; }
.creator-section-heading .creator-section-toggle:focus-visible { outline: 2px solid #2670a5; outline-offset: 3px; border-radius: 2px; }
.creator-section-heading:has(.creator-section-toggle) > span { cursor: pointer; }
.creator-section.is-collapsed > .creator-section-body { display: none !important; }
.creator-section.is-collapsed .creator-section-heading { padding-block: 12px; border-bottom: 0; cursor: pointer; }
.creator-section.is-collapsed .creator-section-heading h2 { margin: 0; }
.creator-section.is-collapsed .creator-section-heading p,
.creator-section.is-collapsed .creator-section-heading .context-help,
.creator-section.is-collapsed .creator-section-heading .image-section-actions { display: none !important; }
.creator-section-heading p { margin: 0; color: #527084; font-size: 13px; line-height: 1.45; }
.section-title-with-help { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.section-title-with-help h2 { min-width: 0; }
.creator-section-heading .add-word-button { grid-column: 2; grid-row: 2; justify-self: start; margin: 4px 0 0; }
.creator-section-body { min-width: 0; padding: 16px; }
.creator-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: none; padding: 0; }
.creator-fields > label, .dimension-field label { display: grid; align-content: start; gap: 8px; color: #355b73; font-size: 14px; font-weight: 700; }
.creator-fields .title-field { grid-column: 1 / -1; }
.creator-fields .solution-field { grid-column: 1; }
.solution-field { display: grid; gap: 8px; color: #355b73; font-size: 14px; font-weight: 700; }
.solution-field-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.solution-field-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; max-width: 100%; margin-left: auto; gap: 6px; }
.solution-total-counter { color: #527084; font-size: 12px; font-weight: 700; white-space: nowrap; }
.solution-total-counter.over-limit { color: #a23a35; }
.counted-input { position: relative; display: block; min-width: 0; }
.creator-section .counted-input input { display: block; width: 100%; padding-right: 70px; }
.input-counter { position: absolute; top: 50%; right: 13px; transform: translateY(-50%); color: #527084; font-size: 12px; font-weight: 700; pointer-events: none; }
.input-counter.over-limit { color: #a23a35; }
.solution-split-settings { display: grid; gap: 8px; min-width: 0; color: #355b73; font-size: 14px; font-weight: 700; }
#solution-split-choice:not([hidden]) { display: grid; gap: 8px; }
.field-label-with-help { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.field-label-with-help > label { min-width: 0; color: #355b73; font-size: 14px; font-weight: 700; }
.context-help { position: relative; z-index: 2; flex: 0 0 auto; }
.context-help:hover, .context-help:focus-within { z-index: 21; }
.context-help-trigger { display: grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid #7fa6be; border-radius: 50%; color: #245b7c; background: transparent; font-size: 13px; font-weight: 850; line-height: 1; cursor: help; user-select: none; transition: color .16s, border-color .16s, box-shadow .16s; }
.context-help:hover .context-help-trigger, .context-help:focus-within .context-help-trigger { color: #123d58; border-color: #245b7c; }
.context-help-trigger:focus-visible { outline: 0; box-shadow: 0 0 0 3px #d7ebf7; }
.generation-action { width: 100%; }
.generation-action:focus-visible { outline: 2px solid #2670a5; outline-offset: 3px; border-radius: 10px; }
.context-help-popover { position: fixed; top: var(--help-top, 0px); left: var(--help-left, 0px); z-index: 20; visibility: hidden; width: min(286px, calc(100vw - 48px)); max-width: calc(var(--settings-width, 100vw) - 68px); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 11px 12px; border: 1px solid #a7c6dc; border-radius: 10px; opacity: 0; color: #25475a; background: #fff; box-shadow: 0 14px 35px -20px #193f59aa; font-size: 12px; font-weight: 500; line-height: 1.45; pointer-events: none; transform: translateY(-3px); transition: opacity .14s ease, transform .14s ease, visibility 0s linear .14s; }
.context-help:hover .context-help-popover, .context-help:focus-within .context-help-popover { visibility: visible; opacity: 1; transform: translateY(0); transition-delay: 0s; pointer-events: auto; }
.context-help-popover p { margin: 0; }
.context-help-popover p + p { margin-top: 7px; }
.creator-section:has(.context-help:hover), .creator-section:has(.context-help:focus-within) { position: relative; z-index: 10; overflow: visible; }
.solution-split-settings select { width: 100%; }
.solution-split-settings #solution-auto-field { display: block; }
.solution-split-settings #solution-auto-field[hidden] { display: none; }
.solution-split-settings #final-solution { width: 100%; }
.solution-split-manual { display: grid; gap: 10px; min-width: 0; padding: 12px; border: 1px solid #cfe2ee; border-radius: 10px; background: #f7fbfe; }
.solution-split-manual[hidden] { display: none; }
.solution-part-fields { display: grid; gap: 10px; }
.solution-part-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.solution-part-row label { display: grid; gap: 6px; min-width: 0; }
.solution-part-row input { width: 100%; min-width: 0; }
.creator-section input::placeholder, .creator-section textarea::placeholder { color: #8199a8; opacity: 1; }
.creator-section input, .creator-section select, .creator-section textarea { min-height: 46px; padding: 11px 13px; border-color: #bfd2df; border-radius: 10px; background: #fff; transition: border-color .16s, box-shadow .16s, background .16s; }
.creator-section input:hover, .creator-section select:hover, .creator-section textarea:hover { border-color: #96b7cd; }
.creator-section input:focus, .creator-section select:focus, .creator-section textarea:focus { border-color: #2670a5; box-shadow: 0 0 0 3px #d7ebf7; }
.creator-section input[type="number"]:enabled:invalid { border-color: #a32626; background: #fff5f3; }
.creator-section .accent-checkbox { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.creator-section .accent-checkbox input[type="checkbox"] { appearance: none; display: grid; place-content: center; flex: 0 0 20px; box-sizing: border-box; width: 20px; min-width: 20px; max-width: 20px; height: 20px; min-height: 20px; max-height: 20px; margin: 0; padding: 0; border: 1.5px solid #8fb2c9; border-radius: 4px; background: #fff; box-shadow: none; cursor: pointer; }
.creator-section .accent-checkbox input[type="checkbox"]::after { content: ""; width: 5px; height: 9px; margin-top: -2px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); }
.creator-section .accent-checkbox input[type="checkbox"]:checked { border-color: #245b7c; background: #245b7c; }
.creator-section .accent-checkbox input[type="checkbox"]:checked::after { transform: rotate(45deg) scale(1); }
.creator-section .accent-checkbox input[type="checkbox"]:focus-visible { outline: 3px solid #c7e5f7; outline-offset: 2px; }
.creator-section .accent-checkbox input[type="checkbox"]:disabled { opacity: .6; cursor: default; }
.dimension-field { display: grid; grid-template-columns: minmax(96px, 1fr) 18px minmax(96px, 1fr); align-items: end; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.dimension-field legend { grid-column: 1 / -1; margin-bottom: 1px; color: #355b73; font-size: 14px; font-weight: 700; }
.dimension-field > span { padding-bottom: 13px; color: #7491a4; text-align: center; }
.creator-fields #final-source-note, .image-options #image-source-note { display: none; }
.add-word-button { align-self: center; min-height: 42px; padding: 9px 14px; border: 1px solid #abc8da; border-radius: 9px; color: #193f59; background: #fff; font-size: 13px; font-weight: 750; white-space: nowrap; }
.add-word-button:hover { color: #fff; background: #245b7c; border-color: #245b7c; }
.creator-section .personal-coverage { margin: 0; width: auto; color: #527084; font-size: 13px; }
.creator-section .personal-coverage { margin-top: 10px; }
.creator-section .word-list { width: auto; max-height: none; margin: 16px 0 10px; gap: 10px; overflow: visible; }
.creator-section .word-row { grid-template-columns: minmax(0, 1fr) 34px; gap: 10px; padding: 11px; border: 1px solid #cfdee7; border-radius: 12px; background: #f9fcfe; }
.creator-section .word-row.personal-included { border-color: #a9ceb3; background: #f4faf5; }
.creator-section .word-row.personal-omitted { border-color: #e0bbb5; background: #fff8f7; }
.creator-section .word-row.plan-excluded { border-style: dashed; border-color: #d5b875; background: #fffaf0; opacity: .82; }
.creator-section .word-row.plan-excluded input, .creator-section .word-row.plan-excluded textarea { color: #7a6a4a; background: #f8f3e7; }
.creator-section .word-row .definition-alternatives, .creator-section .word-row .source-label { display: none; }
.creator-section .word-row input { grid-column: 1; grid-row: 1; }
.creator-section .word-row textarea[data-entry-field="definition"] { grid-column: 1 / -1; grid-row: 2; min-height: 46px; }
.creator-section .word-row .remove-entry { grid-column: 2; grid-row: 1; align-self: center; }
.creator-section .word-row .entry-placement-status { grid-column: 1 / -1; grid-row: 3; text-align: left; }
.creator-workspace.mvp-workspace #back-to-setup { display: none; }
.creator-workspace .sheet-head h2.placeholder-title { color: var(--puzzle-muted, #8299a8); font-style: italic; font-weight: 400; }
.creator-section .clear-entries-button { display: inline-flex; align-items: center; gap: 7px; width: auto; min-height: 38px; margin-top: 8px; border-radius: 8px; background: transparent; }
.creator-section .clear-entries-button:disabled { display: none; }
.compact-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 58px; padding: 14px 16px; background: #f8fbfd; }
.image-section-heading .section-title-with-help { flex-wrap: wrap; }
.image-section-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: auto; }
.image-opt-out { display: flex; align-items: center; gap: 8px; color: #355b73; font-size: 13px; font-weight: 650; cursor: pointer; }
.image-opt-out span { white-space: nowrap; }
.compact-section-heading h2 { margin: 0; color: #193f59; font-family: "Segoe UI", system-ui, sans-serif; font-size: 20px; font-weight: 700; letter-spacing: -.025em; }
.compact-section-heading h2 label { cursor: pointer; }
.creator-section .image-enable-checkbox { flex: 0 0 auto; width: 22px; min-height: 22px; height: 22px; margin: 0; padding: 0; border-radius: 3px; accent-color: #245b7c; cursor: pointer; }
.creator-section .image-enable-checkbox:focus { box-shadow: none; }
.creator-section .image-enable-checkbox:focus-visible { outline: 2px solid #2670a5; outline-offset: 3px; }
.image-options { display: grid; gap: 12px; margin: 0; padding: 16px; border: 0; border-top: 1px solid #dce9f2; border-radius: 0 0 14px 14px; background: #fff; }
.image-options .image-size { justify-content: start; }
.image-options .image-size label { flex: 1 1 0; min-width: 0; max-width: 92px; }
.image-options .cell-unit { padding-bottom: 9px; font-size: 12px; }
.image-upload-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.image-upload-line > p { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.image-format-note { margin: 0; color: #527084; font-size: 12px; line-height: 1.45; }
.generation-section .generate-button, .generation-section .generation-progress, .generation-section .generation-status, .generation-section .generation-coverage, .generation-section .generation-actions, .generation-section .muted { width: 100%; margin-left: 0; }
.generation-section .generate-button { min-height: 54px; margin-top: 0; border-radius: 10px; background: #193f59; box-shadow: none; }
.generation-section .generate-button:hover { background: #285773; transform: translateY(-1px); }
.generation-progress { margin-top: 16px; padding: 15px; border: 1px solid #c5dbe8; border-radius: 11px; background: #f4f9fc; }
.progress-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; color: #527084; font-size: 13px; }
.progress-heading strong { color: #193f59; }
.progress-heading { flex-wrap: wrap; }
.progress-heading strong { flex: 1; min-width: 120px; }
.progress-heading #progress-elapsed { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-detail { margin: 10px 0 0; color: #527084; font-size: 12px; line-height: 1.5; }
#cancel-generation { margin-top: 12px; }
.generation-progress progress:indeterminate { background: linear-gradient(90deg, #d7e6ef 0 30%, #245b7c 45% 55%, #d7e6ef 70%); background-size: 250% 100%; animation: search-progress 1.8s ease-in-out infinite alternate; }
.generation-progress progress:indeterminate::-webkit-progress-bar { background: transparent; }
.generation-progress progress:indeterminate::-moz-progress-bar { background: transparent; }
.generation-progress.complete progress::-webkit-progress-value { background: #39734a; }
.generation-progress.complete progress::-moz-progress-bar { background: #39734a; }
.generation-progress progress[hidden] { display: none; }
@keyframes search-progress { from { background-position: 0% 0; } to { background-position: 100% 0; } }
@media (prefers-reduced-motion: reduce) {
  .generation-progress .spinner, .generation-progress progress:indeterminate { animation: none; }
  .generation-progress progress::-webkit-progress-value { transition: none; }
}
.spinner { width: 18px; height: 18px; border: 2px solid #bad1df; border-top-color: #193f59; border-radius: 50%; animation: creator-spin .8s linear infinite; }
.generation-progress.complete .spinner { border: 0; animation: none; }
.generation-progress.complete .spinner::before { content: "✓"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; background: #39734a; font-size: 12px; }
@keyframes creator-spin { to { transform: rotate(360deg); } }
.generation-progress progress { display: block; width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: 99px; background: #d7e6ef; accent-color: #245b7c; }
.generation-progress progress::-webkit-progress-bar { background: #d7e6ef; }
.generation-progress progress::-webkit-progress-value { border-radius: 99px; background: #245b7c; transition: width .3s ease; }
.generation-progress progress::-moz-progress-bar { border-radius: 99px; background: #245b7c; }
.generation-status { min-height: 0; margin-top: 11px; font-size: 13px; }
.generation-status.error { color: #8a3d37; }
.generation-plan-note { margin: 11px 0 0; padding: 10px 12px; border: 1px solid #c8dce8; border-radius: 9px; color: #355b73; background: #f3f8fb; font-size: 12px; line-height: 1.45; }
.generation-plan-note.rewarded { border-color: #e3c37e; color: #68491f; background: #fff8e9; }
.generation-coverage { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; padding: 0; list-style: none; }
.generation-coverage li { max-width: 100%; padding: 6px 9px; border-radius: 99px; font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.generation-coverage li.included { color: #285a36; background: #e5f3e8; }
.generation-coverage li.omitted { color: #843d38; background: #fae9e7; }
.generation-coverage li::before { margin-right: 5px; }
.generation-coverage li.included::before { content: "✓"; }
.generation-coverage li.omitted::before { content: "×"; }
.generation-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.regenerate-button { flex: 1 1 160px; min-width: 0; margin-top: 0; border-radius: 9px; padding: 11px 14px; font-size: 13px; font-weight: 800; }
.creator-section .generation-log { display: none !important; }
.puzzle-tools { display: flex; gap: 8px; margin-right: auto; }
.zoom-controls { display: inline-flex; flex: 0 0 auto; align-items: stretch; overflow: hidden; border: 1px solid #9eb9ca; border-radius: 7px; background: #fff; }
.zoom-controls button { min-width: 38px; min-height: 38px; padding: 0 9px; border: 0; border-radius: 0; color: #244f69; background: transparent; font: inherit; font-weight: 800; }
.zoom-controls button + button { border-left: 1px solid #c5d7e2; }
.zoom-controls button:hover:not(:disabled), .zoom-controls button:focus-visible { background: #e8f3fa; }
.zoom-controls button:focus-visible { position: relative; z-index: 1; outline: 2px solid #245b7c; outline-offset: -2px; }
.zoom-controls button:disabled { color: #9caeb9; cursor: not-allowed; }
.zoom-value { min-width: 64px !important; font-variant-numeric: tabular-nums; }
.tool-button { display: inline-flex; align-items: center; gap: 7px; }
.tool-button svg { width: 18px; height: 18px; }
.edit-mode-help { margin: 0; padding: 10px 24px; border-bottom: 1px solid #d5c58d; color: #5e4a12; background: #fff9df; font-size: 13px; line-height: 1.45; }
.cell.clue .clue-part[contenteditable="true"] { cursor: text; outline: 1px dashed #527084; outline-offset: -2px; }
.cell.clue .clue-part[contenteditable="true"]:focus { z-index: 9; background: #fff8cf; outline: 2px solid #245b7c; }
.cell.letter.editor-cell { cursor: text; }
.preview-area { container: preview / inline-size; }
.preview-content { display: flex; align-items: stretch; flex: 1; min-width: 0; }
.preview-content > .sheet-wrap { min-width: 0; }
.appearance-panel { position: sticky; top: calc(var(--creator-header-height, 76px) + 16px); align-self: flex-start; flex: 0 0 320px; width: 320px; max-height: calc(100dvh - var(--creator-header-height, 76px) - 32px); margin: 16px 0; padding: 16px; overflow-y: auto; border: 1px solid #a7c6dc; border-right: 0; border-radius: 12px 0 0 12px; color: #193f59; background: #fff; }
.appearance-panel[hidden] { display: none; }
.appearance-panel .dialog-heading { gap: 12px; }
.appearance-panel .dialog-heading h2 { font-size: 20px; }
#open-appearance[aria-expanded="true"] { border-color: #245b7c; background: #e8f3fa; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid #dce9f2; }
.dialog-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 25px; }
.appearance-panel > .muted { margin-top: 16px; font-size: 13px; line-height: 1.5; }
.appearance-panel .appearance-colors { grid-template-columns: 1fr; }
.appearance-panel .color-setting { grid-template-columns: minmax(0, 1fr) 38px 82px; }
.appearance-panel .image-switch { display: flex; align-items: center; gap: 9px; margin-top: 16px; font-size: 13px; }
.appearance-panel .image-switch input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; padding: 0; accent-color: #245b7c; }

@container preview (max-width: 1179px) {
  .preview-content { flex-direction: column; }
  .appearance-panel { position: static; align-self: stretch; flex-basis: auto; width: auto; max-height: none; margin: 0 24px 24px; border-right: 1px solid #a7c6dc; border-radius: 12px; scroll-margin-top: calc(var(--creator-header-height, 76px) + 16px); }
}

@media screen and (max-width: 760px) {
  #rating-dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); border-radius: 14px; }
  .rating-heading { padding: 19px 18px 14px; }
  #rating-question, .rating-finished { padding: 17px 18px 8px; }
  .rating-main-actions, .rating-rewrite { grid-template-columns: 1fr; }
  .rewarded-ad-stage { grid-template-columns: 1fr; min-height: 310px; padding: 28px 24px; }
  .rewarded-ad-grid { grid-template-columns: repeat(3, 31px); grid-template-rows: repeat(3, 31px); }
  .rating-pair { min-height: 112px; padding: 16px; }
  .rating-pair p { font-size: 18px; }
  body.creator-setup .topbar { width: 100%; height: auto; min-height: 68px; margin-left: 0; padding: 10px 16px; }
  body.creator-setup:has(.creator-workspace.sidebar-collapsed) .topbar { width: 100%; margin-left: 0; padding-left: 48px; }
  body.creator-setup .local-badge { display: none; }
  .creator-workspace, .creator-workspace.sidebar-collapsed { display: block; }
  .creator-workspace:not(.player-workspace) { min-height: calc(100vh - var(--creator-header-height, 68px)); margin-top: 0; }
  .creator-workspace:not(.player-workspace) .creator-view { padding-top: 14px; }
  .creator-workspace:not(.player-workspace) .preview-area { min-height: calc(100vh - var(--creator-header-height, 68px)); padding-top: 0; }
  .creator-workspace .sidebar-curtain-rail { width: 0; height: 0; border: 0; background: transparent; box-shadow: none; }
  .creator-workspace .creator-view { position: fixed; top: 0; left: 0; z-index: 22; width: calc(100vw - 32px); height: 100dvh; min-height: 0; padding: 14px 12px 48px; background: #f4f9fc; box-shadow: 10px 0 28px #193f5933; transition: transform .32s ease; }
  .creator-workspace.sidebar-collapsed .creator-view { transform: translateX(-100%); }
  .creator-workspace .sidebar-curtain-toggle { position: fixed; top: 0; left: calc(100vw - 32px); z-index: 24; width: 32px; height: 100dvh; border-left: 1px solid #a8c9dd; border-right: 1px solid #a8c9dd; box-shadow: 5px 0 12px #193f591c; transition: left .32s ease; }
  .creator-workspace.sidebar-collapsed .sidebar-curtain-toggle { left: 0; }
  .creator-workspace:not(.player-workspace) .preview-toolbar { padding-left: 44px; }
  .creator-workspace:not(.player-workspace) .sheet-wrap { grid-template-columns: minmax(0, 1fr); justify-items: start; padding: 18px 12px 18px 44px; }
  .creator-workspace:not(.player-workspace) .puzzle-sheet.is-empty { width: calc(100vw - 68px); min-width: 0; height: 640px; min-height: 640px; padding: 14px; }
  .creator-workspace .puzzle-sheet.is-empty .sheet-head h2 { width: 100%; }
  .creator-workspace .puzzle-sheet.is-empty .sheet-head { gap: 6px; }
  .creator-workspace .puzzle-sheet.is-empty .sheet-meta { position: static; justify-self: end; }
  .creator-workspace .puzzle-sheet.is-empty .preview-grid.is-empty { --cell: min(calc((100vw - 102px) / var(--cols)), calc(530px / var(--rows))) !important; }
  .creator-card { grid-template-columns: 1fr; width: 100%; gap: 14px; }
  .creator-intro { grid-column: 1; grid-template-columns: 1fr; gap: 12px; min-height: 0; padding: 22px; border-radius: 16px; }
  .creator-intro .eyebrow { grid-column: 1; }
  .creator-intro h1 { font-size: 30px; }
  .creator-intro p:last-child { max-width: none; }
  .creator-section, .creator-section[aria-labelledby="image-heading"], .creator-section.generation-section { grid-column: 1; border-radius: 14px; }
  .creator-section-heading { grid-template-columns: 42px minmax(0, 1fr); padding: 19px 18px; }
  .creator-section-heading > span { width: 38px; height: 38px; border-radius: 10px; }
  .creator-section-heading .add-word-button { grid-column: 2; grid-row: 2; justify-self: start; margin-top: 8px; }
  .creator-section-body { padding: 16px; }
  .creator-fields { grid-template-columns: 1fr; }
  .creator-fields .title-field, .creator-fields .solution-field { grid-column: 1; }
  .creator-section .word-row { grid-template-columns: minmax(0, 1fr) 34px; }
  .creator-section .word-row input { grid-column: 1; grid-row: 1; }
  .creator-section .word-row textarea[data-entry-field="definition"] { grid-column: 1 / -1; grid-row: 2; }
  .creator-section .word-row .remove-entry { grid-column: 2; grid-row: 1; }
  .dimension-field { grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr); }
  .preview-toolbar { align-items: flex-start; }
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .tab { min-width: 0; white-space: normal; }
  .puzzle-tools { width: 100%; flex-wrap: wrap; }
  .puzzle-tools .button { white-space: normal; }
  .context-help-popover { max-width: calc(100vw - 100px); }
  .appearance-panel { margin-left: 44px; margin-right: 12px; }
  .player-workspace .appearance-panel { margin-left: 18px; margin-right: 18px; }
}

@media (min-width: 761px) and (max-width: 980px) {
  .creator-section[aria-labelledby="image-heading"], .creator-section.generation-section { grid-column: 1; }
}

@media (max-width: 420px) {
  .appearance-panel .color-setting { grid-template-columns: 38px 82px; gap: 6px 8px; margin-top: 12px; }
  .appearance-panel .color-setting label { grid-column: 1 / -1; }
}

@media print {
  #rating-dialog, #rewarded-ad-dialog, .appearance-panel, .edit-mode-help, .sidebar-curtain-rail { display: none !important; }
  .preview-content { display: block; }
  .preview-grid.is-generating .cell::after { display: none; }
  .creator-workspace, .creator-workspace.sidebar-collapsed { display: block; min-height: 0; margin-top: 0; }
  .creator-workspace:not(.player-workspace) .preview-area { min-height: 0; padding-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .rewarded-ad-grid i, .preview-grid.is-generating .cell::after { animation: none; }
  .preview-grid.is-generating .cell::after { transition: none; }
  .preview-grid.is-generating .cell.search-built::after { opacity: .14; }
  .preview-grid.is-generating .cell.search-neighbor::after { opacity: .1; }
  .preview-grid.is-generating .cell.search-probe::after { opacity: .26; }
  .preview-grid.is-generating .cell.search-reject::after { opacity: .08; }
}
.generation-account { margin-bottom: 20px; padding: 16px; border: 1px solid #cedfe9; border-radius: 12px; background: #f8fbfd; font-size: 14px; line-height: 1.6; }
.generation-account p { margin: 0 0 12px; }
.generation-account .feedback-consent { display: block; font-weight: 400; }
.generation-account input[type="checkbox"] { display: inline-block; width: 18px; height: 18px; min-height: 18px; padding: 0; vertical-align: middle; margin: 0 8px 0 0; }
.generation-account .button { margin: 0 8px 12px 0; }
.developer-panel { border: 2px solid #987246; background: #fffaf2; }
.developer-panel h3 { margin: 0 0 12px; }
.developer-panel label { display: block; margin-bottom: 12px; }
.developer-panel .button { display: inline-flex; max-width: 100%; white-space: normal; align-items: center; justify-content: center; }
#account-details { margin: 12px 0; }
#account-key { display: block; overflow-wrap: anywhere; font-size: 12px; }
#recover-generation { margin-bottom: 16px; }

#creator-entry-loading { display:none; text-align:center; padding:48px 20px; }
.creator-auth-checking #creator-entry-loading { display:block; }
.creator-auth-checking .workspace { visibility:hidden; }
.generation-confirmation { margin:16px 0 12px; font-size:13px; line-height:1.5; }
.generation-consent-row { display:flex; align-items:flex-start; gap:9px; }
.generation-confirmation .feedback-consent { display:flex; flex:1 1 auto; gap:9px; align-items:flex-start; min-width:0; }
.generation-confirmation input[type="checkbox"] { appearance:none; display:grid; place-content:center; flex:0 0 auto; width:20px; min-height:20px; height:20px; margin:1px 0 0; padding:0; border:1.5px solid #8fb2c9; border-radius:4px; background:#fff; box-shadow:none; cursor:pointer; transition:border-color .15s ease, background-color .15s ease; }
.generation-confirmation input[type="checkbox"]::after { content:""; width:5px; height:9px; margin-top:-2px; border:solid #fff; border-width:0 2px 2px 0; transform:rotate(45deg) scale(0); transition:transform .12s ease-out; }
.generation-confirmation input[type="checkbox"]:hover { border-color:#245b7c; }
.generation-confirmation input[type="checkbox"]:checked { border-color:#245b7c; background:#245b7c; }
.generation-confirmation input[type="checkbox"]:checked::after { transform:rotate(45deg) scale(1); }
.generation-confirmation input[type="checkbox"]:focus { border-color:#245b7c; box-shadow:none; }
.generation-confirmation input[type="checkbox"]:focus-visible { outline:3px solid #c7e5f7; outline-offset:2px; }
.generation-confirmation .context-help { margin-top:0; }
.generation-confirmation .context-help-popover { width:min(310px, calc(100vw - 48px)); transform:translateY(3px); }
.generation-confirmation .context-help:hover .context-help-popover, .generation-confirmation .context-help:focus-within .context-help-popover { transform:translateY(0); }
.generation-confirmation .context-help-popover p { margin:0; }
.generation-confirmation .context-help-popover p + p { margin-top:7px; }
.required-mark { margin-left:2px; color:#b22d24; font-size:16px; font-weight:900; line-height:1; }

/* The attribution travels on the printed puzzle page, including Pro layouts. */
.print-source-note { position: absolute; bottom: 5.5mm; left: 10mm; right: 10mm; font: var(--print-source-font, 7pt)/1.15 Arial, sans-serif; color: var(--puzzle-sourceText, #193f59); white-space: nowrap; }
.print-source-note a { color: inherit; text-decoration: none; }
.clue-reader { position: fixed; z-index: 60; display: flex; flex-direction: column; padding: 10px 12px; border: 1px solid #aecddd; border-radius: 10px; background: #fff; color: #193f59; box-shadow: 0 8px 24px #193f5933; font: 18px/1.4 Arial, sans-serif; }
.clue-reader-heading { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 8px; min-height: 28px; font-size: 12px; cursor: grab; touch-action: none; user-select: none; }
.clue-reader-heading.dragging { cursor: grabbing; }
.clue-reader-heading strong { min-width: 0; overflow-wrap: anywhere; }
.clue-reader-tools { display: inline-flex; flex-shrink: 0; gap: 2px; }
.clue-reader-tools [data-clue-size] { width: 30px !important; font-size: 13px !important; font-weight: 700; }
.clue-reader-tools button:disabled { opacity: .35; cursor: default; }
.clue-reader p { font-size: calc(1em * var(--clue-reader-scale, 1)); }
.clue-reader-heading button { flex-shrink: 0; width: 28px; height: 28px; border: 0; border-radius: 4px; padding: 0; background: transparent; color: inherit; cursor: pointer; font-size: 22px; line-height: 1; }
.clue-reader-heading button:hover { background: #e7f2f8; }
.clue-reader p { min-height: 0; margin: 8px 0 0; overflow: auto; overflow-wrap: anywhere; }
@media print { .clue-reader { display: none !important; } }
@media print {
  @page ahagrid-portrait { size: A4 portrait; margin: 0; }
  html, html.creator-page, body, body.creator-page { width: auto !important; max-width: none !important; min-width: 0 !important; height: auto !important; overflow: visible !important; }
  body.creator-setup { margin: 0 !important; padding: 0 !important; }
  .creator-workspace, .creator-workspace.sidebar-collapsed,
  .creator-workspace:not(.player-workspace), .creator-workspace.player-workspace {
    display: block !important; width: auto !important; min-height: 0 !important; margin: 0 !important;
  }
  .creator-workspace .creator-view, .creator-workspace .sidebar-curtain-rail { display: none !important; }
  .creator-workspace .preview-area,
  .creator-workspace:not(.player-workspace) .preview-area,
  .creator-workspace.player-workspace .preview-area {
    display: block !important; width: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important;
  }
  .creator-workspace .sheet-wrap {
    display: block !important; width: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: visible !important;
  }
  .creator-workspace .puzzle-sheet {
    page: ahagrid-portrait; margin: 0 !important; zoom: 1 !important; transform: none !important;
    break-before: avoid; break-after: avoid; break-inside: avoid; page-break-before: avoid; page-break-after: avoid; page-break-inside: avoid;
  }
  .creator-workspace .puzzle-sheet[data-paper="landscape"] { page: ahagrid-landscape; }
}
#license-note { white-space: pre-line; overflow-wrap: anywhere; }
.puzzle-tutorial-ready .preview-notes, .puzzle-tutorial-ready #edit-mode-help { display: none !important; }
.puzzle-tutorial-host { align-self: center; width: min(210mm, calc(100% - 68px)); min-width: 0; margin: 16px auto 0; }
.puzzle-tutorial { padding: 16px 18px; border: 1px solid #aecddd; border-radius: 14px; color: #244f69; background: #edf6fc; box-shadow: 0 8px 22px #193f590d; }
.puzzle-tutorial-heading, .puzzle-tutorial-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.puzzle-tutorial-count { font-size: 12px; font-weight: 700; color: #527084; }
.puzzle-tutorial h3 { margin: 3px 0 8px; font-size: 18px; }
.puzzle-tutorial-text { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.puzzle-tutorial-actions { margin-top: 14px; }
.puzzle-tutorial-actions button, .puzzle-tutorial-reopen { min-height: 44px; padding: 9px 14px; border: 1px solid #aecddd; border-radius: 9px; color: #244f69; background: #fff; font: inherit; font-size: 13px; font-weight: 700; }
.puzzle-tutorial-actions button:last-child { color: #fff; background: #245b7c; border-color: #245b7c; }
.puzzle-tutorial-actions button:disabled { opacity: .5; cursor: default; }
.puzzle-tutorial-close { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; margin: -8px -8px -4px 0; padding: 0; border: 0; border-radius: 9px; color: #244f69; background: transparent; font-size: 25px; }
.puzzle-tutorial button:hover:not(:disabled) { filter: brightness(.96); }
.puzzle-tutorial button:focus-visible, .puzzle-tutorial-reopen:focus-visible { outline: 2px solid #2670a5; outline-offset: 3px; }
@media screen and (max-width: 760px) {
  .puzzle-tutorial-host { align-self: flex-start; width: calc(100% - 56px); margin: 16px 12px 0 44px; }
}
@media print { .puzzle-tutorial-host { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  body.creator-setup .topbar, .creator-workspace, .creator-workspace .creator-view, .creator-workspace .sidebar-curtain-toggle, .sidebar-curtain-toggle svg { transition: none; }
}


/* All placed pairs in a compact, local editor. */
.puzzle-tools:has(#open-pair-editor:not([hidden])) { flex-wrap: wrap; min-width: 0; max-width: 100%; }
#pair-editor-dialog { width: min(920px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; overflow: auto; border: 1px solid #aac8dc; border-radius: 14px; color: #193f59; background: #fff; }
#pair-editor-dialog::backdrop { background: #142f4973; }
.pair-editor-heading { position: sticky; top: 0; z-index: 1; padding: 18px 22px 10px; border-bottom: 1px solid #dce9f2; background: #f4f9fc; }
.pair-editor-heading .dialog-heading { align-items: center; padding-bottom: 10px; border: 0; }
.pair-editor-heading h2 { font-size: 23px; }
.pair-editor-heading p { margin: 0 0 10px; font-size: 13px; line-height: 1.45; }
.pair-editor-search { display: grid; gap: 5px; font-size: 13px; font-weight: 700; }
#pair-editor-count { margin: 8px 0 0; }
.pair-editor-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 8px 14px; padding: 14px 22px; border-bottom: 1px solid #e1ebf1; }
.pair-editor-row label { display: grid; align-content: start; gap: 5px; min-width: 0; font-size: 13px; font-weight: 700; }
.pair-editor-answer > span { display: flex; justify-content: space-between; gap: 8px; }
.pair-editor-answer small { color: #527084; font-size: 12px; }
#pair-editor-dialog input, #pair-editor-dialog textarea { width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; border: 1px solid #bfd2df; border-radius: 8px; color: #193f59; background: #fff; font: inherit; font-size: 16px; }
#pair-editor-dialog textarea { resize: none; overflow: hidden; line-height: 1.4; }
#pair-editor-dialog [aria-invalid="true"] { border-color: #a32626; background: #fff5f3; }
#pair-editor-dialog :focus-visible { outline: 2px solid #2670a5; outline-offset: 2px; }
.pair-editor-error-line { grid-column: 1 / -1; }
.pair-editor-error { margin: 0 0 4px; color: #a32626; font-size: 13px; }
#pair-editor-status { margin: 0; padding: 12px 22px; font-size: 13px; color: #527084; }
#pair-editor-dialog button { min-height: 44px; }
@media (max-width: 600px) { .pair-editor-row { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; } .pair-editor-heading { padding: 14px 16px 10px; } .pair-editor-heading h2 { font-size: 20px; } }
@media print { #pair-editor-dialog, #open-pair-editor { display: none !important; } }

/* Preserve complete notices when a source requires them on distributed copies. */
.print-license-appendix { display: none; }
@media print {
  .print-license-appendix:not([hidden]) { display: block !important; page: ahagrid-portrait; box-sizing: border-box;
    width: 210mm; min-height: 297mm; margin: 0; padding: 18mm; break-before: page; page-break-before: always;
    color: #111; background: white; font: 10pt/1.4 Arial, sans-serif; }
  .print-license-appendix h2 { font-size: 14pt; }
  .print-license-appendix pre { font: inherit; white-space: pre-wrap; overflow-wrap: break-word; }
}


/* Follow the shared cell border, then turn at the answer cell's midline; also printed. */
.cell.clue .direction-marker.corner-route { display:none; }
.corner-route-layer { position:absolute; inset:0; z-index:8; pointer-events:none; }
.corner-route-layer .direction-marker.corner-route { position:absolute; display:block; width:calc(var(--cell)*.24); height:calc(var(--cell)*.60); border:0; color:var(--puzzle-arrow,#111); pointer-events:none; }
.corner-route-layer .corner-route svg { display:block; width:100%; height:100%; }
.cell.corner-pad-r { --corner-pad-r:0px; }
.cell.clue.corner-reserved { padding:max(2px,var(--corner-pad-t,0px)) max(2px,var(--corner-pad-r,0px)) max(2px,var(--corner-pad-b,0px)) max(2px,var(--corner-pad-l,0px)); }


.cell.clue.corner-reserved { grid-template-columns:minmax(0,1fr); min-width:0; min-height:0; }
.cell.clue.corner-reserved:not(.double) { grid-template-rows:minmax(0,1fr); }
.cell.clue.corner-reserved .clue-part { min-width:0; min-height:0; }


/* Display-only learning instructions: visible on the sheet and in print. */
.learning-display-guide { display:block; margin:1mm 0 0; color:var(--puzzle-clueText,#171717); font:11px/1.25 Arial,sans-serif; text-align:left; white-space:normal; overflow-wrap:normal; }
.learning-display-guide[hidden] { display:none!important; }
@media print { .learning-display-guide { color:#111; break-inside:avoid; } }
/* Solve celebration (2026-10-31): season shapes from season.css; plain confetti without it. */
.solve-celebration { position: fixed; inset: 0; z-index: 80; overflow: hidden; pointer-events: none; }
.solve-celebration .burst { position: absolute; top: -48px; width: var(--size); aspect-ratio: 1; background: var(--colour); opacity: 0;
  -webkit-mask: var(--shape) center / contain no-repeat; mask: var(--shape) center / contain no-repeat;
  animation: solve-fall var(--duration) linear var(--delay) forwards; }
.solve-celebration .shape-confetti { -webkit-mask: none; mask: none; aspect-ratio: .55; border-radius: 1px; }
.solve-celebration .shape-snow { -webkit-mask: none; mask: none; border-radius: 50%; }
.solve-celebration .shape-bubble { -webkit-mask: none; mask: none; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffffffee 0 18%, var(--colour) 70%); opacity: .8; }
.solve-celebration .shape-ghost { --shape: var(--shape-ghost); aspect-ratio: 24 / 26; }
.solve-celebration .shape-bat { --shape: var(--shape-bat); aspect-ratio: 24 / 14; }
.solve-celebration .shape-pumpkin { --shape: var(--shape-pumpkin); }
.solve-celebration .shape-leaf { --shape: var(--shape-leaf); }
.solve-celebration .shape-star { --shape: var(--shape-star); }
.solve-celebration .shape-tree { --shape: var(--shape-tree); }
.solve-celebration .shape-snowflake { --shape: var(--shape-snowflake); }
.solve-celebration .shape-petal { --shape: var(--shape-petal); }
.solve-celebration .shape-tulip { --shape: var(--shape-tulip); }
.solve-celebration .shape-butterfly { --shape: var(--shape-butterfly); aspect-ratio: 24 / 20; }
.solve-celebration .shape-sun { --shape: var(--shape-sun); }
.solve-celebration .shape-pencil { --shape: var(--shape-pencil); }
.solve-celebration .shape-balloon { --shape: var(--shape-balloon); aspect-ratio: 24 / 32; }
.solve-celebration .shape-heart { --shape: var(--shape-heart); }
.solve-celebration .shape-cap { --shape: var(--shape-cap); }
.solve-celebration .shape-apple { --shape: var(--shape-apple); }
.solve-celebration .shape-tie { --shape: var(--shape-tie); }
.solve-celebration .shape-boot { --shape: var(--shape-boot); }
.solve-celebration[data-celebration="fireworks"] .burst { width: 8px; filter: drop-shadow(0 0 3px var(--colour)); animation: solve-firework 2.8s ease-out var(--delay) forwards; }
@keyframes solve-firework {
  0% { opacity: 0; transform: translate(0, 0) scale(.2); }
  14% { opacity: 1; }
  65% { opacity: .9; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.4); }
}
@keyframes solve-fall {
  /* Linear segments with an even pace: the pieces fall through the whole page without pausing midway. */
  0% { transform: translate(0, 0) rotate(0); opacity: 0; }
  6% { opacity: 1; }
  50% { transform: translate(var(--sway), calc(50vh + 64px)) rotate(calc(var(--spin) * .5)); }
  92% { opacity: 1; }
  100% { transform: translate(calc(var(--sway) * -.3), calc(100vh + 120px)) rotate(var(--spin)); opacity: 0; }
}
@media print { .solve-celebration { display: none !important; } }
/* Built-in image picker (2026-10-31). */
.stock-image-picker { display: grid; gap: 18px; margin: 12px 0 4px; padding: 16px; border: 1px solid #d7e1e7; border-radius: 14px; background: #f7fafb; }
.stock-image-heading { margin: 0 0 10px; color: #527084; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; }
.stock-image-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
.stock-image-option { position: relative; display: flex; flex-direction: column; padding: 4px; overflow: hidden; border: 1px solid #d7e1e7; border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 2px 5px #193f5908; }
.stock-image-option img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.stock-image-option > span { width: 100%; padding: 6px 1px 3px; font-size: 11px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.stock-image-option:hover, .stock-image-option:focus-visible { border-color: #245b7c; outline: 2px solid #245b7c; outline-offset: 1px; }
.stock-image-option[aria-pressed="true"] { border-color: #245b7c; box-shadow: 0 0 0 2px #245b7c; background: #edf5f8; }
.stock-image-option[aria-pressed="true"]::after { content: "✓"; position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #245b7c; color: #fff; font-size: 14px; box-shadow: 0 1px 4px #0003; }
.stock-image-picker[aria-busy="true"] .stock-image-option { cursor: progress; }
.stock-image-picker .field-note { margin: 0; }
.appearance-icon-section { margin: 4px 0 14px; }
.appearance-icon-section h3 { margin: 0 0 8px; font-size: 14px; }
/* Solving hides the solution, editing and appearance controls (2026-11-01). */
.tab[hidden], #open-appearance[hidden], #switch-mode[hidden] { display: none !important; }
