/* First shared visual pass. Decoration is presentation only; all ornaments
   are existing transparent extracts, at their natural aspect ratio. */
html body[data-game='palace'] {
 --palace-paper:rgba(255,247,229,.84);
 --palace-quiet-folio-image:url('/public/assets/backgrounds/ui/quiet-paper.webp?v=35e77e1f0ff8');
 --palace-gold:rgba(174,131,67,.70);
 --palace-ink:#513724;
 --profile-portrait-ink:#9b6b36;
 --palace-inset:rgba(205,164,99,.44);
 --palace-story-font:var(--game-text-font);
 --palace-choice-background-image:image-set(url('/public/assets/ui/character-frames/ornaments/ornament-center-gold-02.webp?v=038bfafc99c2') type('image/webp'), url('../../public/assets/ui/character-frames/ornaments/ornament-center-gold-02.png') type('image/png')),image-set(url('/public/assets/ui/character-frames/ornaments/branch-floral-right-01.webp?v=22870a9a9fc1') type('image/webp'), url('../../public/assets/ui/character-frames/ornaments/branch-floral-right-01.png') type('image/png')),linear-gradient(100deg,rgba(255,252,241,.92),rgba(248,234,210,.84));
}
html body[data-game='palace'] .dialogue-stage {
 --dialogue-paper:rgba(255,248,233,.80);
 --dialogue-edge:var(--palace-gold);
 --dialogue-ink:var(--palace-ink);
 --dialogue-bottom:3cqh;
 font-family:var(--palace-story-font);
}
/* Narration, single speaker, mixed conversation and action feedback all use
   these exact coordinates. Portrait/nameplate/choices never shift the card. */
html body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage > .dialogue-box {
 left:50%; right:auto; bottom:var(--dialogue-bottom); transform:translateX(-50%);
 width:84%; height:var(--dialogue-height); max-height:none;
 padding:14px 24px 22px; gap:0; isolation:isolate;
 background:linear-gradient(110deg,rgba(255,254,248,.20),rgba(243,228,197,.16)),var(--dialogue-paper);
 border:1px solid var(--palace-gold); border-radius:20px;
 box-shadow:inset 0 0 12px rgba(255,252,239,.55),0 5px 20px rgba(49,33,15,.20);
 backdrop-filter:blur(1.5px); -webkit-backdrop-filter:blur(1.5px);
 overflow:visible;
}
html body[data-game='palace'] .dialogue-box::before {
 content:''; position:absolute; inset:4px; border:1px solid var(--palace-inset);
 border-radius:16px; pointer-events:none; z-index:0;
}
html body[data-game='palace'] .dialogue-box::after {
 content:''; position:absolute; inset:0; z-index:0; pointer-events:none; opacity:.60;
 background-image:image-set(url('/public/assets/ui/character-frames/ornaments/branch-floral-right-01.webp?v=22870a9a9fc1') type('image/webp'), url('../../public/assets/ui/character-frames/ornaments/branch-floral-right-01.png') type('image/png')),
 image-set(url('/public/assets/ui/character-frames/ornaments/corner-bottom-left-floral-01.webp?v=5dbb147be5e1') type('image/webp'), url('../../public/assets/ui/character-frames/ornaments/corner-bottom-left-floral-01.png') type('image/png')),
 image-set(url('/public/assets/ui/character-frames/ornaments/divider-center-gold-01.webp?v=05f4ece17b25') type('image/webp'), url('../../public/assets/ui/character-frames/ornaments/divider-center-gold-01.png') type('image/png')),
 linear-gradient(90deg,transparent,rgba(170,123,55,.60) 40%,transparent 44%,transparent 56%,rgba(170,123,55,.60) 60%,transparent);
 background-position:right 6px bottom 3px,left 4px bottom 4px,center bottom 5px,center bottom 12px;
 background-size:auto 90%,auto 44%,24px auto,26% 1px;
 background-repeat:no-repeat;
}
html body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage > .dialogue-box > .scene-text {
 position:relative; z-index:1; display:flex; align-items:center; justify-content:center;
 min-height:0; overflow:hidden;
}
html body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage .dialogue-box .dialogue-content {
 width:calc(100% - 28px); max-width:calc(100% - 28px); text-align:left; font-size:var(--font-story);
}
/* The inset plaque is the only structural difference from narrator cards. */
html body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage > .dialogue-box > .dialogue-speaker {
 top:auto; bottom:calc(100% - 8px); left:24px; z-index:3;
 min-width:5em; box-sizing:border-box; padding:3px 24px; text-align:center;
 font-size:var(--font-body); line-height:1.5; letter-spacing:.08em;
 color:#fff7e4; text-shadow:0 1px 2px rgba(64,39,14,.45);
 background-image:image-set(url('/public/assets/ui/character-frames/ornaments/title-branch-gold-01.webp?v=0d469060930a') type('image/webp'), url('../../public/assets/ui/character-frames/ornaments/title-branch-gold-01.png') type('image/png')),linear-gradient(110deg,#aa8050,#80603c);
 background-size:26px auto,100% 100%; background-position:right 2px center,center; background-repeat:no-repeat;
 border:1px solid #caab72; border-radius:11px 11px 7px 7px;
 box-shadow:inset 0 0 0 3px rgba(243,215,165,.27),0 2px 4px rgba(55,36,14,.17);
 backdrop-filter:none;
}
html body[data-game='palace'] .dialogue-stage > .dialogue-visual { z-index:4; }
html body[data-game='palace'] .dialogue-visual .dialogue-portrait {
 width:32%; max-width:32%; height:94%; left:-1%; bottom:-1%; overflow:visible;
}
/* During ordinary conversation the player faces inward from the right.
   Mirror only the image: portrait frames, captions, text and dossier art
   keep their normal orientation. NPC and narrator placement is unchanged. */
html body[data-game='palace'] .dialogue-stage > .dialogue-visual .dialogue-portrait[data-slot='right'][data-portrait-id='player'] {
 left:auto; right:-1%;
}
html body[data-game='palace'] .dialogue-stage > .dialogue-visual .dialogue-portrait[data-slot='right'][data-portrait-id='player'] > .portrait-image {
 transform:scaleX(-1);
}
html body[data-game='palace'] .dialogue-visual .portrait-image {
 object-position:center bottom;
 filter:drop-shadow(0 5px 10px rgba(51,34,18,.28));
 -webkit-mask-image:linear-gradient(to bottom,#000 88%,rgba(0,0,0,.85) 94%,transparent 100%);
 mask-image:linear-gradient(to bottom,#000 88%,rgba(0,0,0,.85) 94%,transparent 100%);
}
/* Choices share a stable center as well, with a bounded scrolling tray. */
html body[data-game='palace'] .dialogue-stage > .dialogue-floating-choices {
 left:50%; width:min(56%,760px); top:42%; max-height:49cqh;
 padding:4px 6px; gap:clamp(5px,1cqh,10px);
}
html body[data-game='palace'] :is(#game,#creation) .palace-choice,
html body[data-game='palace'] #creation.opening-setup .player-profile-hotspot,
html body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage > .dialogue-floating-choices > button,
html body[data-game='palace'].game-shell #tab-content.location-stage .location-actions > button,
html body[data-game='palace'].game-shell #tab-content.location-stage .location-actions > .game-action > button {
 background-image:var(--palace-choice-background-image);
 background-position:left 12px center,right 8px center,center;
 background-size:14px auto,auto 86%,100% 100%; background-repeat:no-repeat;
 background-color:transparent; color:var(--palace-ink);
 border:1px solid var(--palace-gold); border-radius:18px;
 box-shadow:inset 0 0 0 3px rgba(255,249,232,.90),inset 0 0 0 4px var(--palace-inset),0 3px 9px rgba(44,28,11,.16);
 padding:clamp(7px,1.15cqh,13px) 54px; min-height:clamp(36px,6cqh,58px);
 line-height:1.4; text-align:center;
 font-family:var(--palace-story-font);
}
html body[data-game='palace'] .dialogue-stage > .dialogue-floating-choices > details {
 color:var(--palace-ink); background:var(--palace-paper);
 border:1px solid var(--palace-gold); border-radius:14px;
 box-shadow:inset 0 0 0 3px rgba(255,249,232,.75),inset 0 0 0 4px var(--palace-inset);
 padding:6px 12px;
}
/* Top navigation: inherit existing placement, sizing and click handlers. */
html body[data-game='palace'] .dialogue-stage > .scene-heading,
html body[data-game='palace'] :is(#game,#intro,#creation) .scene-paths > button:not(.event-save-entry):not(.player-profile-hotspot),
html body[data-game='palace'].game-shell #game .location-nav > button:not(.global-save-entry),
html body[data-game='palace'].game-shell #game.game-page #tabs.home-menu > button:not(.player-avatar),
html body[data-game='palace'].game-shell #game.game-page > :is([data-return-home],[data-page-back]),
html body[data-game='palace'].game-shell #game button[data-browse-back],
html body[data-game='palace'].game-shell #game[data-page='context'] .context-detail-actions > button {
 color:var(--palace-ink); border:1px solid var(--palace-gold); border-radius:11px;
 background-color:var(--palace-paper);
 background-image:image-set(url('/public/assets/ui/character-frames/ornaments/title-branch-gold-01.webp?v=0d469060930a') type('image/webp'), url('../../public/assets/ui/character-frames/ornaments/title-branch-gold-01.png') type('image/png'));
 background-size:auto 82%; background-position:right -3px center; background-repeat:no-repeat;
 font-family:var(--palace-story-font);
 box-shadow:inset 0 0 0 2px rgba(255,251,235,.88),inset 0 0 0 3px var(--palace-inset),0 2px 6px rgba(40,27,14,.15);
}
/* The icon-only save shortcut keeps its unadorned frame. */
html body[data-game='palace'].game-shell #game[data-page='arrange'] > .location-nav > .global-save-entry {
 color:var(--palace-ink);
 border:1px solid var(--palace-gold); border-radius:11px;
 background-color:var(--palace-paper); background-image:none;
 box-shadow:inset 0 0 0 2px rgba(255,251,235,.88),inset 0 0 0 3px var(--palace-inset),0 2px 6px rgba(40,27,14,.15);
}
html body[data-game='palace'] .dialogue-stage > .scene-heading {
 top:clamp(8px,2cqh,20px); left:2%; padding:5px 26px 5px 12px;
 font-size:var(--font-body); max-width:48%; box-sizing:border-box;
}
html body[data-game='palace'] .dialogue-stage > .scene-paths { top:clamp(8px,2cqh,20px); right:2%; }
html body[data-game='palace'] :is(#game,#intro,#creation) .scene-paths > button:not(.event-save-entry):not(.player-profile-hotspot) {
 padding:6px 28px 6px 12px;
}
/* Selection's original decorated exit plaque remains, but must fit on one
   line. The generic scene-paths max-width caused its caption to wrap. */
html body[data-game='palace'] #intro.dialogue-stage > .scene-paths {max-width:none;}
html body[data-game='palace'] #intro.dialogue-stage > .scene-paths > button[data-opening-exit] {
 flex:0 0 auto;width:max-content;max-width:none;white-space:nowrap;text-align:center;
}
html body[data-game='palace'] .dialogue-stage .dialogue-input {
 border:1px solid var(--palace-gold); border-radius:16px;
 box-shadow:inset 0 0 0 4px rgba(206,167,100,.16),0 8px 30px rgba(43,29,14,.22);
 padding:16px; background:rgba(255,249,235,.97);
}
html body[data-game='palace'] .dialogue-history-open {
 position:absolute; top:5px; right:14px; z-index:3; width:auto; margin:0;
 padding:1px 6px; font-size:var(--font-note); line-height:1.4; min-height:0;
 color:#715232; border:0; background:rgba(255,248,232,.75); border-radius:5px;
}
html body[data-game='palace'] .dialogue-history { max-height:84cqh; }
html body[data-game='palace'] .dialogue-history h3 { margin:0 0 8px; font-size:var(--font-body); }
html body[data-game='palace'] .dialogue-history .stream-list { max-height:55cqh; overflow:auto; }
html body[data-game='palace'] .dialogue-history-close { display:block; margin:10px auto 0; }
/* Activity introductions already have their own continue control and text
   scrolling. Reuse the paper skin while retaining that interaction layout. */
html body[data-game='palace'].game-shell #game .spring-activity-intro-dialogue.scene-text {
 left:50%; transform:translateX(-50%); bottom:3cqh; width:84%;
 color:var(--palace-ink); font-family:var(--palace-story-font);
 background:var(--dialogue-paper,rgba(255,248,233,.80));
 border:1px solid var(--palace-gold); border-radius:16px;
 box-shadow:inset 0 0 0 4px rgba(205,164,99,.22),0 5px 20px rgba(49,33,15,.20);
 backdrop-filter:blur(1.5px); -webkit-backdrop-filter:blur(1.5px);
}
html body[data-game='palace'].game-shell #game :is(.spring-stream-choices,.spring-quiet-choices,.spring-outing-leave-choices) > button,
html body[data-game='palace'].game-shell #game :is(.spring-activity-intro-continue,.spring-outing-opening-story > button,[data-spring-area-back]) {
 color:var(--palace-ink); font-family:var(--palace-story-font);
 background-color:var(--palace-paper);
 background-image:image-set(url('/public/assets/ui/character-frames/ornaments/title-branch-gold-01.webp?v=0d469060930a') type('image/webp'), url('../../public/assets/ui/character-frames/ornaments/title-branch-gold-01.png') type('image/png'));
 background-position:right 2px center; background-size:auto 70%; background-repeat:no-repeat;
 border:1px solid var(--palace-gold); border-radius:11px;
 box-shadow:inset 0 0 0 2px rgba(255,251,235,.80),inset 0 0 0 3px var(--palace-inset);
}
html body[data-game='palace'] :is(.dialogue-floating-choices,.scene-paths,.location-nav,.home-menu,.dialogue-input) :is(button,summary):focus-visible {
 outline:2px solid #917039; outline-offset:3px;
}
html body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage > .dialogue-floating-choices > button:hover:not(:disabled) {
 background-color:rgba(255,255,248,.60); border-color:#956829;
}
html body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage > .dialogue-floating-choices > button:disabled { opacity:.55; }
@media (orientation:landscape) and (max-height:500px) {
 html body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage > .dialogue-box { padding:9px 12px 15px; border-radius:14px; }
 html body[data-game='palace'] .dialogue-box::before { border-radius:10px; }
}
html[data-mobile-device='true'] body[data-game='palace'] .dialogue-stage {
 --dialogue-height:22cqh; --dialogue-bottom:2cqh;
}
html[data-mobile-device='true'] body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage > .dialogue-box {
 padding:9px 12px 15px;
}
html[data-mobile-device='true'] body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage > .dialogue-box > .dialogue-speaker {
 font-size:var(--font-note); min-width:5em; padding:2px 19px; left:16px; bottom:calc(100% - 6px);
 background-size:21px auto,100% 100%;
}
html[data-mobile-device='true'] body[data-game='palace'] .dialogue-stage > .dialogue-floating-choices {
 top:40%; max-height:54cqh; width:58%; gap:4px; align-content:start;
}
html[data-mobile-device='true'] body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage > .dialogue-floating-choices > button {
 min-height:30px; padding:3px 30px; font-size:var(--font-story); line-height:1.3;
 background-position:left 8px center,right 4px center,center;
 background-size:10px auto,auto 80%,100% 100%; border-radius:13px;
}
html[data-mobile-device='true'] body[data-game='palace'] :is(#game,#intro,#tab-content).dialogue-stage .dialogue-box .dialogue-content {
 width:calc(100% - 16px); max-width:calc(100% - 16px);
}

/* A followed person is marked with a quiet outline glyph, never a color emoji. */
html body[data-game='palace'] .followed-star {
 display:inline-block;
 margin-left:.12em;
 color:#a38964;
 font-size:.84em;
 font-weight:400;
 line-height:1;
 vertical-align:baseline;
}

.attendant-notice {display:flex;align-items:center;gap:12px;border-bottom:1px solid #cdbb9c;padding:10px 0;}
.attendant-notice > p {flex:1;white-space:pre-line;overflow-wrap:anywhere;}
.attendant-notice > button {flex:none;min-height:36px;}

.home-gathering-shortcut {min-height:32px;padding:6px 10px;white-space:normal;}

/* Newborn naming: a full-width paper field over two equal choices. */
html body[data-game='palace'] #game.dialogue-stage > .dialogue-floating-choices.royal-child-name-tray {
 width:min(38%,320px);align-content:safe center;justify-items:center;
 grid-template-columns:repeat(2,minmax(0,1fr));
 row-gap:clamp(12px,3cqh,24px);column-gap:clamp(8px,1.2cqw,14px);
}
html body[data-game='palace'] #game .royal-child-name-form {grid-column:1/-1;width:100%;min-width:0;margin:0;}
html body[data-game='palace'] #game .royal-child-name-form > .royal-child-name-field {
 display:flex;align-items:center;gap:0;box-sizing:border-box;width:100%;
 min-width:0;padding:0 clamp(8px,1.1cqw,16px);
 color:#59412b;background:#fff8e9;
 border:1px solid #ad9169;border-radius:10px;
 box-shadow:0 2px 8px rgba(79,54,27,.12);font-size:var(--font-story);
 cursor:text;
}
html body[data-game='palace'] #game .royal-child-name-field > .royal-child-name-surname {
 flex:none;line-height:1.35;padding-right:clamp(7px,.9cqw,13px);
 border-right:1px solid rgba(164,132,83,.3);
}
html body[data-game='palace'] #game .royal-child-name-field > input {
 flex:1 1 0;min-width:0;width:100%;margin:0;
 padding:clamp(6px,1.1cqh,12px) 0 clamp(6px,1.1cqh,12px) clamp(7px,.9cqw,13px);
 font:inherit;color:inherit;background:none;border:0;box-shadow:none;border-radius:0;outline:none;backdrop-filter:none;
}
html body[data-game='palace'] #game .royal-child-name-field:focus-within {outline:2px solid #a58657;outline-offset:1px;}
html body[data-game='palace'] #game.dialogue-stage > .dialogue-floating-choices.royal-child-name-tray > button {
 box-sizing:border-box;width:100%;justify-self:stretch;min-width:0;
 padding:clamp(4px,.8cqh,8px) 12px;
}
