/* Let each platform keep its scrolling gestures and scrollbar width. */
@media (forced-colors: none) {
  :root {
    --scroll-thumb: #816749;
    --scroll-track: #f2e4c9;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  }
  @supports not (scrollbar-color: auto) {
    ::-webkit-scrollbar { width: 12px; height: 12px; }
    ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: var(--scroll-track); }
    ::-webkit-scrollbar-thumb {
      background: var(--scroll-thumb);
      border: 2px solid var(--scroll-track);
      border-radius: 10px;
    }
  }
}

/* A readable editing size prevents Safari from enlarging the viewport on focus. */
@media(max-width:600px),(pointer:coarse){
 :root body :is(input:not([type=checkbox],[type=radio],[type=range],[type=button],[type=submit]),textarea,select,[contenteditable=true]){font-size:max(1rem,16px)!important}
}

/* Shared engraved wood finish. Keep each control's existing layout and touch target. */
@layer wooden-controls {
  :is(dialog,[role=dialog]) button:not(.modal-dismiss,.quest-help,.top-identity,.achievements .badge-card,.achievements .featured button,.achievements .detail-close,.public-chat *,.plot-site *,.preserves-frame .bake-recipe,.preserves-frame .locked-toggle,.offer-info-button,.offer-stepper *,.pin-enter,.event-text):not(:has(>svg:only-child,>img:only-child)) {
    padding:4px 8px !important;
  }
  :is(dialog,[role=dialog]) :is(.category-sheet,.order-tabs,.order-board footer,.actions,.visit-footer,.quest-current) button,
  :is(dialog,[role=dialog]) button:is(.primary,.solid,.quiet,.category-trigger) {
    min-height:32px !important;
    line-height:1.3;
  }
  @media (forced-colors:none) {
    :is(button,input[type=button],input[type=submit],input[type=reset],a.solid,a.primary,a.quiet,a.google-entry,[role=button]:not(svg *),a.btn):where(:not(.game-shell *), [role="dialog"] *, dialog *):not(.modal-dismiss,.quest-help,.top-identity,.achievements .badge-card,.achievements .featured button,.achievements .detail-close,.public-chat *,.plot-site *,.preserves-frame .bake-recipe,.preserves-frame .locked-toggle,.well-target,.bike-marker,.event-text) {

      background:
        var(--wood-nails,linear-gradient(transparent,transparent)),
        linear-gradient(0deg,transparent 22%,#573b2012 23%,transparent 26%,transparent 70%,#fff4cf15 71%,transparent 74%),
        linear-gradient(var(--wood-top,#89613d),var(--wood-base,#754e30)) !important;
      color:var(--wood-ink,#fff6df) !important;
      border:1px solid #735031 !important;
      border-radius:8px !important;
      box-shadow:inset 0 1px #f3d5a2,inset 0 -2px #614327,0 1px 2px #31231229 !important;
      text-shadow:none !important;
    }
    :is(button,input[type=submit],a.solid,a.primary,a.quiet,a.google-entry):where(:not(.game-shell *), [role="dialog"] *, dialog *):not(.modal-dismiss,.quest-help,.top-identity,.achievements .badge-card,.achievements .featured button,.achievements .detail-close,.public-chat *,.plot-site *,.preserves-frame .bake-recipe,.preserves-frame .locked-toggle):hover:not(:disabled) {
      --wood-top:#627647; --wood-base:#455e37;
    }
    :is(button[aria-pressed=true],button[aria-selected=true],button.active,button.selected,button.solid,button.primary,a.solid):where(:not(.game-shell *), [role="dialog"] *, dialog *):not(.modal-dismiss,.quest-help,.top-identity,.achievements .badge-card,.achievements .featured button,.achievements .detail-close,.public-chat *,.plot-site *,.preserves-frame .bake-recipe,.preserves-frame .locked-toggle) {
      --wood-top:#5d6a41; --wood-base:#475638;
    }
    :is(button,input):where(:not(.game-shell *), [role="dialog"] *, dialog *):not(.modal-dismiss,.quest-help,.top-identity,.achievements .badge-card,.achievements .featured button,.achievements .detail-close,.public-chat *,.plot-site *,.preserves-frame .bake-recipe,.preserves-frame .locked-toggle):disabled {
      --wood-top:#cabba0; --wood-base:#c3b294; --wood-ink:#554a37;
      box-shadow:inset 0 1px #ebdfc9 !important;text-shadow:none !important;
    }
    :is(button,input[type=submit],a.solid,a.primary,a.quiet,a.google-entry):where(:not(.game-shell *), [role="dialog"] *, dialog *):not(.modal-dismiss,.quest-help,.top-identity,.achievements .badge-card,.achievements .featured button,.achievements .detail-close,.public-chat *,.plot-site *,.preserves-frame .bake-recipe,.preserves-frame .locked-toggle):focus-visible {
      outline:3px solid #687d47 !important; outline-offset:2px;
    }
    :is(.visit-footer,.order-board,.quest-current,.craft-recipes,.room-output,.hero-actions) :is(button,a.solid,a.quiet) {
      --wood-nails:radial-gradient(circle at 5px 50%,#665035 1px,transparent 1.7px),radial-gradient(circle at calc(100% - 5px) 50%,#665035 1px,transparent 1.7px);
    }
  }
}
