:root {
  --app-height: 100dvh;
  --viewport-top: 0px;
  --linen: #d6c2a4;
  --paper: #efe0c9;
  --ink: #1c2924;
  --pine: #17352f;
  --rust: #9f351e;
  --wood: #9b673b;
  --add: #a93f26;
  --remove: #474365;
  --change: #c9691f;
  --rhyme: #215b87;
  --synonym: #245a40;
  --homophone: #855263;
  --anagram: #653b55;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.game-page { position: fixed; inset: 0; width: 100%; height: 100%; color: var(--ink); background: var(--linen); font-family: Georgia, "Times New Roman", serif; overflow: hidden; }
.app-shell {
  position: fixed;
  top: var(--viewport-top);
  left: 0;
  width: 100%;
  height: var(--app-height);
  min-height: 0;
  display: grid;
  grid-template-rows: 30px auto minmax(0, 1fr) auto 62px;
  overflow: hidden;
  background: var(--linen) url("./assets/linen.webp") repeat center / 480px auto;
}
.app-shell::before, .app-shell::after {
  content: "";
  display: block;
  box-shadow: 0 3px 7px #2f211d55;
  z-index: 6;
}
.app-shell::before { grid-row: 1; background: url("./assets/weaving-top-wide.webp") center bottom / cover no-repeat; }
.app-shell::after { grid-row: 5; background: url("./assets/weaving-bottom-wide.webp") center top / cover no-repeat; box-shadow: 0 -3px 7px #2f211d55; }

.app-header {
  grid-row: 2;
  min-height: 106px;
  padding: 14px clamp(12px, 2.8vw, 36px) 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 2vw, 28px);
  background: linear-gradient(#17352fe8, #17352ff0), url("./assets/tapestry-top.webp") center / auto 100% repeat-x;
  position: relative;
  z-index: 5;
  box-shadow: 0 6px 9px #3b292149;
}
.app-header::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 10px;
  background: linear-gradient(175deg, #16342d 35%, transparent 38%);
  pointer-events: none;
}
.site-name {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 clamp(10px, 2vw, 27px);
  background: linear-gradient(160deg, #f8ecd9, #ebdac0);
  box-shadow: 4px 5px 6px #0a1b1880;
  color: #10372f;
  font: 400 clamp(42px, 6.2vw, 88px)/1 Georgia, serif;
  letter-spacing: -.075em;
  white-space: nowrap;
  text-shadow: 1px 1px #f9eddb, -1px -1px #446a5a33;
  clip-path: polygon(0 0, 100% 0, 100% 94%, 96% 95%, 93% 93%, 88% 96%, 83% 94%, 79% 97%, 75% 95%, 70% 97%, 65% 94%, 59% 96%, 54% 94%, 47% 97%, 40% 94%, 35% 97%, 29% 94%, 22% 96%, 16% 94%, 10% 97%, 0 95%);
}
.site-name img { width: clamp(185px, 36vw, 535px); height: auto; max-height: 83px; object-fit: contain; display: block; }
.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.help-mark { width: 48px; height: 48px; padding: 0; display: grid; place-items: center; border: 2px solid #e9d5ad; border-radius: 50%; background: #f6ead8; color: var(--pine); box-shadow: 0 3px 6px #071c1770; font: 600 30px/1 Georgia, serif; }
.help-mark:focus-visible { outline: 2px solid #e9d5ad; outline-offset: 3px; }

.playfield {
  grid-row: 3;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #8b663f77 transparent;
  touch-action: pan-y;
  background:
    radial-gradient(ellipse at 50% 48%, #d9c3a321 28%, #a7846128 100%),
    linear-gradient(#d9c5a8a6, #d9c5a8a6),
    url("./assets/linen.webp") repeat center / 330px auto;
}
.playfield.history-locked { overflow-y: auto; overscroll-behavior-y: none; }
.playfield-content {
  width: min(calc(100% - 34px), 1050px);
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(15px, 3vh, 38px) 0 9px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.playfield-content.has-history { justify-content: flex-end; }
.playfield.history-locked .history-rows { display: none; }
.playfield.history-locked .playfield-content.has-history { justify-content: center; }
.loading { margin: 24vh auto; width: 76px; height: 76px; display: grid; place-items: center; color: var(--pine); }
.loading-loop { position: relative; width: 58px; height: 58px; border: 5px dashed #876044; border-radius: 50%; box-shadow: inset 0 0 0 3px #d6b487, 0 0 0 2px #ead6b9; animation: thread-orbit 2.2s linear infinite; }
.loading-loop::before, .loading-loop::after { content: ""; position: absolute; inset: -8px 4px; border: 3px solid transparent; border-left-color: #9f351e; border-right-color: #9f351e; border-radius: 50%; transform: rotate(55deg); }
.loading-loop::after { transform: rotate(-55deg); border-left-color: #245a40; border-right-color: #245a40; }
.loading.loading-error { width: min(90vw, 440px); height: auto; text-align: center; line-height: 1.5; }
@keyframes thread-orbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-loop { animation: none; } }
.tapestry-svg { position: absolute; inset: 0; width: 100%; z-index: 0; pointer-events: none; overflow: visible; }
.loom-rail-image { filter: drop-shadow(0 3px 2px #3c27165e); }
.thread-shadow { fill: none; stroke: #39291d70; stroke-width: 10; stroke-linecap: round; transform: translate(1px, 2px); }
.thread-line { fill: none; stroke: #ae8b69; stroke-width: 8; stroke-linecap: round; }
.thread-fiber { fill: none; stroke: url(#yarn-fiber); stroke-width: 8; stroke-linecap: round; mix-blend-mode: multiply; opacity: .53; }
.thread-hit { fill: none; stroke: transparent; stroke-width: 28; pointer-events: stroke; cursor: pointer; }
.thread-hit:focus-visible { stroke: #fff5e588; stroke-width: 15; outline: none; }
.thread-line.type-add { stroke: var(--add); }
.thread-line.type-remove { stroke: var(--remove); }
.thread-line.type-change { stroke: var(--change); }
.thread-line.type-rhyme { stroke: var(--rhyme); }
.thread-line.type-synonym { stroke: var(--synonym); }
.thread-line.type-homophone { stroke: var(--homophone); }
.thread-line.type-anagram { stroke: var(--anagram); }

.history-rows { display: flex; flex-direction: column; gap: 0; position: relative; z-index: 1; }
.history-entry { padding: 4px 0 82px; }
.history-date, .current-label {
  display: table;
  width: max-content;
  margin: 0 auto 28px;
  padding: 10px 24px 9px;
  border: 3px double #b68b56;
  border-radius: 23px;
  background: #193730;
  box-shadow: 0 3px 4px #4d321b6b, inset 0 0 0 2px #122922;
  color: #f2e2c9;
  font: 400 clamp(10px, 1.2vw, 15px)/1 Georgia, serif;
  letter-spacing: .19em;
  text-align: center;
  text-transform: uppercase;
}
.history-date { display: block; }
.history-date:focus-visible, .current-label:focus-visible { outline: 2px solid #b28652; }
.current-heading { position: relative; z-index: 2; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; }
.current-label { position: relative; z-index: 1; grid-column: 2; margin-inline: 0; }
.history-lock { position: relative; grid-column: 3; justify-self: start; width: 35px; height: 35px; margin: 0 0 28px 12px; border: 2px solid #b68b56; border-radius: 50%; background: #193730; color: #f2e2c9; display: grid; place-items: center; box-shadow: 0 2px 4px #4d321b6b; }
.history-lock img { width: 19px; height: 19px; filter: brightness(0) saturate(100%) invert(88%) sepia(14%) saturate(348%) hue-rotate(344deg) brightness(108%); }
.history-lock:focus-visible { outline: 2px solid #b28652; outline-offset: 2px; }
.word-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1.5vw, 18px); width: 100%; position: relative; z-index: 1; }
.word-card, .history-word { min-width: 0; background: linear-gradient(135deg, #fcf2e7, #f2e5d4); color: #181b19; box-shadow: 0 3px 5px #47331d72, inset 0 1px #fffaf2; }
.source-card, .history-word, .answer-tile { border: 2px solid #b79570; border-radius: 11px; position: relative; }
.source-card::after, .history-word::after, .answer-tile::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px dashed var(--stitch-color, #b37d48);
  border-radius: 7px;
  pointer-events: none;
  filter: drop-shadow(0 1px #fffaf0);
}
.source-card { height: clamp(80px, 10vh, 115px); padding: 9px 5px; display: grid; place-items: center; text-align: center; font: 600 var(--fit-font-size, clamp(19px, 2.6vw, 30px))/1 Georgia, serif; white-space: nowrap; overflow: hidden; }
.source-card:nth-child(3) { --stitch-color: #ad791d; }
.history-word { height: 75px; display: grid; place-items: center; text-align: center; font: 500 var(--fit-font-size, clamp(15px, 2vw, 24px)) Georgia, serif; overflow: hidden; white-space: nowrap; }
.loom-gap { height: clamp(100px, 17vh, 180px); flex: none; }
.answer-card { min-width: 0; position: relative; display: flex; flex-direction: column; align-items: stretch; transition: transform .15s; }
.answer-tile { height: clamp(83px, 10.5vh, 116px); display: flex; align-items: center; justify-content: center; padding: 8px 12px; touch-action: none; user-select: none; }
.answer-card.type-add { --stitch-color: var(--add); }
.answer-card.type-remove { --stitch-color: var(--remove); }
.answer-card.type-change { --stitch-color: var(--change); }
.answer-card.type-rhyme { --stitch-color: var(--rhyme); }
.answer-card.type-synonym { --stitch-color: var(--synonym); }
.answer-card.type-homophone { --stitch-color: var(--homophone); }
.answer-card.type-anagram { --stitch-color: var(--anagram); }
.answer-card.is-invalid { --stitch-color: #a44639; }
.answer-card.dragging { z-index: 5; opacity: .92; transition: none; }
.answer-card.dragging .answer-tile { box-shadow: 0 14px 25px #32251a9c; }
.answer-card.drop-target .answer-tile { outline: 3px dashed #705031; outline-offset: 4px; }
.answer-input { --default-input-size: clamp(18px, 2.5vw, 30px); width: 100%; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); text-align: center; text-transform: uppercase; font: 600 var(--fit-font-size, var(--default-input-size))/1 Georgia, serif; letter-spacing: -.035em; }
.answer-input:focus { font-size: var(--fit-font-size, var(--default-input-size)); }
.answer-input::placeholder { color: #a8977c; letter-spacing: .12em; }
.answer-tile:focus-within { outline: 3px solid #966728; outline-offset: 3px; }
.drag-handle { position: absolute; right: 6px; bottom: 5px; z-index: 2; width: 27px; height: 26px; padding: 0; border: 1px solid #78563799; border-radius: 5px; background: #f2dfc4d9; color: #7e5933; font: 21px/1 Georgia, serif; cursor: grab; touch-action: none; user-select: none; }
.drag-handle:focus-visible { background: #e0bd85; outline: 2px solid #8a5929; }
.drag-handle:active { cursor: grabbing; }
.answer-status { min-height: 52px; padding: 8px 2px 0; display: flex; justify-content: center; align-items: flex-start; flex-wrap: wrap; gap: 4px; color: #8d4836; text-align: center; font: 12px/1.3 Georgia, serif; }
.type-chip {
  --chip-color: #745944;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.type-chip.type-add { --chip-color: var(--add); }
.type-chip.type-remove { --chip-color: var(--remove); }
.type-chip.type-change { --chip-color: var(--change); }
.type-chip.type-rhyme { --chip-color: var(--rhyme); }
.type-chip.type-synonym { --chip-color: var(--synonym); }
.type-chip.type-homophone { --chip-color: var(--homophone); }
.type-chip.type-anagram { --chip-color: var(--anagram); }
.type-chip.invalid-chip { --chip-color: #a44639; }
.type-chip .chip-symbol { width: 38px; height: 38px; border-radius: 50%; background: var(--chip-color); display: grid; place-items: center; }
.invalid-chip .chip-symbol { color: #fff8e9; font: 700 34px/1 Arial, sans-serif; }
.type-chip .chip-symbol img { display: block; width: 75%; height: 75%; }
.type-chip:not(.is-selected) .chip-symbol { opacity: .62; }
.type-chip.invalid-chip .chip-symbol { opacity: 1; }
.type-chip.is-selected { outline: none; }
.type-chip:focus-visible { outline: 2px solid var(--chip-color); outline-offset: 2px; }
.options-trigger { align-self: center; padding: 0; border: 0; background: none; color: #3c5547; font: 700 11px Georgia, serif; text-decoration: underline; text-underline-offset: 3px; }
.word-nav { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; width: min(340px, 90%); margin: 8px auto 0; color: var(--pine); font: 13px Georgia, serif; }
.word-nav button { border: 1px solid #8d704f; border-radius: 20px; padding: 7px 11px; background: #f2e2c9; color: var(--pine); }
.word-nav button:disabled { opacity: .45; }

.app-footer {
  grid-row: 4;
  position: relative;
  z-index: 5;
  padding: 10px clamp(12px, 4vw, 60px) 15px;
  background: linear-gradient(#dec9aa9e, #dec9aa9e), url("./assets/linen.webp") repeat center / 330px auto;
  box-shadow: 0 -4px 10px #5c442947;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
}
.footer-actions { position: relative; width: 100%; display: flex; align-items: center; justify-content: center; }
.main-action { min-width: min(300px, 82vw); height: 52px; padding: 0 20px; border: 3px double #c4a471; border-radius: 28px; background: #17342d; color: #f5e8d5; box-shadow: 0 3px 5px #57412a85, inset 0 0 0 2px #0f261f; display: flex; align-items: center; justify-content: center; gap: 12px; font: 400 clamp(17px, 2vw, 24px)/1 Georgia, serif; }
.main-action:disabled { opacity: .68; cursor: default; }
.main-action.is-ineligible { opacity: .68; cursor: pointer; }
.main-action span { font-size: 26px; line-height: .6; }
.transformations { width: min(100%, 960px); }
.footer-caption { display: flex; align-items: center; gap: 13px; margin: 0 0 12px; color: #3d3124; text-align: center; white-space: nowrap; font: 400 clamp(11px, 1.4vw, 15px)/1 Georgia, serif; letter-spacing: .16em; }
.footer-caption::before, .footer-caption::after { content: ""; height: 1px; flex: 1; background: #755c3e; }
.legend { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(4px, 1vw, 14px); }
.legend-item { --legend-color: #765540; min-width: 0; min-height: 83px; padding: 5px 2px 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #241d18; white-space: nowrap; text-align: center; font: 400 clamp(10px, 1.3vw, 16px)/1 Georgia, serif; }
.legend-item b { width: 44px; height: 44px; border-radius: 50%; background: var(--legend-color); display: grid; place-items: center; }
.legend-item b img { display: block; width: 74%; height: 74%; }
.legend-item.in-use { gap: 8px; }
.legend-item.in-use b { outline: 2px solid var(--legend-color); outline-offset: 3px; box-shadow: 0 3px 8px #33271b77; }
.legend-item.in-use span { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.legend-item.type-add { --legend-color: var(--add); }
.legend-item.type-remove { --legend-color: var(--remove); }
.legend-item.type-change { --legend-color: var(--change); }
.legend-item.type-rhyme { --legend-color: var(--rhyme); }
.legend-item.type-synonym { --legend-color: var(--synonym); }
.legend-item.type-homophone { --legend-color: var(--homophone); }
.legend-item.type-anagram { --legend-color: var(--anagram); }

.app-dialog { position: fixed; width: min(500px, calc(100vw - 30px)); max-height: min(85dvh, 700px); overflow-y: auto; border: 2px solid #a37d4f; border-radius: 14px; padding: clamp(23px, 5vw, 36px); background: #fff9ef; color: var(--ink); box-shadow: 0 22px 70px #11201baa; }
.app-dialog::backdrop { background: #0a1e19bb; backdrop-filter: blur(3px); }
.dialog-close { position: absolute; right: 13px; top: 12px; width: 38px; height: 38px; border: 1px solid #cdb995; border-radius: 50%; background: #f5e8d5; color: #673b2b; font: 27px/1 Georgia, serif; }
.dialog-close:focus-visible, .dialog-link:focus-visible, .dialog-actions button:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }
.dialog-kicker { padding-right: 35px; font: 700 11px Georgia, serif; letter-spacing: .17em; color: #794c2b; }
.app-dialog h2 { margin: 12px 0 18px; font: 400 clamp(28px, 6vw, 38px)/1.12 Georgia, serif; letter-spacing: -.035em; }
.app-dialog p { color: #25382e; font-size: 16px; line-height: 1.62; }
.dialog-section-title { margin-top: 24px; padding-top: 18px; border-top: 1px solid #d1bfa4; color: #794c2b; font: 700 11px Georgia, serif; letter-spacing: .15em; text-transform: uppercase; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.dialog-actions button { padding: 10px 15px; border: 1px solid #9e8060; border-radius: 20px; background: #f2e4d0; color: var(--pine); font: 700 14px Georgia, serif; }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 17px 0; border-bottom: 1px solid #d1bfa4; font-size: 16px; }
.setting-row input { accent-color: #576f58; width: 20px; height: 20px; }
.dialog-link { display: inline-block; margin-top: 22px; color: #315842; font-size: 15px; text-underline-offset: 3px; }
.options-dialog { width: min(540px, calc(100vw - 25px)); }
.options-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.options-tabs button { min-width: 0; border: 1px solid #ae9e83; border-radius: 6px; padding: 11px 4px; color: #284c39; background: #f8eddc; font: 700 13px Georgia, serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.options-tabs button[aria-pressed="true"] { background: #27513e; color: #fff8e9; }
.options-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 20px 0 8px; }
.option-count { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 11px; border: 1px solid #d3c1a9; border-radius: 7px; background: #fcf5ea; font-size: 14px; }
.option-total { grid-column: 1 / -1; border-color: #7e9b83; background: #e6efe4; font-weight: 700; }
.option-count span { display: flex; align-items: center; gap: 7px; }
.option-count b { display: grid; place-items: center; width: 20px; height: 20px; }
.option-count b img { display: block; width: 20px; height: 20px; }
.option-count strong { color: var(--ink); }
.thread-dialog { text-align: center; width: min(350px, calc(100vw - 30px)); }
.thread-dialog .dialog-kicker { padding-right: 0; }
.thread-dialog-symbol { width: 74px; height: 74px; margin: 19px auto 10px; border-radius: 50%; background: var(--symbol-color, var(--pine)); display: grid; place-items: center; }
.thread-dialog-symbol img { width: 48px; height: 48px; }
.thread-dialog-symbol.type-add { --symbol-color: var(--add); }
.thread-dialog-symbol.type-remove { --symbol-color: var(--remove); }
.thread-dialog-symbol.type-change { --symbol-color: var(--change); }
.thread-dialog-symbol.type-rhyme { --symbol-color: var(--rhyme); }
.thread-dialog-symbol.type-synonym { --symbol-color: var(--synonym); }
.thread-dialog-symbol.type-homophone { --symbol-color: var(--homophone); }
.thread-dialog-symbol.type-anagram { --symbol-color: var(--anagram); }
.thread-dialog h2 { margin-bottom: 5px; }
.thread-dialog p { margin: 0; }
.dialog-footnote { margin-bottom: 0; font-size: 12px !important; }
.credit-field { display: grid; gap: 9px; margin: 20px 0 16px; font-size: 14px; }
.credit-field input { width: 100%; padding: 12px; border: 1px solid #a89070; border-radius: 5px; background: #fff8ea; color: var(--ink); font: 16px Georgia, serif; }
.dialog-submit { border: 1px solid #a17848; border-radius: 30px; background: #193a30; color: #fff3e0; padding: 10px 22px; font: 18px Georgia, serif; }
.dialog-submit:disabled { opacity: .55; }
#submit-status { min-height: 22px; margin: 10px 0 0; }
.submit-entry-words { margin: 0 0 17px; padding: 9px 0; border-top: 1px solid #d4bda0; border-bottom: 1px solid #d4bda0; color: var(--pine); font: 600 clamp(17px, 4vw, 21px)/1.35 Georgia, serif; overflow-wrap: anywhere; }
.submit-guidance { margin: 14px 0 0; padding-left: 22px; color: var(--ink); font: 15px/1.5 Georgia, serif; }
.submit-guidance li + li { margin-top: 9px; }
#submit-edit { margin-top: 20px; }
.submit-result { text-align: center; padding: 18px 2px 4px; }
.submit-result .dialog-kicker { padding-right: 0; }
.submit-result-mark { width: 66px; height: 66px; margin: 0 auto 20px; display: grid; place-items: center; border: 5px double #e8d7af; border-radius: 50%; background: var(--pine); color: #fff8e9; font: 36px/1 Georgia, serif; box-shadow: 0 3px 9px #3b292149; }
.submit-result.is-duplicate .submit-result-mark { background: #946334; }
.submit-result h2 { margin-bottom: 12px; }
.submit-result-words { margin: 0 auto 15px; padding: 9px 12px; border-top: 1px solid #d4bda0; border-bottom: 1px solid #d4bda0; font: 600 16px/1.4 Georgia, serif !important; overflow-wrap: anywhere; }
.submit-result-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 24px; }
.submit-result-actions button { min-width: 0; padding: 11px 12px; }
.submit-secondary { border: 1px solid #9e8060; border-radius: 30px; background: #f2e4d0; color: var(--pine); font: 16px Georgia, serif; }
@media (max-width: 480px) { .submit-result-actions { grid-template-columns: 1fr; } }

body:not(.game-page) { margin: 0; background: #d6c2a4 url("./assets/linen.webp") repeat center / 480px auto; color: var(--ink); font-family: Georgia, serif; }
.page-shell { max-width: 900px; margin: auto; padding: 25px; }
.site-header { border-bottom: 1px solid #9a754e; padding-bottom: 20px; }
.brand { color: var(--pine); text-decoration: none; font: 400 29px Georgia, serif; }
.brand-mark { color: var(--rust); margin-right: 10px; }
.credits-page { max-width: 720px; margin: 65px auto 100px; }
.credits-page .kicker { color: #8b502b; font: 700 10px Georgia, serif; letter-spacing: .2em; }
.credits-page h1 { font: 400 clamp(52px, 8vw, 82px) Georgia, serif; letter-spacing: -.055em; margin: 15px 0 30px; }
.credits-page h2 { margin-top: 34px; font: 400 26px Georgia, serif; }
.credits-page p { font-size: 16px; line-height: 1.65; }
.credits-page a { color: #1c5941; }

@media (max-width: 900px) {
  .app-header { min-height: 85px; }
  .site-name img { width: clamp(165px, 36vw, 300px); }
}
@media (max-width: 680px) {
  .app-shell { grid-template-rows: 27px auto minmax(0, 1fr) auto 62px; }
  .app-header { min-height: 76px; padding: 9px 7px 11px 0; gap: 5px; }
  .site-name { flex: 0 1 auto; min-width: 0; padding: 0 7px; }
  .site-name img { width: clamp(135px, 42vw, 210px); max-height: 54px; }
  .help-mark { width: 40px; height: 40px; font-size: 26px; }
  .playfield-content { width: calc(100% - 12px); padding: clamp(48px, 6vh, 62px) 0 10px; }
  .history-entry { padding-bottom: 55px; }
  .history-word { height: 54px; padding: 4px 1px; font-size: var(--fit-font-size, clamp(16px, 4.5vw, 22px)); }
  .current-label { margin-bottom: 18px; padding: 8px 17px; font-size: 10px; }
  .history-lock { width: 29px; height: 29px; margin-bottom: 18px; margin-left: 9px; }
  .history-lock img { width: 16px; height: 16px; }
  .word-row { display: grid; grid-template-columns: var(--phrase-columns, repeat(4, minmax(0, 1fr))); gap: 3px; align-items: start; }
  .source-card { height: clamp(58px, 8vh, 68px); padding: 5px 1px; border-width: 1.5px; border-radius: 7px; font-size: var(--fit-font-size, clamp(18px, 5.2vw, 25px)); }
  .source-card::after, .history-word::after, .answer-tile::after { inset: 3px; border-width: 1.5px; border-radius: 5px; }
  .loom-gap { height: clamp(72px, 10.5vh, 96px); }
  .answer-tile { height: clamp(60px, 8vh, 68px); padding: 5px 1px; border-width: 1.5px; border-radius: 7px; }
  .answer-input { --default-input-size: clamp(18px, 5vw, 24px); }
  .drag-handle { width: 18px; height: 18px; right: 3px; bottom: 2px; font-size: 14px; border-width: 0; background: #f2dfc4b8; }
  .answer-status { min-height: 38px; padding-top: 4px; font-size: 9px; }
  .type-chip { width: 29px; height: 29px; }
  .type-chip .chip-symbol { width: 27px; height: 27px; }
  .options-trigger { font-size: 10px; }
  .thread-line { stroke-width: 6; }
  .thread-shadow { stroke-width: 8; }
  .thread-fiber { stroke-width: 6; }
  .app-footer { padding: 8px 7px 10px; gap: 8px; }
  .main-action { min-width: min(230px, 70vw); height: 43px; font-size: 16px; }
  .footer-caption { font-size: 10px; gap: 7px; margin-bottom: 8px; letter-spacing: .13em; }
  .legend { gap: 3px; }
  .legend-item { min-height: 58px; border-radius: 11px; gap: 2px; padding: 3px 1px 4px; font-size: clamp(8px, 2.1vw, 10px); }
  .legend-item b { width: 30px; height: 30px; }
}
@media (max-width: 380px) {
  .site-name img { width: 135px; }
  .help-mark { width: 37px; height: 37px; font-size: 24px; }
  .legend-item { font-size: 7px; }
  .legend-item b { width: 27px; height: 27px; }
}
@media (max-height: 700px) {
  .app-shell { grid-template-rows: 15px auto minmax(0, 1fr) auto 25px; }
  .app-header { min-height: 60px; }
  .source-card { height: 52px; }
  .loom-gap { height: 60px; }
  .answer-tile { height: 57px; }
  .answer-status { min-height: 34px; }
  .type-chip { width: 26px; height: 26px; }
  .type-chip .chip-symbol { width: 24px; height: 24px; }
  .app-footer { gap: 5px; }
  .legend-item { min-height: 47px; }
}
@media (max-width: 680px) {
  .typing .app-shell { grid-template-rows: 0 auto minmax(0, 1fr) auto 0; }
  .typing .app-shell::before, .typing .app-shell::after, .typing .history-rows, .typing .footer-actions, .typing .current-heading { display: none; }
  .typing .app-header { min-height: 47px; padding-top: 3px; padding-bottom: 5px; }
  .typing .site-name img { max-height: 37px; }
  .typing .help-mark { width: 34px; height: 34px; font-size: 22px; }
  .typing .playfield-content { justify-content: center; align-items: center; width: 100%; min-height: 100%; padding: 6px 0; }
  .typing .word-row { width: min(70vw, 310px); grid-template-columns: minmax(0, 1fr); }
  .typing .source-card:not(.is-focus), .typing .answer-card:not(.is-focus) { display: none; }
  .typing .source-card { height: clamp(62px, 12vh, 78px); font-size: var(--fit-font-size, 31px); padding: 7px 12px; }
  .typing .loom-gap { height: clamp(22px, 6vh, 38px); }
  .typing .answer-tile { height: clamp(62px, 12vh, 78px); padding: 7px 12px; }
  .typing .answer-input { --default-input-size: 31px; user-select: text; }
  .typing .drag-handle { display: none; }
  .typing .answer-status { min-height: 30px; padding-top: 3px; }
  .typing .type-chip { width: 30px; height: 30px; }
  .typing .type-chip .chip-symbol { width: 28px; height: 28px; }
  .typing .options-trigger { display: none; }
  .typing .app-footer { padding: 3px 4px 5px; gap: 0; }
  .typing .footer-caption { display: none; }
  .typing .legend { gap: 2px; }
  .typing .legend-item { min-height: 39px; padding: 2px 0; font-size: 7px; }
  .typing .legend-item b { width: 22px; height: 22px; }
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }

/* Completion and voting remain separate from submission eligibility. */
.footer-actions { flex-wrap: wrap; gap: 8px; }
.footer-actions:has(.vote-action:not([hidden])) .main-action { min-width: 0; flex: 1; max-width: 300px; padding: 0 12px; font-size: clamp(13px, 2vw, 19px); }
.vote-action { font-size: 14px; }
.ballot-list { display: grid; gap: 12px; }
.ballot-choice { display: grid; gap: 5px; width: 100%; padding: 16px; text-align: left; border: 1px solid #a5b9a9; border-radius: 10px; color: #17352f; background: #f6f5ec; cursor: pointer; }
.ballot-choice strong { font: 600 20px Georgia, serif; overflow-wrap: anywhere; }
.ballot-choice span, .ballot-choice small { font-size: 13px; }
.ballot-choice[aria-pressed="true"] { border: 2px solid #35664e; background: #e6eddf; }
.ballot-choice:focus-visible { outline: 3px solid #35664e; outline-offset: 3px; }
.vote-dialog { max-height: 85dvh; overflow: hidden; }
#vote-picker { display: flex; flex-direction: column; max-height: calc(min(85dvh, 700px) - 28px - clamp(46px, 10vw, 72px)); min-height: 0; }
#vote-picker .ballot-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#vote-picker .vote-controls { flex: none; padding-top: 12px; }
#vote-picker #vote-status { margin: 12px 0 8px; }
#refresh-ballot { padding: 9px 14px; border: 1px solid #a5b9a9; border-radius: 6px; background: #f6f5ec; color: #17352f; font: inherit; cursor: pointer; }
.vote-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
@media (max-width: 680px) {
  .vote-dialog { max-height: 94dvh; }
  #vote-picker { max-height: calc(min(94dvh, 700px) - 28px - clamp(46px, 10vw, 72px)); }
  .vote-controls { flex-wrap: nowrap; gap: 8px; }
  .vote-controls #refresh-ballot, .vote-controls .dialog-submit { min-width: 0; flex: 1; padding-inline: 6px; font-size: clamp(11px, 3.6vw, 14px); white-space: nowrap; }
  .vote-controls .dialog-submit { min-height: 46px; }
}
.vote-confirmation { text-align: center; padding: 28px 8px 18px; }
.vote-confirmation h2 { margin: 18px auto 28px; max-width: 440px; }
