    :root {
      --bg: #0d0a14;
      --panel: #1c1530;
      --panel2: #241b3e;
      --line: #4a3a78;
      --gold: #f5c84c;
      --hp: #5ee06a;
      --hpmid: #f0c33c;
      --hplow: #f05050;
      --belly: #f09a3c;
      --text: #e8e2f5;
      --dim: #9a8fc0;
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
    }

    html,
    body {
      height: 100%;
      overflow: hidden;
    }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: 'DotGothic16', monospace;
      user-select: none;
      touch-action: none;
    }

    #app {
      display: flex;
      flex-direction: row;
      height: 100%;
      width: 100%;
      background: var(--bg);
    }

    /* ── 中央列(HUD+画面+ログ) ── */
    #center {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      min-height: 0;
    }

    /* ── HUD ── */
    #hud {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 5px 10px;
      background: var(--panel);
      border-bottom: 2px solid var(--line);
      font-size: 13px;
      flex-wrap: nowrap;
      flex-shrink: 0;
    }

    #hud .fl {
      color: var(--gold);
      font-size: 15px;
    }

    #hud .lv {
      color: var(--dim);
    }

    .barwrap {
      flex: 1;
      min-width: 60px;
      max-width: 180px;
    }

    .barlabel {
      font-size: 10px;
      color: var(--dim);
      display: flex;
      justify-content: space-between;
    }

    .bar {
      height: 8px;
      background: #000;
      border: 1px solid var(--line);
      border-radius: 2px;
      overflow: hidden;
    }

    .bar>i {
      display: block;
      height: 100%;
      background: var(--hp);
      transition: width .15s, background .15s;
    }

    #bellybar>i {
      background: var(--belly);
    }

    #gold {
      color: var(--gold);
      font-size: 12px;
      white-space: nowrap;
    }

    #btn-mute {
      background: none;
      border: 1px solid var(--line);
      border-radius: 6px;
      font-size: 14px;
      padding: 2px 7px;
      color: var(--text);
      font-family: inherit;
      flex-shrink: 0;
    }

    /* ── Canvas ── */
    #stage {
      flex: 1;
      position: relative;
      background: #000;
      min-height: 0;
    }

    #cv {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
    }

    #stage::after {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      z-index: 2;
      background: radial-gradient(ellipse at 50% 42%, transparent 52%, rgba(5, 3, 12, .55) 100%);
    }

    #mini {
      z-index: 3;
      position: absolute;
      top: 8px;
      right: 8px;
      width: 120px;
      background: rgba(0, 0, 0, .45);
      border: 1px solid var(--line);
      border-radius: 3px;
      pointer-events: none;
      image-rendering: pixelated;
    }

    #mhflash {
      position: absolute;
      inset: 0;
      background: radial-gradient(ellipse at center, rgba(255, 40, 40, .1), rgba(255, 0, 0, .6));
      pointer-events: none;
      opacity: 0;
      z-index: 4;
    }

    #mhbanner {
      position: absolute;
      top: 38%;
      left: 50%;
      transform: translate(-50%, -50%) scale(0.7);
      background: rgba(40, 0, 0, .85);
      border: 2px solid #ff4040;
      color: #ff5050;
      font-size: 20px;
      font-weight: bold;
      padding: 10px 22px;
      border-radius: 8px;
      z-index: 6;
      opacity: 0;
      transition: opacity .2s, transform .3s;
      pointer-events: none;
      text-shadow: 0 0 8px #ff0000;
      white-space: nowrap;
    }

    #mhbanner.show {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1);
    }

    #dirhint {
      position: absolute;
      top: 8px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(20, 12, 40, .92);
      border: 1px solid var(--gold);
      color: var(--gold);
      padding: 4px 14px;
      border-radius: 4px;
      font-size: 13px;
      display: none;
      z-index: 5;
    }

    /* ── Log ── */
    #log {
      height: 72px;
      padding: 4px 10px;
      background: var(--panel);
      border-top: 2px solid var(--line);
      font-size: 12px;
      line-height: 1.5;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      flex-shrink: 0;
      cursor: pointer;
    }

    #log div {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    #log div:nth-last-child(4) {
      opacity: .30;
    }

    #log div:nth-last-child(3) {
      opacity: .5;
    }

    #log div:nth-last-child(2) {
      opacity: .75;
    }

    /* ── Joy-Con(左右コントローラー) ── */
    #leftcon,
    #rightcon {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 12px;
      background: linear-gradient(160deg, var(--panel2), var(--panel));
      padding: 10px 14px;
      flex-shrink: 0;
      position: relative;
    }

    #leftcon {
      border-right: 3px solid var(--line);
      border-top-right-radius: 26px;
      border-bottom-right-radius: 26px;
    }

    #rightcon {
      border-left: 3px solid var(--line);
      border-top-left-radius: 26px;
      border-bottom-left-radius: 26px;
    }

    .con-label {
      font-size: 10px;
      color: var(--dim);
      letter-spacing: 1px;
    }

    .con-hint {
      font-size: 9px;
      color: var(--dim);
      opacity: .8;
    }

    /* 方向パッド(大きめで押しやすく) */
    #dpad {
      display: grid;
      grid-template-columns: repeat(3, 58px);
      grid-template-rows: repeat(3, 58px);
      gap: 5px;
    }

    .dbtn {
      background: #16121f;
      border: 2px solid var(--line);
      border-radius: 12px;
      color: var(--text);
      font-size: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: inherit;
    }

    .dbtn:active {
      background: var(--line);
      color: #fff;
      transform: scale(0.94);
    }

    #dcenter {
      background: transparent;
    }

    /* ABXY配置(ダイヤモンド) */
    #abxy {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      grid-template-rows: repeat(3, 1fr);
      width: 158px;
      height: 158px;
      gap: 2px;
    }

    .actbtn {
      width: 50px;
      height: 50px;
      border-radius: 50%;
      border: 2px solid var(--line);
      background: #16121f;
      color: var(--text);
      font-family: inherit;
      font-size: 19px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0;
      position: relative;
    }

    .actbtn small {
      font-size: 8px;
      color: var(--dim);
      line-height: 1;
    }

    .actbtn .lab {
      position: absolute;
      top: 2px;
      right: 5px;
      font-size: 8px;
      font-weight: bold;
      color: var(--dim);
    }

    .actbtn:active {
      transform: scale(0.92);
    }

    .actbtn.x {
      grid-column: 2;
      grid-row: 1;
      border-color: #5a9ad0;
    }

    /* 上 */
    .actbtn.y {
      grid-column: 1;
      grid-row: 2;
      border-color: #d0b84a;
    }

    /* 左 */
    .actbtn.a {
      grid-column: 3;
      grid-row: 2;
      border-color: #c0584a;
      color: #ff8a6a;
    }

    /* 右=攻撃 */
    .actbtn.b {
      grid-column: 2;
      grid-row: 3;
      border-color: #5ab06a;
    }

    /* 下=振向 */
    .actbtn.a:active {
      background: #5a2820;
    }

    .actbtn.b.on {
      border-color: var(--gold);
      background: #4a3a1a;
      color: var(--gold);
    }

    .actbtn.b.on small {
      color: var(--gold);
    }

    /* ミニ補助ボタン */
    #leftmin,
    #rightmin {
      display: flex;
      gap: 8px;
    }

    .minibtn {
      width: 48px;
      height: 40px;
      border-radius: 9px;
      border: 1.5px solid var(--line);
      background: #16121f;
      color: var(--text);
      font-family: inherit;
      font-size: 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0;
    }

    .minibtn small {
      font-size: 8px;
      color: var(--dim);
    }

    .minibtn:active {
      background: var(--line);
    }

    /* 縦画面のときの回転促し */
    #rotatehint {
      display: none;
    }

    #pchint {
      display: none;
      position: absolute;
      bottom: 8px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(20, 12, 40, .82);
      border: 1px solid var(--line);
      border-radius: 6px;
      color: var(--dim);
      font-size: 11px;
      padding: 4px 12px;
      z-index: 5;
      white-space: nowrap;
      pointer-events: none;
    }

    /* PC(マウス/トラックパッド環境=タッチ非対応)ではバーチャルパッドを隠す。
   キーボード・物理ゲームパッドで操作する。 */
    @media (hover:hover) and (pointer:fine) {

      #leftcon,
      #rightcon {
        display: none;
      }

      #pchint {
        display: block;
      }
    }

    /* スマホ縦画面: 上にゲーム画面、下に左右コントローラーを配置 */
    @media (orientation:portrait) and (max-width:900px) and (hover:none) {
      #app {
        flex-direction: column;
      }

      #center {
        order: 1;
        flex: 1;
        min-height: 0;
      }

      /* 左右コントローラーを下段に横並びで置く */
      #leftcon,
      #rightcon {
        order: 2;
        flex-direction: column;
        flex: 0 0 auto;
        border-radius: 0;
        border: none;
        padding: 10px 8px;
      }

      #leftcon {
        position: fixed;
        left: 0;
        bottom: 0;
        background: linear-gradient(20deg, var(--panel2), var(--panel));
        border-top: 2px solid var(--line);
        border-right: 2px solid var(--line);
        border-top-right-radius: 18px;
        z-index: 25;
      }

      #rightcon {
        position: fixed;
        right: 0;
        bottom: 0;
        background: linear-gradient(-20deg, var(--panel2), var(--panel));
        border-top: 2px solid var(--line);
        border-left: 2px solid var(--line);
        border-top-left-radius: 18px;
        z-index: 25;
      }

      /* コマンドメニュー以外のモーダルを開いている間はコントローラーを隠す(プレイ中のメニュー操作だけパッド併用) */
      body.modal-hide-pad #leftcon,
      body.modal-hide-pad #rightcon {
        display: none;
      }

      /* 下段コントローラーぶんの余白を中央に確保(コントローラーは画面下隅、中央のlog直下に来る) */
      #center {
        margin-bottom: 0;
      }

      #leftcon,
      #rightcon {
        padding: 8px 6px;
      }

      /* ゲーム画面とログがコントローラーに被らないよう、中央列の高さを画面の上6割に制限 */
      #center {
        max-height: 62vh;
      }

      .con-label {
        display: none;
      }

      #leftmin,
      #rightmin {
        margin-top: 6px;
      }

      /* 縦画面のコントローラーを大きめに(操作しやすく) */
      #dpad {
        grid-template-columns: repeat(3, 64px);
        grid-template-rows: repeat(3, 64px);
        gap: 6px;
      }

      .dbtn {
        font-size: 30px;
        border-radius: 14px;
      }

      #abxy {
        width: 188px;
        height: 188px;
      }

      .actbtn {
        width: 60px;
        height: 60px;
        font-size: 22px;
      }

      .actbtn small {
        font-size: 9px;
      }

      .actbtn .lab {
        font-size: 9px;
      }

      #leftcon,
      #rightcon {
        padding: 12px 12px;
      }

      .minibtn {
        font-size: 18px;
        padding: 7px 4px;
      }
    }

    .abtn {
      min-width: 0;
      padding: 11px 4px;
      background: var(--panel2);
      border: 2px solid var(--line);
      border-radius: 8px;
      color: var(--text);
      font-family: inherit;
      font-size: 14px;
    }

    .abtn:active {
      background: var(--line);
    }

    .abtn.sel {
      border-color: var(--gold);
      background: #3a2f1a;
      color: var(--gold);
      box-shadow: 0 0 8px rgba(245, 200, 76, .4);
    }

    /* ── Modals ── */
    .modal {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, .7);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 20;
      padding: 16px;
    }

    .modal.show {
      display: flex;
    }

    /* パッド併用モーダル(cmdmenu/spawn/world): 上部に寄せ、背景タップを素通し(パッド操作可) */
    .modal.padmodal {
      align-items: flex-start;
      justify-content: center;
      background: transparent;
      pointer-events: none;
      padding-top: 8px;
    }

    .modal.padmodal .box {
      pointer-events: auto;
      max-height: 62vh;
    }

    .box {
      background: var(--panel);
      border: 2px solid var(--gold);
      border-radius: 8px;
      width: 100%;
      max-width: 420px;
      max-height: 82vh;
      overflow-y: auto;
      padding: 14px;
      box-shadow: 0 0 30px rgba(245, 200, 76, .18);
    }

    .box h2 {
      font-size: 16px;
      color: var(--gold);
      margin-bottom: 10px;
      border-bottom: 1px solid var(--line);
      padding-bottom: 6px;
    }

    .box p {
      font-size: 13px;
      line-height: 1.7;
      margin-bottom: 8px;
    }

    .invitem {
      display: flex;
      align-items: center;
      gap: 8px;
      width: 100%;
      padding: 6px 8px;
      background: var(--panel2);
      border: 1px solid var(--line);
      border-radius: 6px;
      color: var(--text);
      font-family: inherit;
      font-size: 13px;
      margin-bottom: 3px;
      text-align: left;
    }

    .invitem:active {
      background: var(--line);
    }

    .invitem.sel {
      border-color: var(--gold);
      background: #3a2f1a;
      box-shadow: 0 0 8px rgba(245, 200, 76, .4);
    }

    .invitem .eq {
      color: var(--hp);
      font-size: 11px;
      margin-left: auto;
    }

    .invitem.it-unid {
      color: #d6b450;
    }

    /* 未識別(メモ無): アンバー */
    .invitem.it-named {
      color: #74cfe3;
    }

    /* 未識別(メモ有): シアン */
    .invitem.it-named .qm {
      color: #74cfe3;
    }

    .qm {
      font-size: 10px;
      font-weight: bold;
      vertical-align: super;
      color: #d6b450;
      margin-left: 1px;
    }

    .invlegend {
      display: flex;
      gap: 12px;
      justify-content: center;
      font-size: 11px;
      margin: 2px 0 6px;
    }

    .invlegend span {
      white-space: nowrap;
    }

    .cmdtag {
      font-size: 11px;
      font-weight: bold;
      margin-left: auto;
      white-space: nowrap;
    }

    .candrow,
    .candhead {
      display: flex;
      align-items: center;
      gap: 6px;
      width: 100%;
      padding: 6px 8px;
    }

    .candrow {
      background: var(--panel2);
      border: 1px solid var(--line);
      border-radius: 6px;
      color: var(--text);
      font-family: inherit;
      font-size: 13px;
      margin-bottom: 3px;
      text-align: left;
    }

    .candrow:active {
      background: var(--line);
    }

    .candrow.sel {
      border-color: var(--gold);
      background: #3a2f1a;
      box-shadow: 0 0 8px rgba(245, 200, 76, .4);
    }

    .candhead {
      font-size: 10px;
      color: var(--dim);
      margin-bottom: 2px;
      padding-bottom: 0;
    }

    .candrow .cn,
    .candhead .cn {
      flex: 1;
      min-width: 0;
    }

    .candrow .cc,
    .candhead .cc {
      width: 80px;
      flex: none;
      text-align: center;
    }

    .ck {
      color: #39414e;
    }

    /* 暗転(オフ) */
    .ck.on {
      color: #7bd88f;
    }

    /* 明転(オン) */
    .invpager {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 14px;
      margin: 4px 0 8px;
      font-size: 13px;
      color: var(--dim);
    }

    .invpager .ipg {
      background: var(--panel2);
      border: 1px solid var(--line);
      border-radius: 6px;
      color: var(--gold);
      font-size: 16px;
      padding: 4px 14px;
      font-family: inherit;
      cursor: pointer;
    }

    .invpager .ipg:active {
      background: var(--line);
    }

    #inv-list {
      max-height: 62vh;
      overflow-y: auto;
    }

    #m-inv .box {
      max-height: 90vh;
    }

    .btnrow {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 10px;
    }

    .btnrow .abtn {
      flex: 1;
      min-width: 80px;
    }

    /* ダンジョンエディタ */
    #editor {
      position: fixed;
      inset: 0;
      background: var(--bg);
      z-index: 30;
      display: none;
      flex-direction: column;
      padding: 10px;
      gap: 8px;
      overflow-y: auto;
    }

    .ed-top {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      align-items: center;
    }

    .ed-title {
      color: var(--gold);
      font-size: 15px;
      margin-right: auto;
    }

    .edbtn {
      padding: 8px 10px;
      background: var(--panel2);
      border: 1px solid var(--line);
      border-radius: 7px;
      color: var(--text);
      font-family: inherit;
      font-size: 12px;
    }

    .edbtn:active {
      background: var(--line);
    }

    .edbtn.gold {
      border-color: var(--gold);
      color: var(--gold);
    }

    #edcv {
      width: 100%;
      image-rendering: pixelated;
      border: 1px solid var(--line);
      border-radius: 4px;
      touch-action: none;
      background: #000;
    }

    .ed-palette {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
    }

    .palbtn {
      padding: 7px 9px;
      background: var(--panel2);
      border: 1px solid var(--line);
      border-radius: 7px;
      color: var(--dim);
      font-family: inherit;
      font-size: 12px;
    }

    .palbtn.on {
      color: var(--gold);
      border-color: var(--gold);
    }

    .ed-sub select {
      background: var(--panel2);
      color: var(--text);
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 7px;
      font-family: inherit;
      font-size: 13px;
      width: 100%;
    }

    .ed-msg {
      font-size: 12px;
      color: var(--dim);
      min-height: 18px;
    }

    #tab-log {
      max-height: 62vh;
      overflow-y: auto;
    }

    .logflr {
      position: sticky;
      top: 0;
      background: var(--panel);
      color: var(--gold);
      font-size: 12px;
      font-weight: bold;
      padding: 5px 2px 3px;
      border-bottom: 1px solid var(--line);
      z-index: 1;
    }

    .logline {
      font-size: 12px;
      line-height: 1.6;
      padding: 1px 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .logt {
      color: var(--dim);
      font-size: 11px;
    }

    /* ダンジョンメーカー */
    #maker {
      position: fixed;
      inset: 0;
      background: var(--bg);
      z-index: 30;
      display: none;
      flex-direction: column;
      padding: 10px;
      gap: 10px;
      overflow-y: auto;
    }

    .mk-sec {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px;
    }

    .mk-sec h3 {
      font-size: 13px;
      color: var(--gold);
      margin-bottom: 8px;
    }

    .mk-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    .mk-field {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .mk-field label {
      font-size: 11px;
      color: var(--dim);
    }

    .mk-field input {
      background: var(--panel2);
      color: var(--text);
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 7px;
      font-family: inherit;
      font-size: 14px;
      width: 100%;
    }

    .mk-row {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 5px 0;
      border-bottom: 1px solid var(--line);
      font-size: 12px;
    }

    .mk-row .nm {
      flex: 1;
      min-width: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .mk-row input {
      width: 46px;
      background: var(--panel2);
      color: var(--text);
      border: 1px solid var(--line);
      border-radius: 5px;
      padding: 5px 3px;
      font-family: inherit;
      font-size: 13px;
      text-align: center;
    }

    .mk-row .sep {
      color: var(--dim);
      font-size: 11px;
    }

    .mk-head {
      display: flex;
      gap: 6px;
      font-size: 10px;
      color: var(--dim);
      justify-content: flex-end;
      padding-right: 2px;
    }

    .mk-head span {
      width: 46px;
      text-align: center;
    }

    #m-mpick {
      z-index: 40;
    }

    .mk-frow {
      display: flex;
      gap: 8px;
      align-items: flex-start;
      padding: 6px 0;
      border-bottom: 1px solid var(--line);
    }

    .mk-frow .fl {
      width: 34px;
      color: var(--gold);
      font-size: 13px;
      padding-top: 8px;
      flex-shrink: 0;
    }

    .fchips {
      flex: 1;
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
    }

    .mchip {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0;
      padding: 4px 7px 6px;
      min-width: 44px;
      background: var(--panel2);
      border: 1px solid var(--line);
      border-radius: 8px;
      color: var(--text);
      font-family: inherit;
      overflow: hidden;
    }

    .mchip:active {
      background: var(--line);
    }

    .mchip .me {
      font-size: 17px;
      line-height: 1.1;
    }

    .mchip .mp {
      font-size: 9px;
      color: var(--dim);
    }

    .mchip i {
      position: absolute;
      bottom: 0;
      left: 0;
      height: 3px;
      background: var(--gold);
      border-radius: 2px;
    }

    .mchip.add {
      border-style: dashed;
      color: var(--dim);
      justify-content: center;
      font-size: 16px;
      min-height: 46px;
    }

    /* 記録モーダル */
    .tabbar {
      display: flex;
      gap: 6px;
      margin-bottom: 10px;
    }

    .tabbtn {
      flex: 1;
      padding: 9px;
      background: var(--panel2);
      border: 1px solid var(--line);
      border-radius: 6px;
      color: var(--dim);
      font-family: inherit;
      font-size: 14px;
    }

    .tabbtn.on {
      color: var(--gold);
      border-color: var(--gold);
    }

    .tabbtn.tabfocus {
      box-shadow: 0 0 0 2px var(--gold), 0 0 8px rgba(245, 200, 76, .5);
    }

    .bestrow {
      display: flex;
      gap: 10px;
      align-items: center;
      padding: 8px 4px;
      border-bottom: 1px solid var(--line);
    }

    .bestrow .bch {
      font-size: 26px;
      width: 36px;
      text-align: center;
      flex-shrink: 0;
    }

    .bestrow .bnm {
      font-size: 14px;
      margin-bottom: 2px;
    }

    .bestrow .bst {
      font-size: 11px;
      color: var(--dim);
      line-height: 1.6;
    }

    .bestrow.unknown {
      opacity: .55;
    }

    .badge {
      display: inline-block;
      font-size: 10px;
      border: 1px solid var(--line);
      border-radius: 4px;
      padding: 0 5px;
      margin-left: 4px;
      color: #9be8ff;
      vertical-align: 1px;
    }

    .flrow {
      padding: 8px 4px;
      border-bottom: 1px solid var(--line);
      font-size: 13px;
    }

    .chip {
      display: inline-block;
      font-size: 11px;
      background: var(--panel2);
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 1px 8px;
      margin: 3px 3px 0 0;
    }

    .chip.uk {
      color: var(--dim);
    }

    #btn-record {
      grid-column: 1/3;
    }

    .gameover h2 {
      color: var(--hplow);
      font-size: 20px;
      text-align: center;
      border: none;
    }

    .clear h2 {
      color: var(--gold);
      font-size: 20px;
      text-align: center;
      border: none;
    }

    .stat {
      font-size: 13px;
      color: var(--dim);
      text-align: center;
      margin: 4px 0;
    }

    #m-title {
      background: radial-gradient(ellipse at 50% 32%, #2c2350 0%, #0d0a14 72%);
    }

    #title-box {
      text-align: center;
      background: transparent;
      border: none;
      box-shadow: none;
    }

    #title-box .bird {
      animation: tfloat 2.6s ease-in-out infinite;
    }

    @keyframes tfloat {

      0%,
      100% {
        transform: translateY(0)
      }

      50% {
        transform: translateY(-8px)
      }
    }

    .menu-btn {
      display: block;
      width: 100%;
      padding: 13px;
      margin: 9px 0;
      background: rgba(36, 27, 62, .9);
      border: 2px solid var(--line);
      border-radius: 10px;
      color: var(--text);
      font-family: inherit;
      font-size: 16px;
    }

    .pluginrow {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      padding: 10px 12px;
      margin: 6px 0;
      background: var(--panel2);
      border: 2px solid var(--line);
      border-radius: 9px;
      color: var(--text);
      font-family: inherit;
      text-align: left;
    }

    .pluginrow.on {
      border-color: var(--gold);
      background: #3a2f1a;
    }

    .pluginrow .pic {
      font-size: 22px;
      flex-shrink: 0;
    }

    .pluginrow .pinfo {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
    }

    .pluginrow .pinfo b {
      font-size: 14px;
    }

    .pluginrow .pinfo small {
      font-size: 10px;
      color: var(--dim);
      line-height: 1.3;
    }

    .pluginrow .ptog {
      flex-shrink: 0;
      font-weight: bold;
      font-size: 13px;
      color: var(--dim);
      width: 34px;
      text-align: center;
    }

    .pluginrow.on .ptog {
      color: var(--gold);
    }

    .relicbar {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      padding: 8px;
      background: rgba(58, 47, 26, .5);
      border: 1px solid var(--gold);
      border-radius: 8px;
      margin-bottom: 8px;
    }

    .relicbar .relic {
      font-size: 22px;
    }

    .potionbar {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-bottom: 8px;
    }

    .potionbar .potion {
      display: flex;
      flex-direction: column;
      align-items: center;
      background: var(--panel2);
      border: 2px solid #5ab0d0;
      border-radius: 8px;
      padding: 6px 8px;
      color: var(--text);
      font-family: inherit;
      font-size: 20px;
    }

    .potionbar .potion small {
      font-size: 9px;
      color: var(--dim);
    }

    .potionbar .potion:active {
      background: var(--line);
    }

    .cmdrow {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      padding: 12px 14px;
      margin: 0;
      background: var(--panel2);
      border: 2px solid var(--line);
      border-radius: 9px;
      color: var(--text);
      font-family: inherit;
      text-align: left;
      font-size: 16px;
    }

    .cmdrow.sel {
      border-color: var(--gold);
      background: #3a2f1a;
      color: var(--gold);
    }

    .cmdrow.disabled {
      color: #6b6b6b;
      background: #1a1a1f;
      border-color: #2a2a30;
      opacity: 0.6;
      cursor: not-allowed;
    }

    .cmdrow.disabled.sel {
      border-color: #6b5a3a;
      background: #2a2420;
      color: #9a8a6a;
    }

    .cmdrow .cic {
      font-size: 22px;
    }

    .spcell {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      padding: 8px 4px;
      background: var(--panel2);
      border: 1px solid var(--line);
      border-radius: 8px;
      color: var(--text);
      font-family: inherit;
      cursor: pointer;
    }

    .spcell:active {
      background: var(--line);
      transform: scale(0.95);
    }

    .spcell.sel {
      border-color: var(--gold);
      background: #3a2f1a;
      box-shadow: 0 0 8px rgba(245, 200, 76, .4);
    }

    .spcell small {
      font-size: 9px;
      line-height: 1.1;
      text-align: center;
      color: var(--dim);
    }

    .menu-btn small {
      display: block;
      font-size: 11px;
      color: var(--dim);
      margin-top: 4px;
      line-height: 1.5;
    }

    .menu-btn:active {
      border-color: var(--gold);
      background: var(--line);
    }

    #title-box .ttl {
      font-size: 13px;
      color: var(--dim);
      letter-spacing: 3px;
    }

    #title-box .ttl2 {
      font-size: 24px;
      color: var(--gold);
      margin: 6px 0 14px;
      text-shadow: 2px 2px 0 #4a2a00;
    }

    #title-box .bird {
      font-size: 44px;
      margin: 8px 0;
    }

    .helplist {
      font-size: 12.5px;
      line-height: 1.8;
      color: var(--text);
      text-align: left;
    }

    .helplist b {
      color: var(--gold);
    }

    /* 横画面で高さが小さい端末はコントローラーを縮小 */
    @media (orientation:landscape) and (max-height:380px) {
      #dpad {
        grid-template-columns: repeat(3, 40px);
        grid-template-rows: repeat(3, 40px);
      }

      #abxy {
        width: 140px;
        height: 140px;
      }

      .actbtn {
        width: 44px;
        height: 44px;
        font-size: 17px;
      }

      #leftcon,
      #rightcon {
        gap: 8px;
        padding: 6px 10px;
      }

      #log {
        height: 56px;
      }
    }
