/* WingHér polish layer: touch feedback, phone app shell, sheets, the scene camera and the in-world signboard card.
   Loaded last so it can refine the existing styles without rewriting them. */

/* ---------- Touch feedback: every control answers a press ---------- */
button,a.primary,.person-link,select,input{-webkit-tap-highlight-color:transparent}
button,a.primary{touch-action:manipulation;transition:transform .12s ease,background-color .16s ease,border-color .16s ease,box-shadow .16s ease,opacity .16s ease}
button:active:not(:disabled),a.primary:active{transform:scale(.96)}
button.primary:active:not(:disabled),a.primary:active{background:#8f4055}
button.outline:active:not(:disabled){background:#f1ddd0}
.event-card,.connection-card,.plan-card{transition:box-shadow .18s ease,transform .18s ease}
input,select,textarea{transition:border-color .16s ease,box-shadow .16s ease}

/* ---------- Dialogs open with a short lift ---------- */
dialog[open]{animation:wh-pop .22s cubic-bezier(.2,.8,.2,1)}
dialog::backdrop{animation:wh-fade .2s ease}
@keyframes wh-pop{from{opacity:0;transform:translateY(14px) scale(.985)}}
@keyframes wh-fade{from{opacity:0}}
@keyframes wh-sheet{from{transform:translateY(36px);opacity:.4}}
@keyframes wh-room{from{opacity:.25;transform:scale(1.025)}}
.stage.room-enter #camera{animation:wh-room .32s ease}

/* ---------- Confirm sheet (replaces the browser confirm box) ---------- */
.confirm-dialog{max-width:400px}
.confirm-dialog p{font:20px/1.35 Georgia,serif;margin:4px 0 20px;color:#422f38}
.confirm-dialog .row{justify-content:stretch}
.confirm-dialog .row button{flex:1;min-height:48px}

/* ---------- Private meetup plans: pinned above the scene ---------- */
#meetupPlans{margin:0 0 12px;border-color:#c99aa5;background:linear-gradient(180deg,#fff7f1,#fffaf2);box-shadow:0 4px 18px #7a3b4a14}
#meetupPlans h3{font:22px Georgia,serif;margin:0 0 10px}
#meetupPlans>button{margin:4px 6px 0 0}
.plan-card{margin:0 0 10px;border-left:4px solid #c9b3a6}
.plan-card.needs-reply{border-left-color:var(--rose);background:#fff3ee}
.plan-card.confirmed{border-left-color:var(--sage);background:#f1f5ea}
.plan-card strong{display:block;font-size:15px}
.plan-card p{margin:6px 0 10px;font-size:14px;line-height:1.4}
.plan-card button{margin:0 6px 6px 0}

/* ---------- Signboard: the in-world board has a text twin under the scene ---------- */
.board-card{display:grid;grid-template-columns:1fr auto;gap:2px 12px;align-items:center;width:100%;text-align:left;margin:10px 0 0;padding:11px 14px;border-radius:10px;border:1px solid #d9c2a0;background:linear-gradient(120deg,#fff6e0,#fbe9d2);min-height:56px}
.board-card[hidden]{display:none}
.board-kicker{grid-column:1;font-size:11px;font-weight:800;letter-spacing:.08em;color:#81465a}
.board-card strong{grid-column:1;font:600 17px/1.2 Georgia,serif;color:#3d333a}
.board-meta{grid-column:1;font-size:13px;color:var(--muted);font-weight:500}
.board-go{grid-column:2;grid-row:1/4;font-size:13px;font-weight:800;color:#2a1e2a;background:#ffe086;border-radius:999px;padding:8px 12px;white-space:nowrap}
.share-event{display:block;margin:10px 0 0}

/* ---------- Studio: actions on the scene and the shared drawing board ---------- */
.stage-actions{display:none;position:absolute;left:50%;bottom:10px;transform:translateX(-50%);z-index:3;gap:8px;white-space:nowrap}
#game[data-place="studio"] .stage-actions{display:flex}
.stage-actions button{min-height:46px;border-radius:23px;padding:8px 16px;box-shadow:0 3px 12px #3d253540}
.stage-actions .outline{background:#fffaf3f2}
.board-dialog{max-width:680px!important;width:min(680px,calc(100vw - 24px))}
#boardCanvas{display:block;width:100%;height:auto;aspect-ratio:960/600;background:#fffaf2;border:1px solid var(--line);border-radius:10px;touch-action:none;cursor:crosshair}
.board-tools{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:12px 0 4px}
.board-swatch{width:40px;height:40px;min-height:40px;padding:0;border-radius:50%;border:3px solid #fff;box-shadow:0 0 0 1px #cebbb3}
.board-swatch.selected{box-shadow:0 0 0 3px #523a47}
.board-tools .selected{background:var(--rose);border-color:var(--rose);color:#fff}
.board-invite{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.board-invite .small{flex-basis:100%;margin:8px 0 2px}

/* ---------- This or that: the walk-to-your-side game ---------- */
.sides-card{margin:10px 0 0;padding:12px 14px;border-radius:10px;border:1px solid var(--line);background:#fffaf2}
.sides-card[hidden]{display:none}
.sides-head{display:flex;align-items:center;gap:10px}
.sides-head .small{margin:0;flex:1}
.sides-head .quiet{min-height:36px;padding:4px 8px;font-size:13px;color:#84384f;text-decoration:underline;text-underline-offset:3px}
.sides-choices{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px}
.sides-choices button{min-height:52px;font-size:15px;white-space:normal}
#sideLeft.selected{background:#f8e1e5;border-color:var(--rose);color:#8f3c52}
#sideRight.selected{background:#e3eedd;border-color:var(--sage);color:#3f6a55}
#sidesTogether{margin:8px 0 0}

/* ---------- Toast and app navigation exist only on phones ---------- */
.app-nav,.toast,.chat-dock,.chat-feed,.cards-toggle{display:none}
.emotes button.selected{background:var(--rose);border-color:var(--rose);color:#fff}
.me-menu{display:grid;gap:8px}
.me-menu button{justify-content:space-between;display:flex;align-items:center;min-height:52px;font-size:15px;text-align:left}
.me-menu small{font-weight:500;color:var(--muted)}
.me-menu .danger{color:#8a2f3d;border-color:#d9a9b0}

@media(max-width:740px){
 /* Readable type: nothing the reader needs is under 13px */
 .small,.notice,.check,.board-meta,.event-venue,.event-price,#spotlightDetails{font-size:13px}
 .eyebrow,.edition,.event-category,.card-kind{font-size:11px;letter-spacing:.12em}
 .edition{max-width:150px}
 footer{font-size:12px}
 footer a,.small a{display:inline-block;padding:6px 0}
 button{min-height:44px;font-size:14px}
 .primary,.outline{min-height:46px}
 #findEvent,#enter{min-height:52px;font-size:16px;width:100%}
 input,select,textarea{min-height:46px;font-size:16px}
 .check{align-items:center;min-height:44px;margin:8px 0;gap:12px}
 .check input{width:24px;height:24px;min-height:0;flex:none;accent-color:var(--rose)}
 .swatches{flex-wrap:wrap;gap:10px}
 .swatches button{width:38px;height:38px;min-height:38px}
 .friend-code summary{min-height:44px;display:flex;align-items:center}
 .close-dialog{min-width:44px;min-height:44px}

 /* Dialogs become bottom sheets */
 dialog{position:fixed;inset:auto 0 0 0;margin:0;width:100%;max-width:none;max-height:88dvh;overflow:auto;border-radius:20px 20px 0 0;border-width:1px 0 0;padding:22px 20px max(24px,env(safe-area-inset-bottom));box-sizing:border-box;box-shadow:0 -10px 40px #3920202e}
 dialog.community-dialog{width:100%;border-radius:20px 20px 0 0;padding:22px 20px max(24px,env(safe-area-inset-bottom))}
 dialog[open]{animation:wh-sheet .3s cubic-bezier(.2,.8,.2,1)}
 dialog::before{content:"";display:block;width:42px;height:4px;border-radius:4px;background:#d8c4b8;margin:-8px auto 12px}
 #tourDialog{width:100%}
 .event-actions button{flex:1}
 #eventDetails .primary,#eventDetails .outline{width:100%;justify-content:center;text-align:center;box-sizing:border-box;margin-top:8px}
 #eventDetails .row{gap:8px}
 #eventDetails .row button{width:auto;flex:1;margin-top:0}

 /* App shell: the in-world screen fills the phone and navigation sits under the thumb */
 #game:not([hidden])~footer{display:none}
 main:has(#game:not([hidden])){padding-bottom:calc(84px + env(safe-area-inset-bottom))}
 main:has(#game:not([hidden])) header .edition,main:has(#game:not([hidden])) #installApp,main:has(#game:not([hidden])) #leave{display:none}
 main:has(#game:not([hidden])) header{padding:10px 0;border-bottom:0}
 .world-heading{padding:4px 0 10px;gap:8px}
 .world-heading .eyebrow{display:none}
 .world-heading h1{font-size:30px;margin:0}
 .gathering{max-width:none;align-items:end}
 .gathering #invite,.gathering #gatheringCode{display:none}
 .community-toolbar{display:none}
 #rooms{gap:8px;padding-bottom:10px;scrollbar-width:none;scroll-snap-type:x proximity}
 #rooms::-webkit-scrollbar{display:none}
 #rooms button{font-size:13px;min-height:44px;padding:8px 12px;scroll-snap-align:start;flex:none}
 #roomChatShortcut{display:none}
 #roomSidebar{display:none}
 .room-chat-open #roomSidebar{display:block;left:0;right:0;bottom:calc(64px + env(safe-area-inset-bottom));border-radius:20px 20px 0 0;border-width:1px 0 0;max-height:70dvh;animation:wh-sheet .3s cubic-bezier(.2,.8,.2,1)}
 .room-chat-open #eventsPanel{max-height:52dvh;overflow:auto}
 #closeRoomChat{min-height:40px}
 .side-tabs button{min-height:44px;font-size:13px}
 .notice{display:none}

 /* Scene camera: a taller scene that follows her, in place of a small fixed picture */
 .stage{margin:0 -14px;border-radius:0;border-width:1px 0}
 .stage.cam{height:var(--stage-h,min(52dvh,430px));overflow:hidden}
 .stage.cam #camera{position:relative;height:100%;width:calc(var(--stage-h,min(52dvh,430px))*680/440);will-change:transform}
 #live3dFrame{height:var(--stage-h,440px)}
 .stage.cam #world{width:100%;height:100%;max-width:none}
 .walktools{padding:10px 0 4px}
 .walktools p{font-size:13px;color:var(--muted)}
 .emotes button{min-width:48px;min-height:44px}
 .dressup-controls select{min-height:46px}
 .dressup-controls legend,.studio-players,.direct-line b,.gathering,label{font-size:13px}
 #connection{font-size:13px}
 .start-steps span,.header-actions button,.friend-code summary,.activity p{font-size:13px}
 #bubble.avatar-bubble{font-size:13px;max-width:200px}

 .app-nav{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;left:0;right:0;bottom:0;z-index:60;background:#fffaf3f7;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-top:1px solid var(--line);padding:6px 6px max(6px,env(safe-area-inset-bottom));box-shadow:0 -4px 18px #3d253514}
 .app-nav[hidden]{display:none}
 .app-nav button{position:relative;display:grid;justify-items:center;gap:2px;min-height:52px;padding:6px 2px;border:0;background:none;color:var(--muted);font:650 12px system-ui;border-radius:12px}
 .app-nav button.selected{color:var(--rose);background:#f8e6e2}
 .nav-icon{font-size:19px;line-height:1}
 .nav-badge{position:absolute;top:3px;left:calc(50% + 8px);min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--rose);color:#fff;font:700 11px/18px system-ui;box-sizing:border-box}
 .nav-badge[hidden]{display:none}

 /* Declutter: actions live on the scene; one card under it */
 .walktools{display:none}
 .stage .emotes{position:absolute;right:8px;top:8px;z-index:3;display:flex;flex-direction:column;gap:6px;align-items:flex-end}
 .stage .emotes button{min-width:46px;min-height:44px;padding:4px 10px;border-radius:22px;font-size:13px;background:#fffaf3eb;border:1px solid #d9c4b6;box-shadow:0 2px 8px #3d253526}
 .stage .emotes button.selected{background:var(--rose);border-color:var(--rose);color:#fff}
 .stage .emotes button[hidden]{display:none}
 .stage #toggleLive3d{position:absolute;left:8px;top:8px;z-index:3;min-height:40px;padding:4px 12px;border-radius:20px;font-size:13px;background:#fffaf3eb;box-shadow:0 2px 8px #3d253526}
 .stage #toggleLive3d[hidden]{display:none}
 .board-card{position:absolute;width:1px;height:1px;min-height:0;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);border:0}
 #game[data-place="district"] #roomActivity,#game[data-place="cafe"] #roomActivity,#game[data-place="courtyard"] #roomActivity{display:none}
 #game[data-place="lounge"] #roomActivity{padding:12px 14px;margin-top:10px}
 #game[data-place="lounge"] #roomActivity h3,#game[data-place="lounge"] #roomActivity>p{display:none}
 #game[data-place="lounge"] #roomActivity .row button{flex:1}
 .cards-toggle{display:block;width:100%;margin:10px 0 0}
 .cards-toggle[hidden]{display:none}
 #conversationCards.folded{display:none}
 .sides-card .eyebrow,#sidesTimer{display:none}
 .sides-card{display:flex;flex-direction:column;gap:2px;margin:0 0 8px;padding:8px 10px}
 .sides-card #sidesPlay{order:1}
 .sides-card{position:relative;padding-right:44px}
 .sides-card .sides-head{position:absolute;top:50%;right:4px;transform:translateY(-50%)}
 .sides-card .sides-head .quiet{min-width:36px;min-height:44px;padding:0;font-size:22px;text-decoration:none;color:var(--muted)}
 .sides-card:has(#sidesPlay[hidden]){padding-right:10px}
 .sides-card:has(#sidesPlay[hidden]) .sides-head{position:static;transform:none}
 .sides-card:has(#sidesPlay[hidden]) .sides-head .quiet{width:100%;font-size:14px;color:#84384f;text-decoration:underline}
 #sidesTogether:empty{display:none}
 .sides-choices{margin-top:0}
 .sides-choices button{min-height:44px;font-size:14px;padding:6px 8px}
 #sidesTogether{margin:4px 0 0;font-size:12px}
 .world-heading h1{font-size:24px}
 #rooms{padding-bottom:8px}

 /* Chat that leaves the scene in view */
 main:has(#game:not([hidden])){padding-bottom:calc(142px + env(safe-area-inset-bottom))}
 .chat-dock{display:flex;gap:8px;align-items:center;position:fixed;left:0;right:0;bottom:calc(64px + env(safe-area-inset-bottom));z-index:55;padding:8px 10px;background:#fffaf3f2;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-top:1px solid var(--line)}
 .chat-dock[hidden]{display:none}
 .chat-dock input{flex:1;min-width:0;min-height:44px;border-radius:22px;padding:0 16px;border:1px solid #cdb8b0;background:#fff}
 .chat-dock button{min-width:44px;min-height:44px;border-radius:22px;padding:0}
 .chat-feed{display:flex;flex-direction:column;align-items:flex-start;gap:4px;position:absolute;left:10px;bottom:10px;z-index:3;max-width:78%;pointer-events:none}
 .chat-feed p{margin:0;padding:6px 10px;border-radius:12px;background:#2a1e2ab8;color:#fff8f1;font-size:13px;line-height:1.3;overflow-wrap:anywhere;animation:wh-pop .25s ease}
 .chat-feed b{color:#ffd9de;font-weight:700}
 .stage.sides-on .chat-feed{bottom:42px}
 /* In the 3D rooms the thumb-stick owns the bottom-left corner */
 .stage:has(#live3dFrame:not([hidden])) .chat-feed{left:126px;bottom:10px;max-width:calc(100% - 196px)}
 .stage-actions{left:auto;right:8px;transform:none;flex-direction:column;align-items:flex-end}
 .stage-actions button{min-height:44px;padding:6px 14px;font-size:13px}
 .toast{display:block;position:fixed;left:14px;right:14px;bottom:calc(134px + env(safe-area-inset-bottom));z-index:70;padding:12px 16px;border-radius:14px;background:#3d333af2;color:#fff8f1;font-size:14px;line-height:1.35;box-shadow:0 8px 26px #2a171d40;animation:wh-sheet .26s ease}
 .toast[hidden]{display:none}
}

@media(prefers-reduced-motion:reduce){
 *,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important}
}
