/* 相棒ホーム。1280×720 のステージごと縮小・回転する。 */
#stage-viewport:has(#battle-home-screen:not(.hidden)) { overflow: clip; }

#battle-home-screen {
  --ink: #f5efdf;
  --muted: #c2c6c6;
  --accent: #edcf91;
  --rule: #c8ad795c;
  --serif: "Duel Serif", "Yu Mincho", serif;
  padding: 0;
  overflow: clip;
  background: #112330;
  color: var(--ink);
  font: 400 16px/1.6 "Duel Sans", "Yu Gothic", sans-serif;
}
#battle-home-screen button { font-family: inherit; cursor: pointer; }
#battle-home-screen button:disabled { cursor: default; }
#battle-home-screen button:focus-visible { outline: 2px solid #ffe3a0; outline-offset: 3px; }
#battle-home-screen .battle-home {
  display: grid;
  grid-template: minmax(0, 1fr) 267px / minmax(0, 1fr);
  gap: 0;
  height: 100%;
}

/* 風景を一枚敷き、その中に人物・話者窓・小道具を置く。 */
#battle-home-screen .bh-stage {
  position: relative;
  isolation: isolate;
  min-height: 0;
  overflow: hidden;
  background: #272323;
}
#battle-home-screen .bh-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 52%;
  pointer-events: none;
}
#battle-home-screen .bh-header {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 55px;
  padding: 0 30px;
  border-bottom: 1px solid #b19768ad;
  background: linear-gradient(90deg, #171819f7, #19191ce6 48%, #17171aec);
  color: #f8e8c3;
}
#battle-home-screen .bh-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  white-space: nowrap;
  font: 700 24px/1.2 var(--serif);
  letter-spacing: .075em;
}
#battle-home-screen .bh-brand img {
  width: 22px;
  height: 29px;
  padding: 2px;
  border-radius: 3px;
  background: #f8efdc;
  box-shadow: 0 2px 0 #839181;
}
#battle-home-screen .bh-player { display: flex; align-items: baseline; gap: 10px; padding-left: 22px; border-left: 1px solid var(--rule); min-width: 0; }
#battle-home-screen #bh-name { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#battle-home-screen .bh-streak { color: #f5c393; font-size: 14px; white-space: nowrap; }
#battle-home-screen .bh-util { position: static; margin-left: auto; align-items: center; gap: 15px; }

/* 汎用ボタンは四隅の絵を保ち、中央をラベルの幅に合わせる。 */
#battle-home-screen .bh-framed {
  border: solid transparent;
  border-width: 8px 14px;
  border-image: url("../../graphic/ui/sc/btn.png") 11 15 fill / 9px 14px;
  background: none;
  border-radius: 0;
  box-shadow: none;
  color: var(--ink);
}
#battle-home-screen .bh-framed:is(:hover, :focus-visible, [aria-pressed="true"]):not(:disabled) {
  border-image-source: url("../../graphic/ui/sc/btn_hover.png");
  color: #fff8de;
}
#battle-home-screen .bh-framed:active:not(:disabled) { border-image-source: url("../../graphic/ui/sc/btn_press.png"); }
#battle-home-screen .bh-amb-edit { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 0 6px; }
#battle-home-screen .bh-location { font: 600 17px/1.2 var(--serif); }
#battle-home-screen .bh-amb-caption { padding-left: 9px; border-left: 1px solid var(--rule); color: #f0dec1; font-size: 13px; }
#battle-home-screen .bh-system {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
}
#bh-settings {
  --icon: url("../../graphic/ui/sc/btn_config.png");
  --icon-hover: url("../../graphic/ui/sc/btn_config_hover.png");
  --icon-down: url("../../graphic/ui/sc/btn_config_press.png");
}
#bh-title {
  --icon: url("../../graphic/ui/sc/btn_back.png");
  --icon-hover: url("../../graphic/ui/sc/btn_back_hover.png");
  --icon-down: url("../../graphic/ui/sc/btn_back_press.png");
}
#battle-home-screen .bh-system::before {
  content: "";
  width: 35px;
  height: 37px;
  background: var(--icon-state, var(--icon)) center / contain no-repeat;
}
#battle-home-screen :is(.bh-system, .bh-change, .bh-picker-x):is(:hover, :focus-visible) { --icon-state: var(--icon-hover); }
#battle-home-screen :is(.bh-system, .bh-change, .bh-picker-x):active { --icon-state: var(--icon-down); }

#battle-home-screen .bh-portrait-wrap {
  z-index: 1;
  inset: 60px auto 0 24px;
  width: 54%;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  appearance: none;
  overflow: visible;
}
#battle-home-screen .bh-portrait-wrap:focus-visible { outline-offset: -5px; }
#battle-home-screen .bh-portrait { height: 385%; pointer-events: none; filter: drop-shadow(2px 4px 5px #211b252e); }
#battle-home-screen .bh-portrait-fallback {
  display: grid;
  place-items: center;
  align-self: center;
  width: 144px;
  height: 144px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  font: 600 64px/1 var(--serif);
}
#battle-home-screen .bh-companion {
  position: absolute;
  z-index: 2;
  right: 26px;
  bottom: 18px;
  display: grid;
  grid-template-rows: 192fr 36fr;
  width: 704px;
  height: 181px;
  background: url("../../graphic/ui/sc/msgwin.png") center / 100% 100% no-repeat;
}
/* 原画の上48pxは話者名、次の144pxが本文、下36pxは操作帯。 */
#battle-home-screen .bh-dialogue {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: 1fr 3fr;
  min-height: 0;
}
#battle-home-screen .bh-dialogue::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 25% 0 0;
  background: linear-gradient(90deg, transparent, #19141850 9%, #19141822 50%, #19141850 91%, transparent);
  pointer-events: none;
}
#battle-home-screen .bh-charname {
  position: static;
  grid-row: 1;
  width: 42%;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  color: #fff0c5;
  font: 600 22px/1.2 var(--serif);
  text-shadow: 0 1px 2px #352316;
}
#battle-home-screen .bh-talk {
  position: static;
  grid-row: 2;
  align-self: center;
  display: block;
  min-height: 0;
  margin: 0;
  padding: 0 66px;
  color: #fff7e7;
  background: none;
  font: 500 20px/1.55 var(--serif);
  overflow-wrap: anywhere;
  line-break: strict;
  text-shadow: 0 1px 2px #120e0d;
}
#battle-home-screen .bh-speak {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  margin-left: auto;
  padding: 0 3px;
  background: none;
  border: 0;
  color: #f1dfb4;
  font-size: 13px;
  text-shadow: 0 1px 2px #211910;
}
/* 会話窓の本文も、下帯の「話しかける」と同じ操作面にする。 */
#battle-home-screen .bh-speak::before { content: ""; position: absolute; inset: 0 0 15.8%; }
#battle-home-screen .bh-speak::after { content: ""; width: 17px; height: 19px; background: url("../../graphic/ui/sc/pagebreak.png") center / contain no-repeat; }
#battle-home-screen .bh-speak:is(:hover, :focus-visible) { color: #fff9e1; text-decoration: underline; text-underline-offset: 3px; }
#battle-home-screen .bh-info {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  min-height: 0;
  padding: 0 19px 0 29px;
}
#battle-home-screen .bh-info-row { align-items: baseline; gap: 9px; }
#battle-home-screen .bh-info-k { flex: none; color: #e1c48a; font-size: 13px; white-space: nowrap; }
#battle-home-screen .bh-info-v { color: var(--ink); font-size: 15px; font-weight: 500; }
#battle-home-screen .bh-info-row--bond { align-items: center; min-width: 0; }
#battle-home-screen .bh-bond-col { flex: auto; gap: 2px; }
#battle-home-screen .bh-bond { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 7px; line-height: 1.25; }
#battle-home-screen .bh-bond-pt { margin: 0; color: #dfd6c6; font-size: 13px; font-variant-numeric: tabular-nums; }
#battle-home-screen .bh-bond-gauge { height: 3px; background: #746752; }
#battle-home-screen .bh-bond-fill { background: #e4c47d; }
#battle-home-screen .bh-info-row--together { flex: none; padding-left: 16px; border-left: 1px solid var(--rule); }
#battle-home-screen .bh-change {
  --icon: url("../../graphic/ui/sc/btn_yukiwa.png");
  --icon-hover: url("../../graphic/ui/sc/btn_yukiwa_hover.png");
  --icon-down: url("../../graphic/ui/sc/btn_yukiwa_press.png");
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 0 3px;
  border: 0;
  background: none;
  color: #f5e4c2;
  font-size: 14px;
  white-space: nowrap;
}
#battle-home-screen .bh-yukiwa {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--icon-state, var(--icon)) center / contain no-repeat;
  font: 600 17px/1 var(--serif);
}

/* 遊びの絵札。可変窓を外枠に、選択肢の素材を絵と説明の間に通す。 */
#battle-home-screen .bh-deck {
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
  gap: 7px;
  min-height: 0;
  padding: 9px 30px 19px;
  border-top: 3px double #c4a675;
  background: linear-gradient(108deg, #3527208c, #19191dc4 46%, #231c209c),
    url("../../graphic/ui/sc/bg.png") center 69% / cover;
}
#battle-home-screen .bh-deck-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
#battle-home-screen .bh-title {
  display: flex;
  align-items: center;
  width: 390px;
  height: 40px;
  margin: 0;
  padding: 0 0 0 29px;
  border: 0;
  background: url("../../graphic/ui/sc/plate.png") left center / 100% 100% no-repeat;
  color: #fff0c8;
  font: 600 22px/1.2 var(--serif);
  letter-spacing: .12em;
  text-align: left;
  text-shadow: 0 1px 2px #24160b;
}
#battle-home-screen .bh-route-grid { display: flex; gap: 10px; }
#battle-home-screen .bh-route { min-width: 142px; min-height: 42px; padding: 0 4px; font: 600 16px/1.3 var(--serif); }
#battle-home-screen .bh-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; min-height: 0; }
#battle-home-screen .bh-mode {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  padding: 0 11px 9px;
  border: 0;
  border-radius: 0;
  background: #221f21;
  color: #fff2d1;
  box-shadow: 0 3px 6px #09070666;
}
#battle-home-screen .bh-mode::before { content: none; }
#battle-home-screen .bh-mode::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 7px solid transparent;
  border-image: url("../../graphic/ui/sc/panel.png") 18 / 7px;
  pointer-events: none;
}
#battle-home-screen .bh-mode-art { position: absolute; inset: 5px 5px 34px; overflow: hidden; pointer-events: none; }
#battle-home-screen .bh-mode-scene { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 47%; }
#battle-home-screen .bh-table {
  background: radial-gradient(ellipse at 52% 30%, #33624ed1, #193e33de 72%, #102d27f2),
    url("../../graphic/materials/Fabric034_Color.jpg") center / 280px;
}
#battle-home-screen .bh-discards {
  position: absolute;
  top: -3px;
  left: 4%;
  display: flex;
  gap: 2px;
  transform: rotate(15deg) skew(-12deg) scaleY(.8);
}
#battle-home-screen .bh-discards img {
  width: 24px;
  height: 32px;
  padding: 2px;
  border-radius: 3px;
  background: #e5dcca;
  box-shadow: 0 3px 0 #b59a78, 1px 5px 3px #102c20;
}
#battle-home-screen .bh-hand {
  position: absolute;
  top: 10%;
  left: 53%;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  transform: translateX(-50%) rotate(-9deg) skew(-7deg);
}
#battle-home-screen .bh-hand img {
  display: block;
  width: 50px;
  height: 70px;
  object-fit: contain;
  padding: 3px;
  border-radius: 5px;
  background: #f7edda;
  box-shadow: 1px 2px 0 #c7bca5, 2px 5px 0 #b0a18d, 3px 9px 0 #8b693e, 4px 14px 8px #0a1e1d8c;
}
#battle-home-screen .bh-hand img:last-child { margin-left: 12px; transform: translateY(5px) rotate(10deg); }
#battle-home-screen .bh-pupil { position: absolute; width: auto; object-fit: contain; }
#battle-home-screen .bh-pupil-far { top: 8px; left: 22%; height: 142px; }
#battle-home-screen .bh-pupil-near { top: -4px; left: 48%; height: 177px; }
#battle-home-screen .bh-mode-title {
  position: relative;
  display: grid;
  place-items: center;
  width: auto;
  height: 43px;
  clip: auto;
  overflow: visible;
  border: solid transparent;
  border-width: 0 35px;
  border-image: url("../../graphic/ui/sc/btn_select.png") 0 40 fill / 0 35px;
  color: inherit;
  font: 700 24px/1.2 var(--serif);
  letter-spacing: .12em;
  text-shadow: 0 1px 3px #17100c;
}
#battle-home-screen .bh-mode:is(:hover, :focus-visible) .bh-mode-title { border-image-source: url("../../graphic/ui/sc/btn_select_hover.png"); color: #fffbe9; }
#battle-home-screen .bh-mode:active .bh-mode-title { border-image-source: url("../../graphic/ui/sc/btn_select_click.png"); }
#battle-home-screen .bh-mode-sub { position: relative; overflow: hidden; text-overflow: ellipsis; color: #eee2c9; font-size: 14px; line-height: 1.6; letter-spacing: .035em; }

#battle-home-screen .bh-picker-scrim { background: #07121db3; }
#battle-home-screen .bh-picker-card {
  width: 850px;
  max-height: 610px;
  padding: 15px 19px 17px;
  gap: 16px;
  border: 12px solid transparent;
  border-image: url("../../graphic/ui/sc/panel.png") 18 / 12px;
  background: linear-gradient(110deg, #252124e8, #1d1d21dc), url("../../graphic/ui/sc/bg.png") center / cover;
  background-clip: padding-box;
}
#battle-home-screen .bh-picker-title {
  padding: 0 46px 0 19px;
  color: #ffebc3;
  background: url("../../graphic/ui/sc/plate.png") left center / auto 100% no-repeat;
  text-align: left;
  font: 600 24px/1.55 var(--serif);
}
#battle-home-screen .bh-picker-x {
  --icon: url("../../graphic/ui/sc/btn_close.png");
  --icon-hover: url("../../graphic/ui/sc/btn_close_hover.png");
  --icon-down: url("../../graphic/ui/sc/btn_close_press.png");
  top: 10px;
  right: 14px;
  width: 44px;
  height: 46px;
  border: 0;
  border-radius: 0;
  background: var(--icon-state, var(--icon)) center / contain no-repeat;
  font-size: 0;
}
#battle-home-screen :is(.bh-amb-row, .bh-amb-tile)[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: url("../../graphic/ui/sc/check_on.png") center / contain no-repeat;
}
#battle-home-screen .bh-amb-row { position: relative; }

/* 右側の設定窓を開いたまま、左側で相棒と選んだ風景の組み合わせが見える。 */
#battle-home-screen .bh-amb-modal { justify-content: flex-end; padding: 28px 28px 28px 0; }
#battle-home-screen .bh-amb-modal .bh-picker-scrim { background: linear-gradient(90deg, #1612140d 42%, #16121499 78%); }
#battle-home-screen .bh-amb-modal .bh-picker-card { width: 530px; gap: 16px; }
#battle-home-screen .bh-amb-sec { gap: 6px; min-height: 0; }
#battle-home-screen .bh-amb-sec-h { color: #eed49c; font: 600 17px/1.5 var(--serif); }
#battle-home-screen .bh-amb-grid { padding: 5px 5px 10px; gap: 9px; }
#battle-home-screen .bh-amb-tile { flex-basis: 152px; background-clip: padding-box; }
#battle-home-screen .bh-amb-tile:is(:hover, :focus-visible):not(:disabled) { border-image-source: url("../../graphic/ui/sc/btn_hover.png"); }
#battle-home-screen .bh-amb-tile:active:not(:disabled) { border-image-source: url("../../graphic/ui/sc/btn_press.png"); }
#battle-home-screen .bh-amb-tile-label { background: #0c1926e8; font-size: 14px; }
#battle-home-screen .bh-amb-list { padding: 5px; max-height: 215px; }
#battle-home-screen .bh-amb-row { flex: none; min-height: 44px; padding: 0 8px; font-size: 15px; }
#battle-home-screen .bh-amb-row[aria-pressed="true"]::after { top: 50%; right: 5px; transform: translateY(-50%); }
#battle-home-screen .bh-amb-row[aria-pressed="true"] .bh-amb-row-cue { visibility: hidden; }
#battle-home-screen .bh-amb-row.is-selected .bh-amb-row-name { color: #fff7dc; text-shadow: 0 1px 2px #241e17; }
#battle-home-screen .bh-amb-row-cue { color: var(--accent); }
#battle-home-screen .is-locked { opacity: .55; }
#battle-home-screen :is(.bh-amb-grid, .bh-amb-list) { scrollbar-color: #9a8b70 #14232b; scrollbar-width: thin; }

/* ホームから開くログイン案内は、ゲーム共通の金縁パネルとボタンを使用する。 */
#app:has(#battle-home-screen:not(.hidden)) :is(.confirm-modal, .auth-modal) {
  max-width: 90%;
  color: #f5efdf;
  background-color: #142632;
  font: 400 16px/1.7 "Duel Sans", "Yu Gothic", sans-serif;
}
#app:has(#battle-home-screen:not(.hidden)) :is(.confirm-title, .auth-modal-title) { color: #f7dfad; font-family: "Duel Serif", "Yu Mincho", serif; }
#app:has(#battle-home-screen:not(.hidden)) :is(.confirm-btns, .auth-modal-btns) button { min-height: 46px; }
#app:has(#battle-home-screen:not(.hidden)) :is(.confirm-btns, .auth-modal-btns) button:focus-visible { outline: 2px solid #ffe3a0; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  #battle-home-screen *, #battle-home-screen *::before, #battle-home-screen *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
