/* LITTLE RPG — 全画面キャンバス構成。UIは最小限で、世界の邪魔をしない。 */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #12203a;
  color: #e8eaf2;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  touch-action: none;
}

/* ホームへ戻る導線。全画面キャンバス構成なので固定配置にする
   (CONTENT_PRINCIPLES.md §1 の scenery/broadcast と同じ扱い) */
#home-link {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  z-index: 20;
  padding: 6px 10px;
  border: 1px solid rgba(232, 234, 242, 0.35);
  border-radius: 6px;
  background: rgba(18, 22, 34, 0.72);
  color: #cfd6e6;
  font-size: 13px;
  text-decoration: none;
  backdrop-filter: blur(2px);
}
#home-link:hover { color: #fff; border-color: rgba(232, 234, 242, 0.7); }
#home-link:focus-visible { outline: 2px solid #e8825a; outline-offset: 2px; }

#fullscreen-btn {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(232, 234, 242, 0.35);
  background: rgba(18, 22, 34, 0.72);
  color: #cfd6e6;
  font-size: 15px;
  line-height: 30px;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}

#hud {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 20;
  min-width: 148px;
  padding: 10px 12px;
  border: 1px solid rgba(232, 234, 242, 0.28);
  border-radius: 8px;
  background: rgba(18, 22, 34, 0.72);
  font-size: 12px;
  line-height: 1.5;
  backdrop-filter: blur(2px);
}

.hud-title {
  font-weight: 700;
  letter-spacing: .06em;
  margin-bottom: 8px;
  color: #ffe9a8;
}
.hud-title .ver { opacity: .6; font-weight: 400; font-size: 11px; }

#minimap {
  display: block;
  width: 176px;
  height: 176px;
  margin: 0 0 8px;
  border: 1px solid rgba(232, 234, 242, 0.25);
  border-radius: 4px;
  image-rendering: pixelated;
  background: #12203a;
}

#hud dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1px 10px;
  margin: 0;
}
#hud dt { opacity: .62; }
#hud dd { margin: 0; font-variant-numeric: tabular-nums; }
#hud .unit { opacity: .55; font-size: 11px; }

#hud .help {
  margin: 9px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(232, 234, 242, 0.18);
  font-size: 11px;
  opacity: .7;
  line-height: 1.6;
}
#hud .help b { font-weight: 600; opacity: .95; }

/* 仮想スティック(スマホ。触れた場所に出る) */
#stick {
  position: fixed;
  z-index: 15;
  display: none;
  width: 0;
  height: 0;
  pointer-events: none;
}
#stick::before {
  content: "";
  position: absolute;
  left: -48px;
  top: -48px;
  width: 96px;
  height: 96px;
  border: 2px solid rgba(232, 234, 242, 0.35);
  border-radius: 50%;
  background: rgba(18, 22, 34, 0.28);
}
#stick-knob {
  position: absolute;
  left: -20px;
  top: -20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(232, 234, 242, 0.55);
}

#loading {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #12203a;
  color: #cfd6e6;
  font-size: 14px;
  letter-spacing: .08em;
}

@media (max-width: 560px) {
  #hud { min-width: 0; padding: 8px 10px; font-size: 11px; }
  #minimap { width: 112px; height: 112px; }
  #hud .help { display: none; }
}

/* ── v1: 画面(オーバーレイ)・ボタン・通知 ───────────────────── */

.hidden { display: none !important; }

#overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 14, 24, 0.78);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}

.panel {
  width: 100%;
  max-width: 380px;
  margin: auto;
  padding: 22px 22px 18px;
  border: 1px solid rgba(232, 234, 242, 0.28);
  border-radius: 10px;
  background: #161c2a;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.panel.wide { max-width: 520px; }

.panel h1 {
  margin: 0 0 4px;
  font-size: 1.7rem;
  letter-spacing: .14em;
  color: #ffe9a8;
}
.panel h2 { margin: 0 0 10px; font-size: 1.12rem; color: #ffe9a8; letter-spacing: .05em; }
.panel h3 { margin: 16px 0 6px; font-size: .95rem; letter-spacing: .04em; }
.panel .lead { margin: 0 0 16px; font-size: .88rem; opacity: .8; line-height: 1.7; }

.panel label {
  display: block;
  margin: 10px 0 4px;
  font-size: .8rem;
  opacity: .72;
}
.panel input[type="text"],
.panel input[type="password"] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(232, 234, 242, 0.28);
  border-radius: 6px;
  background: #0e131e;
  color: #e8eaf2;
  font-size: 16px;   /* 16px未満だとiOSが勝手にズームするため、これ以上下げない */
  font-family: inherit;
}
.panel input:focus-visible { outline: 2px solid #ffe9a8; outline-offset: 1px; }

.panel button {
  font-family: inherit;
  font-size: .88rem;
  cursor: pointer;
}
.panel button.primary,
.panel button.secondary {
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid rgba(232, 234, 242, 0.35);
}
.panel button.primary {
  display: block;
  width: 100%;
  margin-top: 14px;
  background: #ffe9a8;
  border-color: #ffe9a8;
  color: #20180a;
  font-weight: 700;
}
.panel button.secondary { background: transparent; color: #e8eaf2; }
.panel button.primary:disabled,
.panel button.secondary:disabled { opacity: .45; cursor: default; }
.panel button.link {
  padding: 4px 0;
  border: 0;
  background: none;
  color: #9fc0f0;
  font-size: .8rem;
  text-decoration: underline;
}
.panel .links { margin: 14px 0 0; text-align: center; line-height: 2; }

.tabs { display: flex; gap: 6px; margin-bottom: 6px; }
.tabs button {
  flex: 1;
  padding: 8px;
  border: 1px solid rgba(232, 234, 242, 0.24);
  border-radius: 6px;
  background: transparent;
  color: #cfd6e6;
}
.tabs button.active { background: rgba(255, 233, 168, 0.14); border-color: #ffe9a8; color: #ffe9a8; }

.panel .note { margin: 10px 0 0; font-size: .78rem; opacity: .7; line-height: 1.7; }
.panel .warn {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid #e8825a;
  background: rgba(232, 130, 90, 0.1);
  font-size: .8rem;
  line-height: 1.7;
}
.panel .error { margin: 10px 0 0; min-height: 1.2em; color: #ff9b8f; font-size: .8rem; line-height: 1.6; }
.panel .check { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: .84rem; opacity: 1; }

.code {
  margin: 6px 0 0;
  padding: 14px 10px;
  border: 1px dashed rgba(255, 233, 168, 0.6);
  border-radius: 6px;
  background: #0e131e;
  color: #ffe9a8;
  font-family: "Courier New", monospace;
  font-size: 1.05rem;
  letter-spacing: .08em;
  text-align: center;
  word-break: break-all;
  user-select: all;
}

#vessel-list, #warp-list { margin: 10px 0 0; padding: 0; list-style: none; }
#vessel-list li, #warp-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border: 1px solid rgba(232, 234, 242, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  font-size: .85rem;
}
#vessel-list li.active { border-color: #ffe9a8; background: rgba(255, 233, 168, 0.08); }
#vessel-list li.empty, #warp-list li.empty { justify-content: center; opacity: .6; font-size: .8rem; }
#vessel-list li button, #warp-list li button { margin-left: auto; }
.v-head { width: 100%; margin: 0; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.v-label { font-weight: 400; opacity: .75; font-size: .82rem; }
.v-tag {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 233, 168, 0.18);
  color: #ffe9a8;
  font-size: .68rem;
  font-weight: 400;
}
.v-info { width: 100%; margin: 2px 0 0; font-size: .78rem; opacity: .68; line-height: 1.6; }

#vessel-new .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#vessel-new .row button { flex: 1 1 auto; margin-top: 0; }
#bench-progress { margin-top: 12px; }
#bench-progress .bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(232, 234, 242, 0.15);
  overflow: hidden;
}
#bench-bar { height: 100%; width: 0; background: #ffe9a8; transition: width .25s ease-out; }

#account-info { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: .85rem; }
#account-info dt { opacity: .62; }
#account-info dd { margin: 0; font-variant-numeric: tabular-nums; }

/* 画面内のボタン(器・転移・アカウント) */
#buttons {
  position: fixed;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  gap: 8px;
}
#buttons button {
  min-width: 52px;
  padding: 9px 12px;
  border: 1px solid rgba(232, 234, 242, 0.35);
  border-radius: 7px;
  background: rgba(18, 22, 34, 0.78);
  color: #e8eaf2;
  font-family: inherit;
  font-size: .84rem;
  cursor: pointer;
  backdrop-filter: blur(2px);
}
#buttons button:hover { border-color: #ffe9a8; color: #ffe9a8; }

#hud-who {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(232, 234, 242, 0.18);
}
#hud-who p { margin: 0; line-height: 1.6; }
.who-name { font-weight: 700; }
.who-name .lv { font-weight: 400; opacity: .7; margin-left: 4px; }
.who-vessel { font-size: .78rem; color: #ffe9a8; opacity: .85; }

#toast {
  position: fixed;
  left: 50%;
  bottom: max(78px, calc(env(safe-area-inset-bottom) + 78px));
  z-index: 25;
  transform: translate(-50%, 8px);
  max-width: min(90vw, 420px);
  padding: 9px 16px;
  border: 1px solid rgba(232, 234, 242, 0.3);
  border-radius: 999px;
  background: rgba(18, 22, 34, 0.9);
  font-size: .82rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .panel { padding: 18px 16px 14px; }
  .panel h1 { font-size: 1.4rem; }
  #buttons button { min-width: 46px; padding: 8px 10px; }
}

/* ── v1-3: 体力バー・攻撃ボタン ─────────────────────────────── */

#hud-hp { margin: 2px 0 8px; }
#hud-hp .bar {
  height: 8px;
  border: 1px solid rgba(232, 234, 242, 0.28);
  border-radius: 4px;
  background: rgba(23, 21, 32, 0.7);
  overflow: hidden;
}
#hp-fill { height: 100%; width: 100%; background: #6fbf73; transition: width .15s linear; }
#hp-text {
  margin: 2px 0 0;
  font-size: .72rem;
  opacity: .72;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 2026-09-02: 攻撃は最頻出操作なので #buttons の列から独立させ、大きな
   丸ボタンにした(ユーザー指示)。位置は当初「持ち物」の実測位置を見て
   毎フレーム揃えるJSにしていたが、UI編集ツール(static/tools/ui-edit.js)
   でユーザーが直接ドラッグして決めた座標に差し替えた(2026-09-02)。
   ドラッグ時の実測ビューポート(DevTools Responsive)は
   縦505×789・横789×505。position:fixedのleft/topはビューポート基準の
   %なので、この2点から少し外れたサイズでも概ね近い位置に収まる。
   別サイズで確認して位置がずれる場合は、UI編集ツールで再調整して
   ここへ反映する運用にする。 */
#btn-attack {
  position: fixed;
  z-index: 20;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 700;
  border: 2px solid rgba(232, 130, 90, 0.8) !important;
  background: rgba(18, 22, 34, 0.82);
  color: #ffcdb8 !important;
  cursor: pointer;
  backdrop-filter: blur(2px);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#btn-attack:hover { border-color: #e8825a !important; color: #fff !important; }
#btn-attack:active { background: rgba(232, 130, 90, 0.35); }

@media (orientation: portrait) {
  /* 505×789で計測: left 275.945px(54.64%) / top 609.719px(77.28%) */
  #btn-attack { left: 54.64%; top: 77.28%; right: auto; bottom: auto; }
}
@media (orientation: landscape) {
  /* 789×505で計測: left 565.547px(71.68%) / top 259.984px(51.48%) */
  #btn-attack { left: 71.68%; top: 51.48%; right: auto; bottom: auto; }
}

/* v2-7: 村の施設・村人に近いときだけ出るボタン。#btn-attackの少し上に仮置き
   (位置の微調整が要る場合は static/tools/ui-edit.js で #btn-attack と同じ要領で) */
#btn-interact {
  position: fixed;
  z-index: 20;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: .9rem;
  font-weight: 700;
  border: 2px solid rgba(121, 189, 92, 0.8) !important;
  background: rgba(18, 22, 34, 0.82);
  color: #c9f0b8 !important;
  cursor: pointer;
  backdrop-filter: blur(2px);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#btn-interact:hover { border-color: #79bd5c !important; color: #fff !important; }
#btn-interact:active { background: rgba(121, 189, 92, 0.35); }

@media (orientation: portrait) {
  #btn-interact { left: 54.64%; top: 63%; right: auto; bottom: auto; }
}
@media (orientation: landscape) {
  #btn-interact { left: 71.68%; top: 30%; right: auto; bottom: auto; }
}

/* v2-7: PC(マウス操作)では指で押す丸ボタンは要らない。
   #hud .help のキー案内だけで足りるので隠す(2026-09-04ユーザー指示)。
   画面幅ではなく「マウス/トラックパッドを持つか」で判定する
   (hover:hover かつ pointer:fine。狭いウィンドウのPCも正しくPC扱いにするため)。
   攻撃はcanvasクリック/スペースキー、対話はEキーで元々できるので機能は失われない。 */
@media (hover: hover) and (pointer: fine) {
  #btn-attack, #btn-interact { display: none !important; }
}

/* v2-7: 村の出入りの暗転 */
#fade-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
#fade-overlay.show { opacity: 1; }

#panel-death h2 { color: #ff9b8f; }

/* ── v1.4: 魔力バーと技の札 ────────────────────────────────── */

#hud-hp .bar.mp { margin-top: 4px; }
#mp-fill { height: 100%; width: 100%; background: #6a8fd0; transition: width .15s linear; }
#mp-text {
  margin: 2px 0 0;
  font-size: .72rem;
  opacity: .6;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#skills {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 20;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
#skills .skill {
  position: relative;
  min-width: 74px;
  padding: 8px 10px 7px;
  border: 1px solid rgba(232, 234, 242, 0.35);
  border-radius: 7px;
  background: rgba(18, 22, 34, 0.78);
  color: #e8eaf2;
  font-family: inherit;
  font-size: .8rem;
  line-height: 1.3;
  cursor: pointer;
  backdrop-filter: blur(2px);
}
#skills .skill:hover { border-color: #ffe9a8; }
#skills .skill-key {
  display: block;
  font-size: .62rem;
  opacity: .55;
  letter-spacing: .1em;
}
#skills .skill-name { display: block; font-weight: 600; white-space: nowrap; }
#skills .skill-cool {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(10, 14, 24, 0.72);
  color: #cfd6e6;
  font-variant-numeric: tabular-nums;
}
#skills .skill:not(.cooling) .skill-cool { display: none; }
#skills .skill.nomp { opacity: .5; }
#skills .skill.nomp .skill-name { color: #9fc0f0; }

@media (max-width: 560px) {
  #skills { bottom: max(62px, calc(env(safe-area-inset-bottom) + 62px)); }
  #skills .skill { min-width: 62px; padding: 7px 8px 6px; font-size: .74rem; }
}

/* ── v1.5: 持ち物 ───────────────────────────────────────────── */

.panel h2 .sub { font-size: .8rem; font-weight: 400; opacity: .6; margin-left: 6px; }

#equipped-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.equip-slot {
  flex: 1 1 30%;
  min-width: 110px;
  padding: 8px 10px;
  border: 1px solid rgba(232, 234, 242, 0.2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  font-size: .82rem;
}
.equip-slot.filled { border-color: rgba(255, 233, 168, 0.45); }
.slot-label { display: block; font-size: .68rem; opacity: .55; }
.slot-item { display: block; font-weight: 600; }
.equip-slot .link { padding: 2px 0; font-size: .74rem; }

#item-list { margin: 10px 0 0; padding: 0; list-style: none; max-height: 46vh; overflow-y: auto; }
#item-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 9px 12px;
  margin-bottom: 6px;
  border: 1px solid rgba(232, 234, 242, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  font-size: .85rem;
}
#item-list li.empty { justify-content: center; opacity: .6; font-size: .8rem; }
.item-head { width: 100%; margin: 0; font-weight: 700; display: flex; align-items: center; gap: 8px; }
#item-list li .secondary { margin-left: auto; padding: 5px 10px; font-size: .78rem; }
#item-list li .link { font-size: .76rem; }

/* ── v2-7: 村(道具屋・かじや) ──────────────────────────────── */
#shop-list, #smith-list { margin: 10px 0 0; padding: 0; list-style: none; max-height: 46vh; overflow-y: auto; }
#shop-list li, #smith-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 9px 12px;
  margin-bottom: 6px;
  border: 1px solid rgba(232, 234, 242, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  font-size: .85rem;
}
#shop-list li.empty, #smith-list li.empty { justify-content: center; opacity: .6; font-size: .8rem; }
#shop-list li .secondary, #smith-list li .secondary { margin-left: auto; padding: 5px 10px; font-size: .78rem; }
.shop-heading {
  border: none !important;
  background: none !important;
  padding: 12px 2px 4px !important;
  margin-bottom: 2px !important;
  font-weight: 700;
  opacity: .7;
  font-size: .78rem;
}
.shop-heading:first-child { padding-top: 2px !important; }

/* ── v2-3: チャット ─────────────────────────────────────────── */

#chat-log {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  bottom: max(58px, calc(env(safe-area-inset-bottom) + 58px));
  z-index: 20;
  max-width: min(46vw, 460px);
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(18, 22, 34, 0.62);
  backdrop-filter: blur(2px);
  font-size: .8rem;
  line-height: 1.6;
  pointer-events: auto;
}
.chat-line { margin: 0; word-break: break-word; }
.chat-line.emote { opacity: .8; font-style: italic; }
.chat-who { color: #ffe9a8; margin-right: 6px; }
.chat-who::after { content: ":"; opacity: .6; }
.chat-report {
  margin-left: 6px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: #9fc0f0;
  font-family: inherit;
  font-size: .68rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
.chat-line:hover .chat-report { opacity: .8; }
.chat-report:hover { opacity: 1; text-decoration: underline; }

#chat-form {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 26;
  transform: translateX(-50%);
  width: min(92vw, 520px);
}
#chat-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 233, 168, 0.6);
  border-radius: 8px;
  background: rgba(14, 19, 30, 0.95);
  color: #e8eaf2;
  font-family: inherit;
  font-size: 16px;   /* iOSの自動ズーム回避。これ以上下げない */
}
#chat-input:focus-visible { outline: 2px solid #ffe9a8; outline-offset: 1px; }

#emotes {
  position: fixed;
  left: 50%;
  bottom: max(62px, calc(env(safe-area-inset-bottom) + 62px));
  z-index: 26;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: min(92vw, 520px);
}
#emotes button {
  padding: 6px 10px;
  border: 1px solid rgba(232, 234, 242, 0.3);
  border-radius: 999px;
  background: rgba(18, 22, 34, 0.9);
  color: #e8eaf2;
  font-family: inherit;
  font-size: .8rem;
  cursor: pointer;
}
#emotes button:hover { border-color: #ffe9a8; color: #ffe9a8; }

@media (max-width: 560px) {
  #chat-log { max-width: 68vw; bottom: max(110px, calc(env(safe-area-inset-bottom) + 110px)); font-size: .74rem; }
  .chat-report { opacity: .7; }
}

/* ── v2-4: パーティ ─────────────────────────────────────────── */

#hud-party {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(232, 234, 242, 0.18);
  font-size: .78rem;
}
.party-title { margin: 0 0 3px; font-weight: 700; color: #9fd0e8; }
.party-rate { float: right; font-weight: 400; opacity: .6; font-size: .7rem; }
.party-member { display: flex; justify-content: space-between; margin: 0; gap: 8px; }
.party-hp { opacity: .65; font-variant-numeric: tabular-nums; }
#hud-party .link { padding: 2px 0; font-size: .72rem; }

#chat-form { display: flex; gap: 6px; }
#chat-channel {
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid rgba(232, 234, 242, 0.35);
  border-radius: 8px;
  background: rgba(14, 19, 30, 0.95);
  color: #cfd6e6;
  font-family: inherit;
  font-size: .82rem;
  white-space: nowrap;
  cursor: pointer;
}
#chat-channel.party { border-color: #9fd0e8; color: #9fd0e8; }
#chat-channel:disabled { opacity: .45; cursor: default; }
.chat-line.party .chat-who { color: #9fd0e8; }

#invite {
  position: fixed;
  left: 50%;
  top: max(70px, calc(env(safe-area-inset-top) + 70px));
  z-index: 26;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #9fd0e8;
  border-radius: 8px;
  background: rgba(18, 22, 34, 0.94);
  font-size: .85rem;
  backdrop-filter: blur(2px);
}
#invite .secondary {
  padding: 6px 12px;
  border: 1px solid rgba(232, 234, 242, 0.35);
  border-radius: 6px;
  background: transparent;
  color: #e8eaf2;
  font-family: inherit;
  font-size: .8rem;
  cursor: pointer;
}
#invite .link {
  border: 0;
  background: none;
  color: #9fc0f0;
  font-family: inherit;
  font-size: .78rem;
  cursor: pointer;
  text-decoration: underline;
}

/* ── v2-5: PvPゾーンの明示 ─────────────────────────────────── */

/* ★画面の縁を赤く縁取る。地面の色だけだと、走っているうちに気づかない */
body.in-pvp::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  box-shadow: inset 0 0 0 3px rgba(220, 70, 60, 0.85),
              inset 0 0 42px rgba(220, 70, 60, 0.32);
  animation: pvp-pulse 2.6s ease-in-out infinite;
}
@keyframes pvp-pulse {
  0%, 100% { opacity: .78; }
  50% { opacity: 1; }
}

#pvp-badge {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  z-index: 22;
  transform: translateX(-50%);
  padding: 5px 14px;
  border: 1px solid rgba(220, 70, 60, 0.9);
  border-radius: 999px;
  background: rgba(46, 14, 14, 0.86);
  color: #ffb3ab;
  font-size: .78rem;
  letter-spacing: .12em;
  backdrop-filter: blur(2px);
}

@media (prefers-reduced-motion: reduce) {
  body.in-pvp::after { animation: none; }
}

/* ── v2-6: ボス ─────────────────────────────────────────────── */

#boss-bar {
  position: fixed;
  left: 50%;
  top: max(46px, calc(env(safe-area-inset-top) + 46px));
  z-index: 22;
  transform: translateX(-50%);
  width: min(78vw, 520px);
  padding: 8px 12px 10px;
  border: 1px solid rgba(232, 130, 90, 0.7);
  border-radius: 8px;
  background: rgba(30, 16, 14, 0.82);
  backdrop-filter: blur(2px);
}
#boss-name {
  margin: 0 0 6px;
  text-align: center;
  font-size: .9rem;
  letter-spacing: .1em;
  color: #ffcdb8;
}
#boss-bar .bar {
  height: 10px;
  border: 1px solid rgba(232, 234, 242, 0.28);
  border-radius: 5px;
  background: rgba(23, 21, 32, 0.8);
  overflow: hidden;
}
#boss-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #e8825a, #ffb38f);
  transition: width .2s linear;
}

/* 横画面(縦の高さが乏しい端末)。#hud・#skills・#buttons が縦幅ベースの
   上のブレークポイントでは縮まず、横向きだと#skillsと#buttonsが横に
   衝突する不具合が実機で確認されたため、高さ基準で別途縮小・縦積みする。
   ファイル末尾に置くのは、各要素の基本定義(#hud・#skills・#buttons)より
   後のソース順にしないと詳細度が同じルールに上書きされてしまうため。 */
@media (orientation: landscape) and (max-height: 500px) {
  #hud { min-width: 0; padding: 6px 8px; font-size: 10px; }
  #minimap { width: 84px; height: 84px; margin-bottom: 4px; }
  #hud .help { display: none; }
  #skills { bottom: max(54px, calc(env(safe-area-inset-bottom) + 54px)); }
  #skills .skill { min-width: 52px; padding: 6px 7px 5px; font-size: .68rem; }
  #buttons button { min-width: 40px; padding: 6px 8px; font-size: .74rem; }
}
