:root { color: #17264d; background: #fff8e9; font-family: system-ui, sans-serif; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #fff8e9; color: #17264d; }
.game-bar { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem max(1rem, calc((100vw - 900px) / 2)); background: #17264d; color: #fff; }
.game-bar a { display: inline-flex; align-items: center; min-height: 44px; color: #fff; font-weight: 800; }
main { max-width: 900px; margin: 0 auto; padding: 1.25rem; }
.card, .clue-card, .how-to { border: 3px solid #17264d; border-radius: 18px; background: #fff; box-shadow: 4px 5px #17264d; }
.card { max-width: 700px; margin: 2rem auto; padding: 1.1rem; text-align: center; }
.clue-card, .how-to { padding: .9rem; }
.how-to { display: flex; align-items: center; gap: 1rem; margin: .75rem 0; background: #eee9ff; }
.how-to p { margin: 0; }
button { min-height: 44px; padding: .55rem .8rem; border: 3px solid #17264d; border-radius: 13px; background: #fff; color: #17264d; font: inherit; font-weight: 800; cursor: pointer; }
button:not(:disabled):hover { background: #eee9ff; }
button:focus-visible, a:focus-visible { outline: 4px solid #e66b48; outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .62; }
.primary { min-height: 48px; background: #2457db; color: #fff; }
.primary:not(:disabled):hover { background: #183eaa; }
.row-orientation { display: flex; align-items: center; gap: .45rem; margin: .85rem 0 .25rem; font-weight: 800; }
.row-line { flex: 1; border-top: 3px solid #17264d; }
.board { display: grid; grid-template-columns: repeat(4, minmax(60px, 1fr)); gap: .5rem; margin: .35rem 0 1rem; }
.person { position: relative; min-height: 128px; display: grid; place-items: center; gap: .2rem; padding: .3rem; background: #eee9ff; }
.person.selected { outline: 5px double #e66b48; outline-offset: -8px; }
.selection-marker { display: inline-block; padding: .02rem .12rem; border: 2px solid #17264d; border-radius: 7px; background: #ffd54a; color: #17264d; font-size: .66rem; line-height: 1.1; }
.place-number { position: absolute; top: .35rem; left: .45rem; font-size: .83rem; }
.animal-svg { width: 56px; height: 56px; }
.person-name { display: inline-flex; align-items: center; gap: .15rem; font-size: .86rem; }
.clue-card h2 { margin-top: 0; }
#clues { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.clue { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .6rem; padding: .55rem; border-radius: 10px; border: 2px solid #d5d0e8; }
.clue.fits { background: #ddf3d8; border-color: #527d49; }
.clue.check { background: #fff1bd; border-color: #9a7415; }
.clue-art { display: flex; align-items: center; min-width: 105px; gap: .18rem; }
.clue-art .animal-svg { width: 32px; height: 32px; }
.relation-mark { min-width: 24px; font-weight: 900; text-align: center; }
.adjacency-bracket { width: 23px; height: 19px; min-width: 23px; border: 3px solid #2457db; border-bottom: 0; border-radius: 8px 8px 0 0; }
.place-strip { display: flex; gap: 2px; }
.place-strip span { display: grid; width: 20px; height: 25px; place-items: center; border: 2px solid #17264d; font-size: .75rem; }
.place-strip .target { background: #ffd54a; outline: 2px solid #e66b48; }
.actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: start; margin: 1rem 0; }
.new-puzzle-control { display: grid; gap: .25rem; max-width: 175px; font-size: .78rem; line-height: 1.2; }
#feedback { min-height: 2rem; font-weight: 800; }
.swap-example, .help-art { display: flex; align-items: center; justify-content: center; gap: .2rem; min-height: 68px; }
.swap-example .animal-svg, .help-art .animal-svg { width: 42px; height: 42px; }
.swap-arrow { font-size: 1.45rem; font-weight: 900; }
.help-art { flex-wrap: wrap; }
.help-art[data-help-art="swap"] { flex-direction: column; }
.help-art[data-help-art="swap"] .illustrated-arrow { transform: rotate(90deg); }
.help { max-width: 850px; min-width: 0; text-align: left; }
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.help-grid article { min-width: 0; border: 2px solid #d5d0e8; border-radius: 12px; padding: .65rem; }
.help-grid h3, .help-grid p { margin: .2rem 0; }
.relation-example { display: grid; gap: .15rem; margin-top: .55rem; }
.relation-example b { font-size: .85rem; }
.mini-row { display: flex; width: max-content; max-width: 100%; gap: .15rem; padding: .25rem; border-bottom: 2px solid #17264d; }
.mini-slot { display: grid; width: 34px; height: 42px; place-items: center; border: 2px solid #17264d; border-radius: 6px; background: #fff; }
.mini-slot .animal-svg { width: 27px; height: 27px; }
.mini-slot.blank { background: #f7f1e7; }
.mini-slot.target { outline: 3px solid #e66b48; outline-offset: 1px; }
.illustrated-arrow { color: #2457db; font-size: 1.5rem; font-weight: 900; }
.completed-rows { display: grid; gap: .65rem; margin: 1rem 0; padding: 0; list-style: none; text-align: left; }
.completed-rows li { display: flex; align-items: center; gap: .55rem; padding: .65rem; border: 2px solid #17264d; border-radius: 12px; background: #eee9ff; }
.completed-rows .animal-svg { width: 36px; height: 36px; }
.completed-friends { display: flex; flex-shrink: 0; }
.completed-copy { display: grid; gap: .1rem; }
@media (max-width: 420px) {
  main { padding: .75rem; }
  .board { gap: .28rem; }
  .person { min-height: 108px; padding: .16rem; }
  .person-name { font-size: .72rem; }
  .animal-svg { width: 44px; height: 44px; }
  .how-to { align-items: flex-start; gap: .45rem; }
  .swap-example { min-width: 118px; }
  #finished { padding: .7rem; margin-block: .75rem; }
  #finished h1 { margin-block: .5rem; font-size: 1.55rem; }
  #finished > p { margin-block: .6rem; }
  .completed-rows li { flex-direction: column; align-items: flex-start; gap: .2rem; padding: .45rem; }
  .completed-rows .animal-svg { width: 28px; height: 28px; }
  .completed-copy { font-size: .86rem; }
  .help { padding: .7rem; }
  .help-grid { grid-template-columns: 1fr; }
  .help-art { width: 100%; min-width: 0; flex-direction: column; align-items: flex-start; }
  .help-art .illustrated-arrow { line-height: 1; transform: rotate(90deg); }
  .mini-row { flex: 0 0 auto; }
}
@media (max-height: 430px) and (orientation: landscape) {
  .game-bar { min-height: 44px; padding-block: .35rem; }
  main { padding-block: .3rem; }
  #round-label, #support-status { margin-block: .18rem; }
  #round-instruction { margin-block: .18rem; font-size: 1.3rem; }
  .how-to { min-height: 48px; margin-block: .2rem; padding: .35rem .55rem; }
  .how-to p { font-size: .84rem; }
  .swap-example { min-height: 42px; }
  .swap-example .animal-svg { width: 32px; height: 32px; }
  .row-orientation { margin-block: .2rem; }
  .person { min-height: 56px; }
  .person .animal-svg { width: 30px; height: 30px; }
  .person-name { font-size: .7rem; }
  .card { margin: .75rem auto; }
}
@media (min-width: 600px) and (max-height: 430px) and (orientation: landscape) {
  #finished { max-width: 900px; padding: .5rem; margin-block: .5rem; }
  #finished h1 { margin: 0; font-size: 1.3rem; }
  #finished > p { margin: .25rem 0; font-size: .9rem; }
  .completed-rows { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; margin: .4rem 0; }
  .completed-rows li { flex-direction: column; align-items: flex-start; padding: .35rem; gap: .15rem; }
  .completed-rows .animal-svg { width: 28px; height: 28px; }
  .completed-copy { font-size: .78rem; line-height: 1.2; gap: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
