:root { color-scheme: light; --ink: #293e34; --muted: #596c5b; --paper: #ecede5; --line: #445b4226; --accent: #3d5946; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
* { box-sizing: border-box; }
body { margin: 0; }
.skip-link { position: absolute; z-index: 10; top: 8px; left: 8px; transform: translateY(-150%); padding: 12px 16px; background: var(--paper); color: var(--ink); border: 1px solid var(--accent); border-radius: 8px; }
.skip-link:focus { transform: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 2px solid #3d5946; outline-offset: 4px; }
button svg, a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
[hidden] { display: none !important; }
.game { display: grid; grid-template-rows: auto minmax(220px, 1fr) auto auto; height: 100vh; height: 100dvh; min-height: 610px; overflow: hidden; }
.topbar { z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 21px 38px 17px; background: #e7ebe2; border-bottom: 1px solid var(--line); }
.identity { display: flex; gap: 11px; align-items: center; }
.cairn-mark { width: 32px; height: 42px; color: #53664f; }
h1 { margin: 0; font: 36px/1 Georgia, "Times New Roman", serif; letter-spacing: -.06em; font-weight: 400; }
.identity p { margin: 7px 0 0; color: var(--muted); font-size: 14px; letter-spacing: .015em; }
.top-actions, .tools { display: flex; align-items: center; gap: 8px; }
.quiet-button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; padding: 8px 13px; border: 1px solid transparent; border-radius: 8px; background: transparent; text-decoration: none; color: var(--ink); font-size: 14px; white-space: nowrap; }
.quiet-button:hover:not(:disabled) { background: #40573b0a; border-color: #40573b12; }
.top-actions .home { margin-left: 5px; border-left-color: var(--line); border-radius: 0; padding-left: 23px; }
.sound-waves { display: none; }
[aria-pressed="true"] .sound-waves { display: block; }
[aria-pressed="true"] .sound-slash { display: none; }
.scene { position: relative; min-height: 0; overflow: hidden; background: #b1c0a5; isolation: isolate; }
#scene { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; outline-offset: -5px; cursor: grab; }
#scene.holding { cursor: grab; }
#scene.dragging { cursor: grabbing; }
.eyebrow { margin: 0 0 13px; font-size: 12px; letter-spacing: .22em; font-weight: 500; color: #4d654f; }
.scene-status { position: absolute; bottom: 17px; left: 24px; right: 24px; margin: 0; text-align: center; font-size: 14px; color: #364b39; pointer-events: none; text-shadow: 0 1px 5px #ecefe280; }
.placement { position: absolute; bottom: 45px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 7px; padding: 6px; background: #f1f1e9ed; border: 1px solid #52674929; border-radius: 16px; box-shadow: 0 5px 30px #25372b14; }
.turn-buttons { display: flex; align-items: center; padding: 0 1px; }
.turn-buttons > span { font-size: 13px; color: var(--muted); padding: 0 3px; }
.turn, .cancel { width: 44px; min-width: 44px; height: 44px; padding: 10px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; }
.turn:hover, .cancel:hover { background: #40573b0c; }
.place { border: 0; background: var(--accent); color: #f3f1e5; border-radius: 10px; padding: 12px 20px; min-height: 44px; font-size: 15px; white-space: nowrap; }
.place:hover { background: #304d3a; }
.place span { opacity: .65; margin-left: 10px; }
.placement .cancel { width: 38px; min-width: 38px; }
.riverbed { padding: 14px 30px 10px; background: var(--paper); border-top: 1px solid #f4f6ef80; }
.riverbed-heading { display: flex; align-items: baseline; justify-content: center; gap: 20px; }
.riverbed-heading h2 { margin: 0; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; color: #455b47; }
.riverbed-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.stone-options { display: flex; justify-content: center; gap: 9px; max-width: 840px; margin: 3px auto 0; }
.stone-option { min-width: 0; flex: 1 1 0; max-width: 116px; border: 1px solid transparent; background: transparent; border-radius: 12px; padding: 0 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; touch-action: none; }
.stone-option:hover { background: #40573b08; }
.stone-option[aria-pressed="true"] { border-color: #536b4d6b; background: #40573b09; }
.stone-option canvas { width: 100%; height: 59px; object-fit: contain; pointer-events: none; }
.stone-option span { font-size: 14px; color: #465b47; }
.actionbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding: 5px 28px max(7px, env(safe-area-inset-bottom)); background: var(--paper); }
.keyboard-hint { margin: 0; color: var(--muted); font-size: 13px; }
.keyboard-hint span { padding: 0 8px; opacity: .5; }
.loading { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; background: #d2ddca; padding: 20px; text-align: center; }
.loading p { font-size: 16px; }
.loading button { border: 1px solid var(--accent); border-radius: 8px; background: transparent; padding: 12px 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
dialog { width: min(510px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 36px; color: var(--ink); background: #eeefe7; border: 1px solid #53634e3b; border-radius: 20px; box-shadow: 0 25px 100px #182b2640; }
dialog::backdrop { background: #1f352c70; backdrop-filter: blur(5px); }
.dialog-close { position: absolute; top: 10px; right: 10px; }
dialog h2 { margin: 0 0 20px; font: 34px/1.2 Georgia, serif; letter-spacing: -.03em; }
dialog p, dialog dd { font-size: 16px; line-height: 1.6; color: #4c6050; }
dialog dl { display: grid; grid-template-columns: 75px 1fr; gap: 12px; margin: 25px 0; }
dialog dt { font-size: 14px; font-weight: 600; padding-top: 3px; }
dialog dd { margin: 0; font-size: 14px; }
dialog .guide-keyboard { border-top: 1px solid var(--line); padding-top: 18px; font-size: 14px; }
.guide-done { width: 100%; margin-top: 8px; }
.after-play { padding: 46px 20px 20px; }
.cairn-guide { max-width: 740px; margin: 0 auto; font-size: 16px; line-height: 1.7; }
.cairn-guide h2 { margin: 0 0 20px; font: 32px/1.3 Georgia, serif; letter-spacing: -.025em; font-weight: 400; }
.cairn-guide p { color: #4c6050; }
.after-play a { color: #365540; text-underline-offset: 3px; }
.back-to-stones { display: inline-block; min-height: 44px; padding: 10px 0; }
.cairn-faq { margin-top: 30px; }
.cairn-faq h3 { font: 25px/1.4 Georgia, serif; font-weight: 400; }
.cairn-faq details { border-top: 1px solid var(--line); padding: 13px 0; }
.cairn-faq summary { cursor: pointer; font-weight: 500; padding: 4px 0; }
.cairn-faq summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.cairn-faq p { margin-bottom: 4px; }
.after-play .site-related { width: min(100%, 768px); margin: 44px auto; background: #e7ebe2; border-color: #bdc9b8; }
.after-play .site-related-title { color: var(--ink); font-family: Georgia, serif; font-size: 25px; font-weight: 400; }
.after-play .site-related-list a { color: #365540; background: #f4f4ed; border-color: #cbd2c2; }
.after-play .site-related-list a:hover { background: #f9f9f2; border-color: #8c9c82; }
.after-play .site-related span { color: #50634f; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; max-width: 740px; margin: 35px auto 0; padding: 18px 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
@media (max-width: 720px) {
  .topbar { padding: 14px 17px 12px; }
  h1 { font-size: 31px; }
  .identity p { font-size: 12px; margin-top: 5px; }
  .cairn-mark { width: 27px; height: 37px; }
  .identity { gap: 7px; }
  .top-actions { gap: 0; }
  .top-actions .quiet-button { width: 42px; padding: 10px; }
  .top-actions .quiet-button span { display: none; }
  .top-actions .home { margin-left: 3px; padding-left: 12px; }
  .riverbed { padding: 12px 10px 9px; }
  .riverbed-heading { gap: 10px; flex-direction: column; align-items: center; }
  .riverbed-heading p { font-size: 13px; }
  .riverbed-heading h2 { font-size: 11px; }
  .stone-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; max-width: 450px; margin-top: 3px; }
  .stone-option { padding: 0 2px 7px; border-radius: 9px; }
  .stone-option canvas { height: 46px; }
  .stone-option span { font-size: 14px; }
  .keyboard-hint { display: none; }
  .actionbar { padding: 4px 8px max(6px, env(safe-area-inset-bottom)); justify-content: center; }
  .tools { width: 100%; justify-content: space-around; gap: 0; }
  .tools .quiet-button { font-size: 13px; padding: 8px; gap: 6px; }
  .tools svg { width: 18px; height: 18px; }
  .scene-status { font-size: 13px; left: 12px; right: 12px; bottom: 14px; }
  .placement { bottom: 40px; gap: 3px; border-radius: 14px; }
  .turn-buttons > span { display: none; }
  .place { padding: 12px 17px; }
  dialog { padding: 30px 24px 24px; }
}
@media (max-width: 360px) {
  .identity p { max-width: 126px; line-height: 1.4; }
  .topbar { padding-left: 12px; padding-right: 10px; }
  .top-actions .quiet-button { width: 37px; }
  .tools .quiet-button { font-size: 12px; padding: 7px 5px; }
}
@media (max-height: 720px) and (min-height: 481px) {
  .game { min-height: 540px; grid-template-rows: auto minmax(150px, 1fr) auto auto; }
}
@media (max-width: 500px) and (max-height: 760px) {
  .placement { top: 8px; bottom: auto; }
}
@media (max-height: 480px) and (min-width: 500px) {
  .game { min-height: 320px; grid-template-columns: minmax(0, 1fr) 224px; grid-template-rows: 57px minmax(0, 1fr) 53px; }
  .topbar { grid-column: 1 / -1; padding: 8px 20px; }
  .identity p { display: none; }
  h1 { font-size: 29px; }
  .cairn-mark { height: 32px; }
  .scene { grid-row: 2 / 4; }
  .riverbed { padding: 9px 6px; border-left: 1px solid var(--line); }
  .riverbed-heading h2 { font-size: 11px; }
  .riverbed-heading p { display: none; }
  .stone-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin-top: 5px; }
  .stone-option { padding: 0 2px 5px; }
  .stone-option canvas { height: 32px; }
  .stone-option span { font-size: 14px; }
  .actionbar { padding: 3px 5px; border-left: 1px solid var(--line); }
  .keyboard-hint, .tools span { display: none; }
  .tools { width: 100%; justify-content: space-around; gap: 0; }
  .tools .quiet-button { width: 44px; padding: 10px; }
  .scene-status { font-size: 12px; bottom: 10px; }
  .placement { top: 8px; bottom: auto; padding: 3px; }
  .turn-buttons > span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
