/* 顶部按钮由 Phaser 绘制；DOM 只保留无外观的按钮语义。 */
#town-toolbar { position:fixed; pointer-events:none; z-index:1500; }
.town-semantic { position:absolute; margin:0; padding:0; opacity:0; pointer-events:none; border:0; }
.town-main-ui #roster { top:var(--town-roster-top,calc(var(--st) + 88px)); max-height:calc(100% - var(--town-roster-top,88px) - var(--sb) - 20px); overflow-y:auto; padding:3px; margin-right:-3px; scrollbar-width:none; }
.town-main-ui :is(#home-btn,#book-btn,#mail-btn,#hud,#treasury,#date-pop) { display:none !important; }
.town-main-ui #toast { top:calc(var(--town-roster-top,88px) + 4px); }
#town-environment-hud { position:fixed; pointer-events:none; z-index:1450; }
#town-environment-hud[hidden] { display:none !important; }
#town-calendar { position:fixed; pointer-events:none; z-index:1650; }
#town-calendar[hidden] { display:none !important; }
#town-environment-hud .invite-semantic, #town-calendar .invite-semantic { pointer-events:auto; cursor:pointer; touch-action:manipulation; }
.environment-readable { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap; }
.town-main-ui #bday-toast { top:calc(var(--st) + 94px); z-index:1800; max-width:calc(100% - var(--sl) - var(--sr) - 36px); white-space:normal; }
.town-main-ui #bday-card { z-index:2000; }
body:has(#profile.on) #town-toolbar, body:has(#book:not([hidden])) #town-toolbar, body:has(#homes:not([hidden])) #town-toolbar { display:none; }

/* 邀请页：原生控件仅承接中文输入法、系统选择器；可见外壳与文字在Phaser。 */
#invite { position:fixed; z-index:1600; pointer-events:none; }
#invite[hidden] { display:none; }
.invite-picture-input { position:absolute; opacity:0; pointer-events:auto; cursor:pointer; touch-action:manipulation; }
#birth-card { position:fixed; z-index:1600; pointer-events:none; }
#birth-card[hidden] { display:none; }
body:has(#profile.on) [data-ow-debug], body.birthing #town-toolbar, body.birthing #roster, body.birthing #hud, body.birthing [data-ow-debug] { visibility:hidden; }
body.birthing #ui > :not(#birth-card) { visibility:hidden; pointer-events:none; }
.invite-native { position:absolute; box-sizing:border-box; margin:0; border:0; border-radius:0; outline:none; background:transparent; color:transparent; caret-color:#6b283e; pointer-events:auto; font-family:-apple-system,"PingFang SC",sans-serif; resize:none; user-select:text; -webkit-user-select:text; }
.invite-native::placeholder { color:transparent; }
select.invite-native { opacity:.01; }
.invite-native[hidden] { display:none; }
.invite-semantic { position:absolute; opacity:0; pointer-events:none; border:0; padding:0; margin:0; }
body.inviting #ui > :not(#invite) { visibility:hidden; pointer-events:none; }
body.inviting #town-toolbar { display:none; }

input.invite-native, textarea.invite-native { touch-action:pan-x; }

/* 住处总览、住户管理与室内布置统一由 Phaser 绘制。 */
#homes.phaser-homes { position:absolute; inset:0; z-index:1600; padding:0; display:block; background:none; pointer-events:none; }
#homes.phaser-homes[hidden] { display:none; }
.housing-bridge { position:fixed; pointer-events:none; }
.library-bridge { position:fixed; z-index:1600; pointer-events:none; }
.shop-bridge { position:fixed; z-index:1600; pointer-events:none; }
.shop-bridge[hidden] { display:none; }
.building-guide-bridge { position:fixed; z-index:1600; pointer-events:none; }
.building-guide-bridge[hidden] { display:none; }
body.town-menu-open #roster { visibility:hidden; pointer-events:none; }
.building-guide-readable { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
body.workplace-open #ui > :not(#workplace):not(#profile):not(#subtitle) { visibility:hidden; pointer-events:none; }
body.workplace-open [data-ow-debug] { display:none !important; }
body.shop-open #ui > :not(#shop):not(#mall):not(#profile):not(#bday-card):not(#bday-toast) { visibility:hidden; pointer-events:none; }
body.shop-open [data-ow-debug] { display:none !important; }
body.cafe-open #ui > :not(#cafe):not(#profile) { visibility:hidden; pointer-events:none; }
body.cafe-open [data-ow-debug] { display:none !important; }
body.icecream-open #ui > :not(#icecream):not(#profile) { visibility:hidden; pointer-events:none; }
body.icecream-open [data-ow-debug] { display:none !important; }
.library-bridge[hidden] { display:none; }
body.library-open #ui > :not(#library):not(#profile) { visibility:hidden; pointer-events:none; }
body.library-open [data-ow-debug] { display:none !important; }
.school-bridge { position:fixed; z-index:1600; pointer-events:none; }
.school-bridge[hidden] { display:none; }
body.school-open #ui > :not(#school):not(#profile) { visibility:hidden; pointer-events:none; }
body.school-open [data-ow-debug] { display:none !important; }
body.hospital-open #ui > :not(#hospital):not(#profile) { visibility:hidden; pointer-events:none; }
body.hospital-open [data-ow-debug] { display:none !important; }
.post-office-bridge { position:fixed; z-index:1600; pointer-events:none; }
.post-office-bridge[hidden] { display:none; }
body.post-office-open #ui > :not(#post-office):not(#profile):not(#postal-mail) { visibility:hidden; pointer-events:none; }
body.post-office-open [data-ow-debug] { display:none !important; }
body.post-office-open #mail-box { display:none !important; }
.postal-mail-bridge { position:fixed; z-index:1700; pointer-events:none; }
.postal-mail-bridge[hidden] { display:none; }
body.postal-mail-open [data-ow-debug] { display:none !important; }
body.postal-mail-open #ui > :not(#postal-mail) { visibility:hidden !important; pointer-events:none !important; }

body.housing-open #ui > :not(#homes) { visibility:hidden; pointer-events:none; }

/* 名册图形与文字由 Phaser 绘制；仅输入时使用原生控件承接中文与滚动。 */
#book.phaser-book { position:absolute; inset:0; z-index:1600; padding:0; display:block; background:none; pointer-events:none; }
#book.phaser-book[hidden] { display:none; }
.book-bridge { position:fixed; pointer-events:none; }
.book-bridge[hidden] { display:none; }
.book-readable { position:absolute; width:1px; height:1px; padding:0; margin:-1px; clip-path:inset(50%); overflow:hidden; white-space:nowrap; }
body.book-open #ui > :not(#book) { visibility:hidden; pointer-events:none; }
.book-edit-bridge input.invite-native:focus, .book-edit-bridge textarea.invite-native:focus,
.book-edit-bridge input.invite-native.native-text { color:#603b23; }
.book-edit-bridge input.invite-native.native-text::placeholder { color:#76543b; }
/* Semantic roots never draw a second UI above the Phaser canvas. */
#ui .canvas-only{position:fixed;inset:auto;display:block;background:none;border:0;padding:0;margin:0;box-shadow:none;pointer-events:none;color:transparent}
#ui .canvas-only button{opacity:0;pointer-events:none}
/* Photo/story controllers retain semantic nodes; all visible content is Phaser. */
#bday-card,#wedding-hall,[data-activity-replay="wedding"],.canvas-source{opacity:0!important;pointer-events:none!important}
#bday-card *,#wedding-hall *,[data-activity-replay="wedding"] *{pointer-events:none!important}
#roster[data-renderer=phaser],#toast[data-renderer=phaser],#fight-toast,#bday-toast,#work-toast,#subtitle{opacity:0!important;pointer-events:none!important}
#rotate{opacity:0!important;pointer-events:none!important}
#ui [data-renderer=phaser] button,#town-environment-hud .invite-semantic,#town-calendar .invite-semantic{pointer-events:none!important}

.postal-mail-bridge .invite-native.native-text{color:#593b25;caret-color:#593b25;background:transparent}
.postal-mail-bridge .invite-native.native-text::placeholder{color:#95775a}
