/* Shared garden semantics. Scene artwork and the existing control palette remain authoritative. */
:root {
  --thg-safe-area-top: var(--safe-area-inset-top, env(safe-area-inset-top,0px));
  --thg-safe-area-right: var(--safe-area-inset-right, env(safe-area-inset-right,0px));
  --thg-safe-area-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom,0px));
  --thg-safe-area-left: var(--safe-area-inset-left, env(safe-area-inset-left,0px));
  --thg-viewport-inset-top: 0px;
  --thg-viewport-inset-right: 0px;
  --thg-viewport-inset-bottom: 0px;
  --thg-viewport-inset-left: 0px;
  --thg-viewport-height: 100vh;
  --thg-surface: #faf5ee;
  --thg-text: #5d4c39;
  --thg-text-muted: #786659;
  --thg-border: #ded3bf;
  --thg-tool-selected: #e7d9c7;
  --thg-tool-border: #987b60;
  --thg-hover: #eee6d7;
  --thg-action: #6c7655;
  --thg-action-hover: #596247;
  --thg-action-text: #fffdf4;
  --thg-danger: #9c3a2f;
  --thg-focus: #a46840;
  --thg-notice-bg: #f0e3cc;
  --thg-notice-text: #654c2f;
  --thg-toast-bg: #514a3b;
  --thg-toast-text: #fbf8ef;
  --thg-overlay: #18251c99;
  --thg-placement-valid: #b6df9c;
  --thg-placement-invalid: #ff9b8c;
  --thg-grid: #fff3c9;
  --thg-brush-fill: #d8e9cd;
  --thg-selection: #fffdf0;
  --thg-warning: #a87838;
  --thg-door: #fff9d9;
  --thg-door-arrived: #fffbd4;
  --thg-door-shadow: inset 0 0 0 .5px #544a29b3;
  --thg-shadow: 0 3px 14px #40342424;
  --thg-control-shadow: 0 2px 7px #30261624;
  --thg-touch: 44px;
  --thg-icon: 18px;
  --thg-space-xs: 2px;
  --thg-space-sm: 4px;
  --thg-space-md: 8px;
  --thg-space-lg: 12px;
  --thg-space-xl: 16px;
  --thg-space-xxl: 20px;
  --thg-edge: 10px;
  --thg-control-edge: 14px;
  --thg-status-top: 78px;
  --thg-status-bottom: 74px;
  --thg-notice-bottom: 72px;
  --thg-radius-sm: 8px;
  --thg-radius-md: 12px;
  --thg-radius-lg: 16px;
  --thg-radius-round: 50%;
  --thg-font: var(--app-font-family, sans-serif);
  --thg-font-sm: max(12px, .75rem);
  --thg-font-md: max(13px, .8125rem);
  --thg-font-lg: max(16px, 1rem);
  --thg-font-heading: max(18px, 1.125rem);
  --thg-line: 1.6;
  --thg-focus-width: 3px;
  --thg-focus-offset: 2px;
  --thg-panel-height: 35%;
  --thg-panel-text-room: 10rem;
  --thg-panel-landscape-width: 320px;
  --thg-panel-landscape-clearance: 84px;
  --thg-dialog-width: 340px;
  --thg-menu-width: 132px;
  --thg-save-width: 70px;
  --thg-door-size: 14px;
  --thg-door-stroke: 1.5px;
  --thg-fast: .15s;
  --thg-door-pulse: 1.65s;
  --thg-disabled: .45;
}
html[data-appearance="dark"] {
  --thg-surface: #302922;
  --thg-text: #e6d6c8;
  --thg-text-muted: #c9b7a7;
  --thg-border: #5d4d41;
  --thg-tool-selected: #4d4033;
  --thg-tool-border: #b9a082;
  --thg-hover: #40362d;
  --thg-action: #b3c29a;
  --thg-action-hover: #c4d0af;
  --thg-action-text: #283022;
  --thg-danger: #ffb5a8;
  --thg-focus: #dfb18a;
  --thg-notice-bg: #493b29;
  --thg-notice-text: #f0d6aa;
}
/* Resolve viewport-dependent aliases on the element that owns the inline insets. */
.thg-root {
  --thg-inset-top: max(var(--thg-safe-area-top),var(--thg-viewport-inset-top));
  --thg-inset-right: max(var(--thg-safe-area-right),var(--thg-viewport-inset-right));
  --thg-inset-bottom: max(var(--thg-safe-area-bottom),var(--thg-viewport-inset-bottom));
  --thg-inset-left: max(var(--thg-safe-area-left),var(--thg-viewport-inset-left));
}
/* New garden viewer; no rules for the retired courtyard renderer. */
.thg-root { position:absolute; inset:0; z-index:2709; overflow:hidden; overscroll-behavior:none; background:#d8d9bd; color:#403f32; font-family:inherit; isolation:isolate; }
.thg-root * { box-sizing:border-box; }
.thg-root [hidden] { display:none !important; }
.thg-root button { font:inherit; cursor:pointer; color:inherit; -webkit-tap-highlight-color:transparent; }
.thg-root button:focus-visible { outline:var(--thg-focus-width) solid var(--thg-focus); outline-offset:var(--thg-focus-offset); }
.thg-head { position:absolute; z-index:15; top:calc(10px + var(--thg-inset-top)); left:max(10px, var(--thg-inset-left)); right:max(10px, var(--thg-inset-right)); display:flex; justify-content:space-between; align-items:flex-start; gap:16px; pointer-events:none; }
.thg-head>button { pointer-events:auto; }
.thg-back { width:44px; height:44px; flex:0 0 44px; padding:0 0 3px; border:1px solid #e1e2cd; border-radius:50%; background:#fbfcf1; font-size:29px !important; line-height:1; box-shadow:0 2px 7px #25312424; }
.thg-environment { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; gap:2px 9px; max-width:min(235px,calc(100% - 60px)); min-height:44px; padding:7px 11px; border:1px solid #e1e2cd; border-radius:13px; background:#fbfcf1; box-shadow:0 2px 7px #25312424; text-align:left; }
.thg-time { grid-row:1 / 3; font-size:20px; font-weight:600; line-height:1.2; font-variant-numeric:tabular-nums; letter-spacing:.015em; }
.thg-meta { grid-column:2; font-size:10px; line-height:1.4; min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.thg-location { grid-column:2; color:#62644e; font-size:10px; line-height:1.4; min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.thg-source { display:none; }
.thg-stage { position:absolute; inset:0; overflow:hidden; background:#d8d9bd; touch-action:manipulation; }
.thg-world { position:absolute; inset:0; transform-origin:50% 50%; }
.thg-image { position:absolute; display:block; width:100%; height:100%; max-width:none; object-fit:cover; user-select:none; -webkit-user-drag:none; }
.thg-plane { position:absolute; overflow:hidden; pointer-events:none; }
.thg-tone,.thg-sun,.thg-weather,.thg-plots { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.thg-tone { background:#26394d; opacity:var(--thg-night,.0); mix-blend-mode:multiply; }
.thg-sun { opacity:.16; background:radial-gradient(ellipse at 12% 10%,rgba(255,239,179,.65),transparent 62%); mix-blend-mode:screen; }
.thg-root:not([data-weather="sunny"]) .thg-sun,.thg-root[data-period="night"] .thg-sun { opacity:0; }
.thg-root[data-weather="rain"][data-period="day"] .thg-tone { background:#788c96; opacity:.23; }
.thg-root[data-weather="snow"][data-period="day"] .thg-tone { background:#94a9b7; opacity:.12; }
.thg-root[data-weather="cloudy"][data-period="day"] .thg-tone { background:#84949a; opacity:.12; }
.thg-root[data-loading="true"] .thg-image,.thg-root[data-loading="true"] .thg-plane,.thg-root[data-failed="true"] .thg-image,.thg-root[data-failed="true"] .thg-plane { visibility:hidden; }
.thg-message { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; flex-direction:column; padding:24px; gap:15px; text-align:center; background:#edece4; color:#766b5e; }
.thg-message p { font-size:13px; line-height:1.8; margin:0; max-width:25em; }
.thg-retry { border:1px solid #b39b86; background:transparent; padding:10px 20px; min-height:44px; border-radius:8px; font-size:12px !important; }
.thg-footer { display:none; }
.thg-footer-row { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.thg-footer-row p { margin:0; min-width:0; }
.thg-plots-toggle { flex:0 0 auto; min-height:40px; border:0; background:none; font-size:11px !important; color:#8a6355 !important; padding:5px 0 5px 9px; text-decoration:underline; text-underline-offset:4px; }
.thg-plot-list { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; margin-top:6px; }
.thg-plot-list button { border:1px solid #dfd1c3; min-height:40px; padding:6px 3px; border-radius:6px; font-size:11px; background:#faf5ee; }
.thg-plot-list button[aria-pressed="true"] { background:#e9ddd0; border-color:#a88d77; }
.thg-plot-detail { margin:5px 0 0; font-size:11px; color:#8a6355; }
.thg-plot-shape { fill:rgba(245,235,167,.18); stroke:#fff3c9; stroke-width:2; vector-effect:non-scaling-stroke; }
.thg-plot-shape.is-selected { fill:rgba(255,228,126,.4); stroke:#fffdf0; stroke-width:3; }
.thg-environment-backdrop { position:absolute; inset:0; z-index:50; display:flex; align-items:center; justify-content:center; padding:calc(14px + var(--thg-inset-top)) max(14px, var(--thg-inset-right)) calc(14px + var(--thg-inset-bottom)) max(14px, var(--thg-inset-left)); background:#18251c66; }
.thg-environment-sheet { width:min(360px,100%); max-height:100%; overflow:auto; overscroll-behavior:contain; border-radius:16px; padding:22px 20px 18px; background:#fbfcf1; box-shadow:0 8px 35px #14271929; }
.thg-environment-sheet h2 { margin:0; font-size:18px; line-height:1.5; font-weight:600; }
.thg-environment-note { margin:7px 0 20px; font-size:12px; line-height:1.7; color:#646751; }
.thg-environment-group { padding:0; border:0; margin:0 0 18px; min-width:0; }
.thg-environment-group legend { padding:0; margin:0 0 8px; font-size:12px; font-weight:600; }
.thg-environment-options { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:5px; }
.thg-root .thg-environment-option { min-width:0; min-height:44px; padding:7px 2px; border:1px solid #d9ddc8; border-radius:8px; font-size:12px; background:#fbfcf1; white-space:nowrap; }
.thg-root .thg-environment-option[aria-pressed="true"] { color:#fff; border-color:#5a6e43; background:#5a6e43; }
.thg-environment-source { color:#70745e; margin:0 0 16px; font-size:10px; line-height:1.6; overflow-wrap:anywhere; }
.thg-environment-error { color:#9c3a2f; margin:0 0 14px; font-size:12px; line-height:1.6; overflow-wrap:anywhere; }
.thg-environment-actions { display:flex; justify-content:flex-end; gap:10px; }
.thg-environment-actions button { min-width:80px; min-height:44px; padding:9px 16px; font-size:13px; border:1px solid #d9ddc8; border-radius:8px; background:transparent; }
.thg-environment-actions .thg-environment-save { background:#5a6e43; border-color:#5a6e43; color:white; }
.thg-environment-sheet button:disabled { opacity:.55; cursor:wait; }
@media(max-width:320px) { .thg-head { gap:10px; }.thg-environment { gap:2px 7px; padding-inline:9px; }.thg-time { font-size:18px; }.thg-environment-sheet { padding-inline:14px; }.thg-environment-options { gap:3px; } }
@media(orientation:landscape) and (max-height:560px) { .thg-head { top:calc(8px + var(--thg-inset-top)); }.thg-environment-sheet { width:min(480px,100%); padding:16px 20px; }.thg-environment-note { margin-bottom:12px; }.thg-environment-group { margin-bottom:10px; } }
@media(prefers-reduced-motion:reduce) { .thg-root * { scroll-behavior:auto !important; } }
.thg-root .thgp-toolbar button,.thg-root .thgp-camera button,.thg-root .thgp-panel button,.thg-root .thgp-menu button { min-width:44px; min-height:44px; border:1px solid #d7c7b7; background:#faf5ee; border-radius:7px; padding:7px 10px; font-size:12px; }
.thg-root .thgp-toolbar button[aria-pressed="true"],.thg-root .thgp-panel button[aria-pressed="true"] { background:#e7d9c7; border-color:#987b60; }
.thgp-toolbar { display:flex; gap:6px; align-items:center; justify-content:space-between; }
.thgp-person { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:center; font-size:11px; }
.thgp-toolbar>button { flex:0 0 auto; }
.thgp-status { margin:5px 0 0; font-size:11px; line-height:1.5; min-height:17px; color:#786659; }
.thgp-layout-notice { margin:6px 0 0; padding:7px 9px; border-left:3px solid #a87742; background:#f0e3cc; color:#654c2f; font-size:11px; line-height:1.6; overflow-wrap:anywhere; }
.thgp-camera { position:absolute; right:10px; top:10px; z-index:8; display:flex; gap:5px; }
.thg-root .thgp-camera button { padding:4px; min-width:44px; background:#faf5eeeF; }
.thgp-panel { max-height:35vh; overflow:auto; overscroll-behavior:contain; padding:8px 0 0; }
.thgp-tools { display:flex; gap:6px; overflow-x:auto; padding:2px 0 7px; }
.thgp-tools button { flex:0 0 auto; }
.thgp-panel select { min-height:44px; border:1px solid #d7c7b7; border-radius:7px; background:#faf5ee; color:#5c4a40; padding:8px; max-width:100%; }
.thgp-actions { display:flex; gap:6px; flex-wrap:wrap; }
.thgp-hint { margin:4px 0 8px; font-size:11px; color:#786659; }
.thgp-layer,.thgp-actors { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.thgp-layer { z-index:0; }.thg-tone,.thg-sun { z-index:1; }.thgp-actors { z-index:2; }.thg-weather { z-index:3; }.thg-plots { z-index:4; }
.thg-root[data-period="night"] .thgp-actors { filter:brightness(.72) saturate(.8); }
.thg-root canvas.thgp-actor { position:absolute; left:0; top:0; max-width:none; border:0; border-radius:0; box-shadow:none; transform-origin:0 0; pointer-events:none; }
.thg-root .thgp-door-mark { position:absolute; z-index:5; min-width:44px; min-height:44px; padding:4px; transform:translate(-50%,-95%); border:0; border-radius:9px; background:#faf5eed9; color:#68513e; font-size:11px; pointer-events:auto; }
.thg-root[data-editing="true"] .thgp-door-mark { pointer-events:none; opacity:.55; }
.thgp-menu { position:absolute; z-index:12; left:50%; bottom:16px; transform:translateX(-50%); width:min(290px,calc(100% - 24px)); padding:12px; border:1px solid #d7c7b7; background:#faf5ee; border-radius:10px; box-shadow:0 5px 20px #40342422; }
.thgp-menu strong { display:block; font-size:13px; margin-bottom:9px; }.thgp-menu div { display:flex; gap:8px; }.thgp-menu button { flex:1; }
.thg-stage.thgp-interactive { touch-action:none; }
.thg-root[data-editing="true"] .thg-plots { display:none; }
.thg-arrival-active .hm-room-layer { visibility:hidden !important; pointer-events:none !important; }
.thg-arrival-layer { position:absolute; inset:0; z-index:25; pointer-events:none; }
.thg-arrival-canvas { position:absolute; inset:0; width:100%; height:100%; max-width:none; border:0; border-radius:0; box-shadow:none; pointer-events:auto; touch-action:manipulation; }
.thg-arrival-label { position:absolute; left:50%; bottom:12px; transform:translateX(-50%); max-width:calc(100% - 24px); padding:5px 9px; border-radius:6px; background:#faf5eef0; color:#6d5c4d; font:11px/1.5 sans-serif; text-align:center; }
@media(orientation:landscape) and (max-height:560px) { .thgp-panel { max-height:30vh; }.thgp-status { margin-top:2px; }.thgp-camera { top:5px; right:5px; }.thg-back,.thg-motion { min-height:44px; } }
