/* Authority shell: readable descriptions and touch-sized actions. */
body.theme-blue .item-row.authority-card {
  display:grid; grid-template-columns:minmax(0,1fr) auto auto;
  align-items:center; gap:6px 12px; padding:16px 18px; min-width:0;
}
body.theme-blue .authority-card > b { grid-column:1; grid-row:1; font-size:16px; line-height:1.5; overflow-wrap:anywhere; }
body.theme-blue .authority-card > small { grid-column:1; grid-row:2; font-size:13px; line-height:1.7; overflow-wrap:anywhere; min-width:0; }
body.theme-blue .authority-card > button { grid-row:1 / span 2; min-height:42px; white-space:normal; }
body.theme-blue .authority-card > button:nth-of-type(1) { grid-column:2; }
body.theme-blue .authority-card > button:nth-of-type(2) { grid-column:3; }
@media(max-width:600px) {
  body.theme-blue .item-row.authority-card { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; padding:14px; }
  body.theme-blue .authority-card > b, body.theme-blue .authority-card > small { grid-column:1 / -1; }
  body.theme-blue .authority-card > button { grid-row:auto; grid-column:auto !important; width:100%; min-height:44px; font-size:14px; }
  body.theme-blue #inp-jump-year { display:inline-block; width:72px; min-width:0; max-width:100%; font-size:16px; }
  #authority-end-confirmation button { min-height:44px; }
}

body.theme-blue .authority-card > b { display:flex; align-items:center; gap:10px; }
body.theme-blue .authority-card .item-art { flex:0 0 42px; width:42px; height:56px; aspect-ratio:3/4; }

/* Cut silhouettes live on the background: the full rectangular touch target remains. */
body.theme-blue #stage-game :is(button.authority-action,button[id^="authority-"]) {
  position:relative; isolation:isolate; border:0; border-radius:0;
  min-height:44px; padding:12px 23px; line-height:1.45;
  color:#f3f0e7; background:transparent; box-shadow:none;
  font-weight:600; letter-spacing:.05em; white-space:normal;
  transition:color .15s ease,transform .15s ease;
}
body.theme-blue #stage-game :is(button.authority-action,button[id^="authority-"])::before {
  content:""; position:absolute; inset:2px 0; z-index:-1; pointer-events:none;
  background:var(--silk-texture),linear-gradient(112deg,#ae9567 0 4px,#203b60 5px,#365378 85%,#1b304f);
  clip-path:polygon(9px 4%,100% 0,calc(100% - 9px) 96%,0 100%);
  transition:filter .15s ease;
}
body.theme-blue #stage-game :is(button.authority-action,button[id^="authority-"]):not(:disabled):hover::before {filter:brightness(1.18)}
body.theme-blue #stage-game :is(button.authority-action,button[id^="authority-"]):not(:disabled):active {transform:translateY(1px)}
body.theme-blue #stage-game :is(button.authority-action,button[id^="authority-"]):focus-visible {
  outline:2px solid #8c692e; outline-offset:3px;
}
body.theme-blue #stage-game :is(button.authority-action,button[id^="authority-"]):disabled {color:#52637a;opacity:1;cursor:not-allowed}
body.theme-blue #stage-game :is(button.authority-action,button[id^="authority-"]):disabled::before {
  background:var(--silk-texture),linear-gradient(112deg,#a6afbc 0 4px,#d4dce6 5px,#c2cdda);
}
@media(prefers-reduced-motion:reduce) {
  body.theme-blue #stage-game :is(button.authority-action,button[id^="authority-"]),
  body.theme-blue #stage-game :is(button.authority-action,button[id^="authority-"])::before {transition:none}
}

/* Destination map stays mounted during server requests and movement ticks. */
.authority-journey{margin:16px 0;padding:16px;background:var(--silk-texture),#e4e8ed;border-left:3px solid #a58c5a}
#authority-map{position:relative;aspect-ratio:1.7;min-height:230px;margin:14px 24px 24px;background:linear-gradient(32deg,transparent 35%,#98b0ba55 36%,transparent 48%),repeating-linear-gradient(0deg,#83949e25 0 1px,transparent 1px 10%),repeating-linear-gradient(90deg,#83949e25 0 1px,transparent 1px 10%),#182d42;border:1px solid #ad976c;cursor:crosshair;isolation:isolate}
body.theme-blue #stage-game #authority-map .map-place{position:absolute;transform:translate(-50%,-50%);padding:6px 9px;min-height:36px;max-width:116px;font-size:12px;line-height:1.3;z-index:2;background:#263c50;color:#f4e8ca;border:1px solid #9caea8;white-space:normal}
body.theme-blue #stage-game #authority-map .map-contest{border-color:#c98e64;color:#f5b997}
#authority-map-you,#authority-map-target{position:absolute;transform:translate(-50%,-50%);z-index:4;pointer-events:none;padding:3px 6px;border-radius:50%;background:#f1cf86;color:#182436;font-weight:bold;font-size:12px;border:2px solid #fff}
#authority-map-target{background:#466f89;color:white;border:1px dashed #e6c783;border-radius:2px;transform:translate(-50%,10px)}
@media(max-width:600px){#authority-map{min-height:250px;margin-left:10px;margin-right:10px}.authority-journey{padding:10px}body.theme-blue #stage-game #authority-map .map-place{max-width:82px;font-size:11px;min-height:40px}}

/* The paper surface owns the content bounds; decorative diagonals cannot undercut text. */
body.theme-blue #stage-game .main-workspace{box-sizing:border-box;min-width:0;background:var(--silk-texture),#e7edf5;border-left:3px solid #ae9567;padding:18px 24px 40px;box-shadow:-14px 10px 0 #10243b33}
body.theme-blue #stage-game .topbar{box-sizing:border-box;background:var(--silk-texture),#e7edf5;padding:10px 18px;min-width:0}
body.theme-blue #stage-game .topbar .tb-mid{min-width:80px}
body.theme-blue #stage-game .main-workspace :is(input,select){max-width:100%;box-sizing:border-box}
#authority-map-region{margin-left:12px;min-height:44px}
#authority-map-caption{font-size:12px;line-height:1.7}
@media(min-width:681px){
 body.theme-blue #stage-game .main-workspace{left:46%;right:2%;top:114px;bottom:55px}
 body.theme-blue #stage-game .topbar{left:46%;right:2%;top:18px;height:84px}
 body.theme-blue #stage-game .actions{left:46%;right:2%;bottom:8px;max-height:40px}
}
@media(min-width:681px) and (max-width:1250px),(min-width:681px) and (max-height:760px){
 body.theme-blue #stage-game .scene-portrait{width:27%;top:80px}
 body.theme-blue #stage-game .scene-portrait #portrait-realm{font-size:clamp(28px,3.6vw,46px)}
 body.theme-blue #stage-game .main-workspace{left:28%;right:2%;top:166px;bottom:55px}
 body.theme-blue #stage-game .topbar{left:28%;right:2%;top:18px;height:78px}
 body.theme-blue #stage-game>#side-tabs{left:28%;right:2%;top:105px;bottom:auto;width:auto;height:49px;box-sizing:border-box;transform:none;flex-direction:row;gap:3px;align-items:center;overflow-x:auto;overflow-y:hidden}
 body.theme-blue #stage-game>#side-tabs button{flex:1 0 auto;min-width:44px;min-height:44px;margin:0!important;padding:9px 10px;font-size:18px;letter-spacing:1px;white-space:nowrap}
 body.theme-blue #stage-game>#side-tabs #toggle-character{order:7;width:auto;font-size:14px}
 body.theme-blue #stage-game .actions{left:28%}
 body.theme-blue #stage-game .scene-brand{font-size:21px;left:18px}
 body.theme-blue #stage-game .scene-brand span{font-size:8px;letter-spacing:1px}
 body.theme-blue #stage-game .selection-layout{grid-template-columns:minmax(0,1fr)}
 body.theme-blue #stage-game .selection-detail{position:relative}
}
@media(max-width:680px){body.theme-blue #stage-game .main-workspace{padding:12px 16px 28px;border-left:0;box-shadow:none}body.theme-blue #stage-game .topbar{padding:6px 10px}}

@media(min-width:1251px) and (min-height:761px){body.theme-blue #stage-game>#side-tabs{left:30.5%}}

#authority-map{--map-label-half:58px}
@media(max-width:600px){#authority-map{--map-label-half:41px}}

/* Several available actions form rows rather than growing implicit grid columns. */
body.theme-blue .authority-card:has(>button:nth-of-type(3)){grid-template-columns:repeat(2,minmax(0,1fr))}
body.theme-blue .authority-card:has(>button:nth-of-type(3))>b,body.theme-blue .authority-card:has(>button:nth-of-type(3))>small{grid-column:1 / -1}
body.theme-blue .authority-card:has(>button:nth-of-type(3))>button{grid-column:auto!important;grid-row:auto;min-width:0}

#authority-alerts{position:sticky;top:0;z-index:12;max-height:42vh;overflow:auto;padding:8px;margin-bottom:14px;border-left:4px solid #a16d35;background:var(--silk-texture),#ede2ca;box-shadow:0 5px 15px #13294130}
#authority-alerts[hidden]{display:none}
#authority-alerts .authority-card{margin:0;background:transparent;box-shadow:none}
@media(max-width:680px){#authority-alerts{max-height:35vh;padding:4px}#authority-alerts .authority-card{padding:10px}}

.authority-offline-dialog{box-sizing:border-box;width:min(900px,94vw);max-height:90dvh;overflow:auto;background:#eee8dc;color:#18233b;border:3px solid #18233b;padding:24px}.authority-offline-dialog::backdrop{background:#101b34bb}.authority-offline-dialog fieldset{border:0;padding:0;min-width:0}.authority-offline-dialog label{display:inline-flex;gap:8px;margin:8px;flex-wrap:wrap}.authority-offline-dialog button{margin:4px;padding:8px 12px}.authority-offline-dialog details{margin:16px 0;border-top:1px solid #18233b55;padding-top:10px}.authority-offline-dialog p{overflow-wrap:anywhere}
