:root {
  color-scheme: light;
  --ink: #293f48;
  --blue: #174e92;
  --sky: #e3fdff;
  --line: #cfdee4;
  --muted: #56707c;
  --paper: #fff;
  --reading: 'Palatino Linotype', Palatino, 'Book Antiqua', 'TextQuilting Pagella', Georgia, serif;
  --label: 'Della Respira', var(--reading);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: #f8fcfd; font: 18px/1.55 var(--reading); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible, .answer-area:focus-visible, .book-carousel:focus-visible { outline: 3px solid #266cb7; outline-offset: 4px; }
a { color: var(--blue); text-underline-offset: .18em; }
.site-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; max-width: 1120px; margin: auto; padding: 1.3rem 2rem; }
.home-link { font-family: var(--label); font-size: .94rem; text-decoration: none; color: var(--ink); }
.home-link span { color: #1919ff; white-space: nowrap; }
.preview-note { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.game-shell { width: min(900px, calc(100% - 40px)); margin: 1.4rem auto 2rem; overflow-anchor: none; }
.page-heading { text-align: center; margin-bottom: 2rem; }
.eyebrow { font: .88rem/1.5 var(--label); letter-spacing: .04em; color: var(--muted); margin: 0 0 .45rem; }
h1 { font: 400 clamp(2.05rem, 5.4vw, 3.25rem)/1.22 'New Tegomin', var(--reading); margin: 0; letter-spacing: -.025em; }
.intro { margin: .85rem 0 0; font-size: 1.2rem; }
.game-card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 1.4rem 2rem 2rem; box-shadow: 0 12px 38px rgb(42 74 88 / 6%); }
.card-topline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem 1rem; border-bottom: 1px solid #e4edf0; padding-bottom: 1rem; }
.mode-switch { display: flex; flex-wrap: wrap; gap: .25rem; border: 1px solid #e0e9ed; border-radius: 10px; padding: 3px; background: #f7fafb; }
.mode-switch button { min-height: 44px; border: 0; background: transparent; padding: .48rem .8rem; border-radius: 7px; color: var(--muted); font: .9rem/1.35 var(--label); }
.mode-switch button[aria-pressed="true"] { background: var(--sky); color: var(--blue); box-shadow: 0 1px 4px rgb(25 65 85 / 10%); }
.daily-label { font-size: .87rem; color: var(--muted); }
.load-status { padding: 2.5rem 0; text-align: center; }
.draw-panel { text-align: center; padding: 2rem .5rem 1.5rem; }
.draw-panel h2 { font: 400 1.55rem/1.4 var(--label); margin: 1.3rem 0 .6rem; }
.draw-panel p { margin: .3rem auto 1.3rem; max-width: 470px; color: var(--muted); }
.draw-art { width: 220px; height: 125px; position: relative; margin: 0 auto; }
.draw-ticket { display: grid; place-items: center; position: absolute; width: 126px; height: 74px; left: 47px; top: 28px; border: 1px solid #a9cfdb; border-radius: 4px; background: #f6fdff; box-shadow: 0 3px 4px rgb(52 99 111 / 9%); font: 1.38rem/1 var(--reading); }
.ticket-one { transform: translate(-38px, -9px) rotate(-17deg); color: #456a83; }
.ticket-two { transform: translate(35px, -7px) rotate(16deg); color: #356b79; }
.ticket-three { transform: translate(0, 24px) rotate(-3deg); background: var(--sky); color: var(--blue); }
.is-drawing .ticket-one { animation: draw-left .7s ease-in-out infinite alternate; }
.is-drawing .ticket-two { animation: draw-right .65s ease-in-out infinite alternate; }
.is-drawing .ticket-three { animation: draw-front .55s ease-in-out infinite alternate; }
.button { min-height: 46px; border: 1px solid transparent; border-radius: 8px; padding: .65rem 1rem; font: .94rem/1.4 var(--label); text-align: center; transition: background-color .12s, border-color .12s; }
.button-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.button-primary:hover:not(:disabled) { background: #123e76; }
.button-secondary { color: var(--blue); background: #fff; border-color: #b6ccd7; }
.button-secondary:hover:not(:disabled) { background: #effaff; border-color: #74a5bb; }
.button:disabled { opacity: .5; }
.sentence-heading { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem 1.2rem; padding-top: 1.35rem; }
.sentence-source { margin: 0; font-size: 1rem; }
#source-title { font-family: var(--label); }
#source-detail { display: block; color: var(--muted); font-size: .87rem; margin-top: .2rem; }
.word-count { white-space: nowrap; color: var(--muted); font-size: .9rem; }
.instruction-row { margin: 1rem 0 1.25rem; color: var(--muted); font-size: .95rem; }
.instruction-row > p { margin: 0; }
.keyboard-help { margin-top: .2rem; font-size: .9rem; }
.keyboard-help summary { cursor: pointer; text-decoration: underline; text-underline-offset: .18em; padding: .35rem 0; width: fit-content; }
.keyboard-help p { margin: .15rem 0 .65rem; max-width: 680px; }
kbd { font: .86em var(--label); background: #f4f7f8; border: 1px solid #d5e2e7; border-radius: 3px; padding: .06em .3em; }
.answer-header, .tray-header { display: flex; justify-content: space-between; align-items: baseline; margin: .6rem 0 .55rem; gap: 1rem; }
.answer-header h2, .tray-header h2 { margin: 0; font: 400 1rem/1.4 var(--label); }
.placement-progress { color: var(--muted); font-size: .85rem; }
.word-area { display: flex; flex-wrap: wrap; align-content: flex-start; align-items: flex-start; gap: .48rem; padding: .9rem; min-height: 110px; border-radius: 10px; }
.answer-area { background: #e3fdff; border: 1.5px dashed #9bbecb; transition: border-color .12s, background-color .12s; }
.answer-area.is-correct { border-style: solid; border-color: #c58e95; background: #ffe2e2; }
.word-tray { background: #e3fdff; border: 1px solid #cfdee4; min-height: 112px; }
.tray-header { margin-top: 1.2rem; }
.word-tile { min-height: 46px; max-width: 100%; padding: .3rem .72rem .36rem; background: #fff; color: #253f4d; border: 1px solid #b5ccd7; border-radius: 6px; box-shadow: 0 2px 0 #dce8ed; font: 1.32rem/1.4 var(--reading); overflow-wrap: anywhere; transition: background-color .1s, border-color .1s; }
.word-tile:hover { background: #eafaff; border-color: #699eb6; }
.answer-area .word-tile { border-color: #89b1c2; }
.word-tile.is-dragging { opacity: .45; }
.word-tile.is-hinted { background: #fffecc; border-color: #c3ac53; }
.answer-area.is-correct .word-tile { background: #e3fdff; }
.word-tile.drop-before { border-left: 4px solid #296bad; padding-left: calc(.72rem - 3px); }
.word-area.is-drop-target { outline: 2px solid #8cb4c6; outline-offset: 2px; }
.area-placeholder { color: #68838d; font-size: 1rem; margin: auto; text-align: center; padding: .8rem; pointer-events: none; }
.game-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.4rem; }
.feedback { min-height: 2.3rem; padding-top: .8rem; font-size: 1.02rem; }
.feedback.is-success { color: #24654e; font-weight: 700; }
.feedback.is-nudge { color: #6f4e32; }
.hint { display: inline-block; background: #fffecc; border-radius: 4px; padding: .3rem .65rem; margin: .4rem 0 .8rem; font-size: 1rem; }
.quiet-actions { display: flex; flex-wrap: wrap; gap: .25rem 1.2rem; margin-top: .35rem; }
.quiet-actions button { border: 0; background: transparent; color: var(--muted); padding: .5rem 0; min-height: 44px; font-size: .9rem; text-decoration: underline; text-underline-offset: .2em; }
.quiet-actions button:hover { color: var(--blue); }
.original-panel { background: #f2f9fc; border-left: 3px solid #8bb4c7; padding: 1rem 1.2rem; margin-top: 1rem; border-radius: 0 8px 8px 0; }
.original-panel h3 { color: var(--muted); font: 400 .9rem/1.4 var(--label); margin: 0 0 .6rem; }
.original-sentence { font-size: 1.38rem; line-height: 1.6; margin: 0; }
.source-context { margin: .8rem 0 0; color: var(--muted); font-size: 1rem; }
.reading-link-row { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: baseline; justify-content: space-between; border-top: 1px solid #e2ebef; padding-top: 1rem; margin-top: 1.4rem; }
.reading-link-row span { font-size: .9rem; color: var(--muted); }
.reading-link-row a { font: .9rem/1.4 var(--label); padding: .4rem 0; }
.another-draw { display: block; margin: 1.35rem auto 0; }
.game-footer { text-align: center; color: var(--muted); margin: 1.6rem 0 0; font-size: .94rem; }
.game-footer p { margin: 0 0 .45rem; }
.game-footer a { display: inline-block; font-size: .84rem; min-height: 44px; padding: .35rem 0; }
.is-embedded .site-header, .is-embedded .game-footer { display: none; }
.is-embedded .game-shell { margin-top: 1rem; }
.book-picker { margin: 3rem 0 0; padding: 1.5rem; background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.book-picker-heading h2 { margin: 0; color: var(--blue); font: 400 clamp(1.35rem, 3vw, 1.75rem)/1.35 var(--label); }
.book-picker-heading > p { margin: .6rem 0 1.2rem; }
.book-source-switch { display: flex; flex-wrap: wrap; gap: .65rem; }
.book-source-switch button { min-height: 48px; padding: .7rem 1rem; color: var(--blue); background: #fff; border: 1px solid #9ebdce; border-radius: 8px; font: 1rem/1.4 var(--label); }
.book-source-switch button[aria-pressed="true"] { color: #fff; background: var(--blue); border-color: var(--blue); }
.book-source-switch button:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--sky); }
.book-source-switch button:disabled { opacity: .55; }
.book-selection-summary { min-height: 1.6em; margin: 1rem 0; color: var(--blue); overflow-wrap: anywhere; }
.book-lists-disclosure { border-top: 1px solid var(--line); padding-top: .4rem; }
.book-lists-disclosure > summary { width: fit-content; cursor: pointer; padding: .6rem 0; font: 1.05rem/1.4 var(--label); color: var(--ink); }
.book-picker-tools { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem 1rem; margin: .75rem 0; }
.book-picker-tools > a { font-size: .95rem; min-height: 44px; display: inline-flex; align-items: center; }
#manage-books[aria-expanded="true"] { background: #e3fdff; border-color: #538aab; }
.book-storage-note { padding: .7rem .9rem; border-left: 3px solid #c2a143; background: #fffde9; font-size: .95rem; line-height: 1.5; margin: .9rem 0 1rem; }
.book-list-status { margin: .6rem 0 1rem; font-size: 1rem; }
.book-list-status:empty { display: none; }
.book-drag-help { margin: .65rem 0 1rem; color: var(--muted); font-size: .95rem; line-height: 1.5; }
.book-piles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.35rem; align-items: start; margin-top: 1rem; }
.book-pile { min-width: 0; border: 1px solid #bfd5df; border-top: 4px solid #479bb6; border-radius: 9px; padding: 1.05rem .9rem; background: #f1fdff; }
.book-pile-finished { background: #fffdf0; border-color: #dfd9ae; border-top-color: #b59a3b; }
.book-pile-partial { background: #f8f4fc; border-color: #d9cbe3; border-top-color: #9670ac; }
.book-pile-heading { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.book-pile-number { color: #185f7b; font: 1.05rem/1.35 var(--label); }
.book-pile-finished .book-pile-number { color: #79631a; }
.book-pile-partial .book-pile-number { color: #705087; }
.book-pile-count { font-size: .95rem; color: var(--muted); }
.book-pile h3 { margin: 0; font: 400 1.14rem/1.45 var(--label); }
.book-pile-description { margin: .7rem 0 1.25rem; font-size: 1rem; line-height: 1.4; }
.book-row-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.book-row-nav { display: flex; flex: 0 0 auto; gap: .4rem; }
.book-row-arrow { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid #a5bfce; border-radius: 50%; background: #fff; color: var(--blue); font: 1.45rem/1 var(--reading); }
.book-row-arrow:hover:not(:disabled) { background: var(--sky); border-color: #538aab; }
.book-row-arrow:disabled { opacity: .35; }
.book-carousel { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 2rem) / 3); grid-template-columns: none; gap: 1rem; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: #8fadb9 transparent; padding: .2rem .2rem .85rem; margin-inline: -.2rem; cursor: grab; }
.book-carousel > .book-card { scroll-snap-align: start; min-width: 0; }
.book-carousel.is-book-dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.book-carousel img { -webkit-user-drag: none; }
.book-carousel button, .book-carousel a, .book-carousel select { cursor: pointer; }
.book-list-empty { margin: .75rem 0 .35rem; font-size: .95rem; color: var(--muted); }
.book-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: .8rem; align-items: start; padding: .9rem; border: 1px solid #d3e1e6; border-radius: 8px; background: #fff; }
.book-card.is-selected { border-color: #296fa7; box-shadow: 0 0 0 2px rgb(41 111 167 / 12%); }
.book-card[draggable="true"] { cursor: grab; user-select: none; }
.book-card[draggable="true"]:active { cursor: grabbing; }
.book-card.is-book-moving { opacity: .5; }
.book-pile.is-book-drop-target, .unassigned-books.is-book-drop-target { outline: 3px solid #266cb7; outline-offset: 3px; }
.book-drag-ghost { position: fixed; z-index: 1000; pointer-events: none; opacity: .9; max-height: 190px; overflow: hidden; box-shadow: 0 8px 24px rgb(24 66 91 / 24%); transform: scale(.8); transform-origin: top left; }
.is-book-pointer-dragging, .is-book-pointer-dragging * { cursor: grabbing !important; }
.book-cover { width: 64px; height: 92px; object-fit: contain; object-position: top center; }
.book-card-text { min-width: 0; }
.book-card-text:first-child { grid-column: 1 / -1; }
.book-title { margin: 0; font: 400 1.03rem/1.45 var(--label); overflow-wrap: anywhere; }
.book-author { margin: .4rem 0 0; color: var(--muted); font-size: .88rem; }
.book-availability { margin: .45rem 0 .65rem; font-size: .88rem; color: var(--muted); }
.book-pick { width: 100%; padding: .55rem .65rem; margin-top: .4rem; font-size: .91rem; }
.book-pick[aria-pressed="true"] { color: #fff; background: var(--blue); border-color: var(--blue); }
.book-move-controls { grid-column: 1 / -1; border-top: 1px solid #dce7eb; padding-top: .65rem; }
.book-move-label { margin: 0 0 .5rem; font-size: .92rem; }
.book-move-buttons { display: flex; gap: .4rem; flex-wrap: wrap; }
.book-move-buttons button { min-height: 44px; flex: 1; border: 1px solid #a5bfce; border-radius: 6px; color: var(--blue); background: #fff; padding: .4rem .45rem; font: .9rem/1.3 var(--label); }
.book-move-buttons button:hover:not(:disabled) { background: var(--sky); }
.book-move-buttons button[aria-pressed="true"] { background: #e3fdff; border-color: #3d7a9b; color: #174e92; }
.book-move-buttons button:disabled { opacity: .55; cursor: default; }
.book-unassign { display: block; margin-top: .5rem; padding: .4rem 0; min-height: 44px; border: 0; background: transparent; color: var(--muted); font-size: .9rem; text-decoration: underline; text-underline-offset: .18em; }
.book-unassign:disabled { opacity: .55; }
.unassigned-books { margin-top: 1.7rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.unassigned-books h3 { margin: 0; font: 400 1.15rem/1.4 var(--label); }
.unassigned-books > p { margin: .6rem 0 1rem; color: var(--muted); font-size: 1rem; }
#draw-heading { font-size: clamp(1.02rem, 4.2vw, 1.75rem); white-space: nowrap; color: var(--blue); }
#draw-description { max-width: none; text-wrap: pretty; }
.rephrase-panel { margin-top: 1rem; padding: 1rem 1.2rem; background: #fffeec; border-left: 3px solid #b3a456; border-radius: 0 8px 8px 0; }
.rephrase-panel h3 { margin: 0 0 .6rem; color: #6d602e; font: 400 1rem/1.4 var(--label); }
.rephrased-sentence { margin: 0; font-size: 1.38rem; line-height: 1.6; }
#rephrase-action { color: #704a85; font-weight: 700; }
@media (max-width: 850px) {
  .book-piles { gap: 1.1rem; }
  .book-carousel { grid-auto-columns: calc((100% - 1rem) / 2); }
  .book-pile-description { margin-bottom: 1rem; }
}
@media (max-width: 600px) {
  .book-picker { padding: 1.1rem .8rem; margin-top: 2rem; border-radius: 13px; }
  .book-source-switch { gap: .55rem; }
  .book-source-switch button { width: 100%; font-size: .95rem; }
  .book-carousel { grid-auto-columns: 86%; gap: .8rem; }
  .book-row-heading { gap: .7rem; }
  .book-card { grid-template-columns: 68px minmax(0, 1fr); }
  .book-picker-tools .button { flex: 1; }
  .book-storage-note { font-size: .92rem; }
  .rephrased-sentence { font-size: 1.25rem; }
}
@keyframes draw-left { to { transform: translate(8px, -20px) rotate(11deg); } }
@keyframes draw-right { to { transform: translate(-19px, 0) rotate(-11deg); } }
@keyframes draw-front { to { transform: translate(8px, 8px) rotate(9deg); } }
@media (max-width: 600px) {
  body { font-size: 17px; }
  .site-header { padding: 1rem 1.1rem; }
  .home-link { font-size: .82rem; max-width: 215px; }
  .preview-note { font-size: .72rem; }
  .game-shell { width: calc(100% - 24px); margin-top: 1rem; }
  .page-heading { margin-bottom: 1.35rem; padding-inline: .2rem; }
  .intro { font-size: 1.06rem; }
  .game-card { padding: 1rem .8rem 1.3rem; border-radius: 13px; }
  .card-topline { gap: .6rem; }
  .mode-switch { width: 100%; }
  .mode-switch button { flex: 1; font-size: .88rem; padding-inline: .5rem; }
  .daily-label { font-size: .82rem; padding-left: .2rem; }
  .draw-panel { padding: 1.5rem .3rem .7rem; }
  .draw-panel h2 { font-size: 1.25rem; }
  .sentence-heading { align-items: flex-start; }
  .sentence-source { min-width: 0; }
  .word-area { padding: .65rem; gap: .42rem; min-height: 116px; }
  .word-tile { font-size: 1.25rem; padding-inline: .57rem; }
  .word-tile.drop-before { padding-left: calc(.57rem - 3px); }
  .game-actions .button-primary { flex: 1 0 100%; }
  .game-actions .button-secondary { flex: 1; }
  .button { font-size: .9rem; }
  .reading-link-row { display: block; }
  .reading-link-row span { display: block; }
  .reading-link-row a { display: inline-block; min-height: 44px; padding-top: .55rem; }
  .original-panel { padding: .8rem .9rem; }
  .original-sentence { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
