:root{
      --primary:#2563eb;
      --primary2:#4f46e5;
      --cp-accent1: rgba(37, 99, 235, .26);
      --cp-accent2: rgba(79, 70, 229, .14);
      --cp-line: rgba(255,255,255,.16);
      --xfade-edge: rgba(243,244,246,.92);
      --bg:#f3f4f6;
      --card:#ffffff;
      --text:#111827;
      --muted:#6b7280;
      --border:#e5e7eb;
      --danger:#dc2626;
      --ok:#16a34a;
      --shadow: 0 6px 18px rgba(0,0,0,.06);
      --radius: 14px;
    }
    *{ box-sizing:border-box; }
    body{ margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans JP", sans-serif; background:var(--bg); color:var(--text); }
    .cp-top-shell{
      position:sticky; top:0; z-index:20;
      --auto-header-shift: 0px;
      transform: translate3d(0, 0, 0);
      transition: transform .24s cubic-bezier(.22,.72,.2,1);
      will-change: transform;
    }
    .cp-top-shell.is-header-hidden{
      transform: translate3d(0, var(--auto-header-shift), 0);
    }
    @media (prefers-reduced-motion: reduce){
      .cp-top-shell{ transition: none; }
    }
    header{
      position:relative;
      background: url("./assets/rs_title_bg.jpeg");
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      color:#fff;
      padding:12px 12px calc(12px + env(safe-area-inset-top));
      box-shadow: 0 4px 14px rgba(0,0,0,.12);
      overflow:hidden;
      isolation:isolate;
      --xfade-edge: rgba(0,0,0,.55);
    }
    header::before{
      content:"";
      position:absolute;
      inset:0;
      background: rgba(0,0,0,.14);
      pointer-events:none;
    }
    header > *{ position:relative; }
    .hdr{ display:flex; flex-direction:column; align-items:stretch; gap:10px; max-width:980px; margin:0 auto; }

    /* ヘッダーは常時表示。スクロール位置を補正する自動縮小は行わない。 */
    .hdr-hideable{
      display:flex;
      flex-direction:column;
      gap:10px;
    }
    .hdr-top{
      display:flex;
      justify-content:flex-end;
      align-items:center;
      gap:10px;
    }
    .hdr-brand{
      margin-top:10px;
      display:flex;
      flex-direction:column;
      gap:4px;
      min-width:0;
      width:100%;
    }
    .hdr-main-title{
      display:flex;
      justify-content:flex-start;
      align-items:center;
      line-height:1;
      min-width:0;
      width:100%;
      overflow:visible;
    }
    .hdr-main-logo{
      display:block;
      height:auto;
      width:min(92vw, 560px);
      max-width:min(92vw, 560px);
      max-height:52px;
      object-fit:contain;
      filter: drop-shadow(0 2px 10px rgba(0,0,0,.55));
    }
    .hdr-actions-row{ margin-left:0 !important; display:flex; gap:8px; justify-content:flex-end; width:100%; }
    @media (max-width:680px){
      .hdr-actions-row{ width:100%; justify-content:flex-end; }
      .hdr-main-logo{ width:min(92vw, 560px); max-width:min(92vw, 560px); max-height:52px; }
      .hdr-subtitle{ font-size:15px; letter-spacing:.12em; }
      .hdr-desc{ font-size:12px; line-height:1.55; }
    }
    .hdr-sub{ font-size:12px; line-height:1.6; opacity:.92; margin-top:0; color:rgba(255,255,255,.90); }
    .hdr-subtitle-row{
      display:flex;
      align-items:center;
      justify-content:flex-start;
      gap:10px;
      min-height:16px;
      padding-left:0;
      padding-right:0;
      flex-wrap:wrap;
      width:min(100%, 680px);
    }
    .hdr-base-inline{
      display:inline-flex;
      align-items:center;
      gap:8px;
      padding:7px 10px;
      border-radius:14px;
      background: linear-gradient(180deg, rgba(23,50,94,.96), rgba(15,34,64,.98));
      border:1px solid rgba(255,255,255,.30);
      box-shadow: 0 10px 24px rgba(0,0,0,.20), inset 0 1px 0 rgba(255,255,255,.14);
      color:#fff;
      font-size:13px;
      font-weight:900;
      line-height:1;
      white-space:nowrap;
      margin-left:auto;
    }
    .hdr-base-inline .k{ color:#fff !important; font-weight:900; }
    .hdr-base-inline input{
      width:72px;
      min-width:72px;
      height:30px;
      margin:0;
      padding:4px 8px;
      border-radius:10px;
      border:1px solid rgba(255,255,255,.32) !important;
      background:rgba(255,255,255,.18) !important;
      color:#fff !important;
      -webkit-text-fill-color:#fff !important;
      font-size:14px;
      font-weight:900;
      text-align:center;
      box-shadow:none !important;
      appearance:textfield;
      -moz-appearance:textfield;
    }
    .hdr-base-inline input::-webkit-outer-spin-button,
    .hdr-base-inline input::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }
    .hdr-base-inline input::placeholder{ color:rgba(255,255,255,.72) !important; opacity:1; }
    @media (max-width:680px){
      .hdr-base-inline{ padding:6px 9px; font-size:12px; margin-left:auto; }
      .hdr-base-inline input{ width:66px; min-width:66px; height:28px; font-size:13px; }
    }
    .hdr-subtitle{
      display:inline-flex;
      align-items:center;
      padding:8px 14px;
      border-radius:14px;
      background: linear-gradient(135deg, #c8df74, #9dbc35);
      border:1px solid #dceaa7;
      box-shadow: 0 10px 24px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.24);
      font-size:15px;
      font-weight:900;
      letter-spacing:.14em;
      line-height:1.15;
      color:#fff;
      -webkit-text-stroke: .8px rgba(0,0,0,.92);
      paint-order: stroke fill;
      text-shadow:
        -1px -1px 0 rgba(0,0,0,.72),
         1px -1px 0 rgba(0,0,0,.72),
        -1px  1px 0 rgba(0,0,0,.72),
         1px  1px 0 rgba(0,0,0,.72),
         0 2px 8px rgba(0,0,0,.34);
      white-space:nowrap;
      text-transform:uppercase;
    }
    .hdr-desc{
      display:inline-block;
      width:fit-content;
      max-width:min(92vw, 680px);
      padding:8px 12px;
      border-radius:12px;
      background: linear-gradient(135deg, #86bdf3, #5c8ecf);
      border:1px solid #b7d5f7;
      box-shadow: 0 10px 24px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.22);
      font-size:12px;
      line-height:1.65;
      color:#fff;
      -webkit-text-stroke: .55px rgba(0,0,0,.90);
      paint-order: stroke fill;
      text-shadow:
        -1px -1px 0 rgba(0,0,0,.72),
         1px -1px 0 rgba(0,0,0,.72),
        -1px  1px 0 rgba(0,0,0,.72),
         1px  1px 0 rgba(0,0,0,.72),
         0 2px 8px rgba(0,0,0,.34);
      margin-top:4px;
    }
    @media (max-width:680px){
      .hdr-subtitle{ padding:8px 14px; border-radius:14px; }
      .hdr-desc{ padding:8px 12px; border-radius:12px; }
    }
    .hdr-actions{ display:flex; gap:8px; }
    .iconbtn{
  border:1px solid rgba(255,255,255,.35);
  background:rgba(0,0,0,.18);
  color:#fff;
  border-radius:12px;
  padding:10px 10px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  user-select:none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
    .iconbtn:active{ transform: translateY(1px); }

    /* 画面切り替え（自分用）：移動先が分かるように文字付き */
    .switchbtn{
      justify-content:flex-start;
      gap:6px;
      padding:8px 12px;
    }

    .cp-toolbar-band{
      position:relative;
      background: linear-gradient(180deg, rgba(11,18,32,.92), rgba(20,30,52,.88));
      box-shadow: 0 8px 18px rgba(0,0,0,.12);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      --xfade-edge: rgba(0,0,0,.62);
    }
    .cp-toolbar-band::before{
      content:"";
      position:absolute;
      inset:0;
      background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0));
      pointer-events:none;
    }
    .cp-toolbar-inner{
      position:relative;
      max-width:980px;
      margin:0 auto;
      padding:6px 12px 10px;
    }
    .switchbtn .navtxt{
      font-size:12px;
      font-weight:800;
      letter-spacing:.2px;
      white-space:nowrap;
      line-height:1;
      color:#fff;
      -webkit-text-stroke:.45px rgba(0,0,0,.88);
      paint-order: stroke fill;
      text-shadow:0 1px 5px rgba(0,0,0,.45);
    }
    @media (max-width:420px){
      .switchbtn{ padding:8px 10px; }
      .switchbtn .navtxt{ font-size:11px; }
    }

.toolbar{
  display:flex;
  flex-wrap:nowrap;
  gap:8px;
  overflow-x:auto;
  padding-bottom:4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width:none;
}
.toolbar::-webkit-scrollbar{ display:none; }
/* 1列固定：ボタンは横並び（必要なら横スクロール） */
.toolbtn{ flex:0 0 auto; min-width:64px; }
@media (max-width:420px){
      table{ min-width: 0; table-layout:fixed; }
      th, td{ padding:6px; }
      td .cellinput{ width:100%; }
      td .cellinput.small{ width:100%; }
      td .cellinput.tiny{ width:100%; }
      .statname{ width:54px; }
      /* column widths (order: 項目/凸/補正/ボーナス/素ステ/CP) */
      th:nth-child(1), td:nth-child(1){ width:62px; }
      th:nth-child(2), td:nth-child(2){ width:112px; }
      th:nth-child(3), td:nth-child(3){ width:62px; }
      th:nth-child(4), td:nth-child(4){ width:62px; }
      th:nth-child(5), td:nth-child(5){ width:66px; }
      th:nth-child(6), td:nth-child(6){ width:56px; }
    }
.toolbtn{
  border:1px solid rgba(255,255,255,.35);
  background:rgba(0,0,0,.18);
  color:#fff;
  border-radius:14px;
  padding:10px 8px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  cursor:pointer;
  user-select:none;
  font-weight:900;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.toolbtn .txt{ font-size:11px; line-height:1.1; white-space:nowrap; }
#btnHeaderStones{ gap:4px; }
#btnHeaderStones .txt-stones{ white-space:normal; text-align:center; font-size:9px; line-height:1.0; letter-spacing:-0.01em; display:block; }

.toolbtn:active{ transform: translateY(1px); }

    /* 横スクロール端フェード（全エリア共通） */
    .xfadeWrap{ position:relative; }
    .xfadeWrap::before, .xfadeWrap::after{
      content:"";
      position:absolute;
      top:0; bottom:0;
      width:22px;
      pointer-events:none;
      opacity:0;
      transition: opacity .15s ease;
      z-index:30;
    }
    .xfadeWrap::before{
      left:0;
      background: linear-gradient(to right, var(--xfade-edge), rgba(0,0,0,0));
    }
    .xfadeWrap::after{
      right:0;
      background: linear-gradient(to left, var(--xfade-edge), rgba(0,0,0,0));
    }
    .xfadeWrap.showL::before{ opacity:1; }
    .xfadeWrap.showR::after{ opacity:1; }


    main{ max-width:980px; margin:0 auto; padding:12px 12px 92px; }
    .card{ background:var(--card); border:1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding:12px; margin:10px 0; }
    .row{ display:flex; gap:10px; flex-wrap:wrap; }
    .col{ flex:1; min-width: 220px; }
    .label{ font-size:12px; color:var(--muted); margin-bottom:6px; }
    input, select{ width:100%; padding:11px 12px; border-radius:12px; border:1px solid var(--border); background:#fff; font-size:14px; outline:none; }
    input:focus, select:focus{ border-color: rgba(37,99,235,.55); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
    .btn{ border:1px solid var(--border); background:#fff; padding:10px 12px; border-radius:12px; cursor:pointer; user-select:none; font-weight:700; }
    .btn:active{ transform:translateY(1px); }
    .btn-primary{ background:var(--primary); border-color: var(--primary); color:#fff; }
    .btn-danger{ background:var(--danger); border-color: var(--danger); color:#fff; }
    .btn-ghost{ background:transparent; border-color: var(--border); color: var(--text); }
    .btn-small{ padding:8px 10px; border-radius:10px; font-size:13px; }
    .muted{ color:var(--muted); font-size:12px; }
    .help-link{ color: var(--primary); font-weight:900; cursor:pointer; text-decoration: underline; text-underline-offset: 2px; }
    .help-link:active{ opacity:.75; }
    .hr{ height:1px; background:var(--border); margin:12px 0; }

    .cp-box{
  background: linear-gradient(135deg, var(--cp-accent1), var(--cp-accent2));
  border-radius: 18px;
  padding:14px;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  border: 1px solid var(--cp-line);
  box-shadow: 0 14px 40px rgba(0,0,0,.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
    .card.cp-hero{
      background: linear-gradient(135deg, rgba(37, 99, 235, .18), rgba(79, 70, 229, .12)) !important;
      border: 1px solid rgba(255,255,255,.14) !important;
      color:#fff !important;
      box-shadow: 0 16px 48px rgba(0,0,0,.26) !important;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }
    .card.cp-hero *{ color: inherit; }

    .cp-title{ font-weight:800; opacity:.95; display:flex; align-items:center; gap:8px; }
    .cp-value{ font-size:38px; font-weight:900; letter-spacing:.5px; }
    .pill{ display:inline-flex; align-items:center; gap:8px; padding:7px 10px; border-radius:999px; border:1px solid var(--border); background:#fff; font-size:12px; color:var(--muted); }
    .pill strong{ color:var(--text); }

    .imgwrap{ display:flex; gap:10px; align-items:stretch; flex-wrap:wrap; }
    .imgbox{ width:100%; max-width: 360px; aspect-ratio: 16/9; border-radius: 14px; border:1px solid var(--border); background:#f9fafb; overflow:hidden; display:flex; align-items:center; justify-content:center; position:relative; }
    .imgbox img{ width:100%; height:100%; object-fit:cover; }
    .imgbox .ph{ color:var(--muted); font-size:12px; }
    .imgtools{ flex:1; min-width: 220px; display:flex; flex-direction:column; gap:10px; }

    .equip-grid{ display:grid; grid-template-columns: 1fr; gap:10px; }
    @media (min-width:720px){ .equip-grid{ grid-template-columns: 1fr 1fr; } }
    .equip-item{ border:1px solid var(--border); border-radius: 14px; padding:12px; display:flex; align-items:center; justify-content:space-between; gap:10px; background:#fff; }
    .equip-left{ display:flex; flex-direction:column; gap:4px; }
    .equip-name{ font-weight:900; }
    .equip-sub{ color:var(--muted); font-size:12px; }
    .equip-cp{ border:1px solid var(--border); padding:6px 10px; border-radius: 12px; font-weight:900; min-width: 84px; text-align:center; }

    .grid2{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; }

    /* --- Reference status (A案：カード内グリッドで整列) --- */
    .refStatGrid{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
    @media (max-width:520px){ .refStatGrid{ grid-template-columns:1fr; } }
    .refStatCard{ border:1px solid var(--border); border-radius:16px; padding:10px; background:#fff; }
    .rscTop{ display:flex; align-items:center; gap:8px; }
    .rscName{ font-weight:900; font-size:16px; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .rscChip{ border:1px solid var(--border); background:#f8fafc; border-radius:12px; padding:6px 10px; font-weight:800; font-size:12px; white-space:nowrap; }
    .rscMid{ display:grid; grid-template-columns: 1fr 1fr; gap:8px; margin-top:10px; }
    .rscBot{ display:grid; grid-template-columns: 1fr 1fr 1fr; gap:8px; margin-top:8px; }
    .rscCell{ border:1px solid var(--border); border-radius:12px; padding:8px 10px; min-width:0; }
    .rscLabel{ font-size:11px; color:var(--muted); font-weight:800; }
    .rscVal{ font-size:13px; color:var(--text); font-weight:900; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .rscCell.mutedCell .rscVal{ color:var(--muted); font-weight:800; }

    /* --- Compact spacing (mobile) --- */
    /* accMax has inline padding, so we override it here */
    #accMax{ padding:8px !important; }
    #accMax .acc-head{ cursor:default; }
    #accMax .chev{ display:none; }
    .acc-body{ margin-top:10px; }

    @media (max-width:520px){
      main{ padding:10px 10px 88px; }
      .card{ padding:10px; margin:8px 0; }
      .row{ gap:8px; }
      .grid2{ gap:8px; }
      #maxGrid{ gap:6px; }
      .hpgrid{ gap:8px; }
      .minirow{ gap:8px; }
      .minirow3{ gap:8px; }
      .minirow3slash{ gap:8px; }
      input, select{ padding:10px 11px; }
      .label{ margin-bottom:4px; }
      .hr{ margin:10px 0; }
      .equip-grid{ gap:8px; }
      .equip-item{ padding:10px; }
      .slotrow{ padding:10px; }
      .list{ gap:8px; }
      .listitem{ padding:10px; }
      .tabs{ margin-bottom:8px; }
    }

    /* Fix17: 最大値欄は画面幅に応じて自動で1〜2列にする（数値見切れ対策） */
    #maxGrid.grid2{ grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
    #maxGrid .minirow3{ grid-template-columns: clamp(52px, 14vw, 64px) minmax(0, .9fr) minmax(0, 1.1fr); gap:8px; }
    .hpgrid{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px; }
    .hpcell{ min-width:0; }
    @media (max-width:720px){ .hpgrid{ grid-template-columns: repeat(2, minmax(0,1fr)); } }

    .minirow{ display:grid; grid-template-columns: clamp(52px, 14vw, 64px) minmax(0,1fr); gap:10px; align-items:center; }
    .minirow3{ display:grid; grid-template-columns: clamp(52px, 14vw, 64px) minmax(0,1fr) minmax(0,1fr); gap:10px; align-items:center; }
    .minirow3slash{ display:grid; grid-template-columns: clamp(52px, 14vw, 64px) minmax(0,1fr) 14px minmax(0,1fr); gap:10px; align-items:center; }
    .minirow3slash .sep{ text-align:center; color:#9ca3af; font-weight:900; user-select:none; }
    .minirow input, .minirow3 input{ min-width:0; }
    #maxGrid input{
      font-size: clamp(12px, 3.4vw, 14px);
      line-height: 1.15;
      padding: 0.65em 0.8em;
    }
    #maxGrid .readonly{
      text-align:center;
      font-size: clamp(12px, 3.5vw, 13px);
      letter-spacing:0;
      font-variant-numeric: tabular-nums;
      white-space:nowrap;
      font-weight:800;
      min-width:72px;
    }
    .tag{ font-weight:900; font-size:14px; color:#111827; }

    .tablewrap{ overflow:auto; border:1px solid var(--border); border-radius:14px; }
    table{ width:100%; border-collapse:collapse; min-width: 680px; background:#fff; }
    th, td{ padding:8px; border-bottom:1px solid var(--border); font-size:13px; }
    th{ position:sticky; top:0; background:#f9fafb; z-index:2; text-align:left; font-size:12px; color:var(--muted); }
    td .cellinput{ width:96px; }
    td .cellinput.small{ width:78px; }
    td .cellinput.tiny{ width:64px; }
    .statname{ font-weight:900; width:62px; white-space:nowrap; }

    /* v50.65: 8ステータスの凸だけを0〜4のコンパクトな−／＋操作にする */
    .stat-bump-head, .stat-bump-cell{ min-width:112px; }
    .stat-bump-stepper{
      width:104px;
      display:grid;
      grid-template-columns:32px 32px 32px;
      gap:4px;
      align-items:center;
      justify-content:center;
    }
    .stat-bump-stepper .stat-bump-input{
      width:32px !important;
      height:38px;
      min-width:0;
      padding:4px 1px !important;
      border-radius:10px;
      text-align:center;
      font-size:15px;
      font-weight:900;
      font-variant-numeric:tabular-nums;
      appearance:textfield;
      -moz-appearance:textfield;
    }
    .stat-bump-stepper .stat-bump-input::-webkit-outer-spin-button,
    .stat-bump-stepper .stat-bump-input::-webkit-inner-spin-button{
      -webkit-appearance:none;
      margin:0;
    }
    .stat-bump-btn{
      width:32px;
      height:38px;
      padding:0;
      border-radius:10px;
      border:1px solid rgba(255,255,255,.22);
      background:rgba(255,255,255,.09);
      color:#fff;
      display:flex;
      align-items:center;
      justify-content:center;
      font-size:23px;
      line-height:1;
      font-weight:900;
      cursor:pointer;
      user-select:none;
      touch-action:manipulation;
      -webkit-tap-highlight-color:transparent;
    }
    .stat-bump-btn.minus{ color:#93c5fd; }
    .stat-bump-btn.plus{ color:#86efac; }
    .stat-bump-btn:active:not(:disabled){ transform:translateY(1px); background:rgba(255,255,255,.16); }
    .stat-bump-btn:focus-visible{ outline:2px solid rgba(147,197,253,.85); outline-offset:2px; }
    .stat-bump-btn:disabled{ opacity:.28; cursor:default; }
    .right{ text-align:right; }
    .readonly{ background:#f9fafb; border-color:#f3f4f6; color:#111827; font-weight:900; }
    @media (max-width:420px){
      table{ min-width: 700px; }
      th, td{ padding:7px; }
      td .cellinput{ width:88px; }
      td .cellinput.small{ width:72px; }
      td .cellinput.tiny{ width:58px; }
      .statname{ width:58px; }
      .stat-bump-head, .stat-bump-cell{ min-width:108px; }
      .stat-bump-stepper{ width:100px; grid-template-columns:31px 30px 31px; gap:4px; }
      .stat-bump-stepper .stat-bump-input{ width:30px !important; height:36px; font-size:14px; }
      .stat-bump-btn{ width:31px; height:36px; font-size:22px; }
    }

    /* --- Load list table + pagination --- */
    .loadtable{ min-width: 0 !important; }
    .loadtable th, .loadtable td{ padding:10px 8px; }
    .loadtable tbody tr{ cursor:pointer; }
    .loadtable tbody tr:hover{ background:#f9fafb; }
    .loadtable .cp{ text-align:right; font-variant-numeric: tabular-nums; font-weight:900; white-space:nowrap; }
    .loadtable .namecell{ display:flex; align-items:center; justify-content:space-between; gap:10px; min-width:0; }
    .loadtable .namecell .nm{ font-weight:900; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .pager{ display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin-top:12px; }
    .pgbtn{ border:1px solid var(--border); background:#fff; padding:8px 12px; border-radius:12px; cursor:pointer; user-select:none; font-weight:900; min-width: 44px; }
    .pgbtn:active{ transform: translateY(1px); }
    .pgbtn[disabled]{ opacity:.45; cursor:default; }
    .pgbtn.active{ background: rgba(37,99,235,.10); border-color: rgba(37,99,235,.35); color: var(--primary); }

    /* --- Segmented toggle --- */
    .seg{ display:flex; border:1px solid var(--border); border-radius:999px; overflow:hidden; background:#fff; }
    .segbtn{ flex:1; padding:8px 12px; border:none; background:transparent; cursor:pointer; user-select:none; font-weight:900; min-width:64px; }
    .segbtn.active{ background: var(--primary); color:#fff; }
    .segbtn:active{ transform: translateY(1px); }

    @media (max-width:520px){
      .loadtable th, .loadtable td{ padding:9px 7px; }
      .pgbtn{ padding:8px 10px; border-radius:11px; }
    }

    .acc-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; cursor:pointer; user-select:none; }
    .acc-head h3{ margin:0; font-size:14px; }
    .chev{ transition: transform .18s ease; }
    .acc-body{ display:none; margin-top:12px; }
    .acc.open .acc-body{ display:block; }
    .acc.open .chev{ transform: rotate(180deg); }

    .bottom-nav{ position:fixed; left:0; right:0; bottom:0; z-index:30; background:#fff; border-top:1px solid var(--border); padding:10px 12px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 18px rgba(0,0,0,.06); }
    .navwrap{ max-width:980px; margin:0 auto; display:flex; gap:10px; }
    .navbtn{ flex:1; display:flex; align-items:center; justify-content:center; gap:8px; padding:12px; border-radius:14px; border:1px solid var(--border); background:#fff; font-weight:900; cursor:pointer; user-select:none; font-size:14px; }
    .navbtn.active{ background: rgba(37,99,235,.10); border-color: rgba(37,99,235,.35); color: var(--primary); }

    @media (max-width:520px){
      .navbtn{ padding:10px; font-size:13px; }
    }

    /* Modal backdrop: render app background image INSIDE overlay (so underlying UI won't show) */
    .modal-back{
      position:fixed; inset:0; z-index:50;
      display:none; align-items:center; justify-content:center; padding:14px;
      background: #0b1220; /* fallback */
      overflow:hidden;
    }
    /* paint background image */
    .modal-back::before{
      content:"";
      position:absolute;
      inset:-18px; /* bleed for blur edges */
      background: var(--app-bg-url) center/cover no-repeat;
      filter: blur(var(--modal-bg-blur));
      transform: scale(1.05);
      opacity: .92;
      pointer-events:none;
    }
    /* dim layer for readability */
    .modal-back::after{
      content:"";
      position:absolute; inset:0;
      background: var(--modal-bg-overlay);
      pointer-events:none;
    }
    .modal-back > .modal{ position:relative; z-index:2; }

    /* Modal content should let the modal backdrop (app BG image) show through,
       but NOT show the underlying edit/party UI.
       - fullscreen modals are transparent (backdrop provides the BG)
       - cards inside modal use a slightly lighter glass */
    .modal-back{
      --glass: rgba(17, 26, 46, 0.46);
      --glass-soft: rgba(17, 26, 46, 0.30);
      --glass-strong: rgba(17, 26, 46, 0.58);
      --glass-line: rgba(255,255,255,0.14);
      --glass-line-soft: rgba(255,255,255,0.10);
      --glass-input: rgba(255,255,255,0.08);
    }
    .modal-back::before{ background-attachment: fixed; }

    .modal-back .modal{ background: var(--glass) !important; }
    .modal-back .modal-head{ background: var(--glass-strong) !important; }

    /* fullscreen: remove the big solid panel so the BG image is visible */
    .modal.is-fullscreen{
      background: transparent !important;
      border: none !important;
      box-shadow: 0 0 0 1px rgba(255,255,255,.10) inset, 0 0 18px rgba(255,255,255,.10) !important;
    }
    .modal.is-fullscreen .modal-body{ background: transparent !important; }
    .modal.is-fullscreen .modal-head{
      background: rgba(17, 26, 46, 0.55) !important;
      border-bottom-color: rgba(255,255,255,0.14) !important;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }

    .modal{ width: min(920px, 100%); background:#fff; border-radius: 18px; border:1px solid var(--border); box-shadow: 0 18px 70px rgba(0,0,0,.22); overflow:hidden; max-height: 86vh; display:flex; flex-direction:column; }
    /* Fullscreen modal (for 参照画面など) */
    .modal-back.is-fullscreen{ padding:0; }
    .modal.is-fullscreen{
      width: 100vw;
      height: 100dvh;
      max-height: 100dvh;
      border-radius: 0;
      border-left: none;
      border-right: none;
      border-top: none;
    }
    .modal.is-fullscreen .modal-head{ padding-top: calc(12px + env(safe-area-inset-top)); }
    .modal.is-fullscreen .modal-body{ padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    .modal-head{ padding:12px 12px; display:flex; align-items:center; justify-content:space-between; gap:10px; border-bottom:1px solid var(--border); background:#fff; }
    .modal-title{ font-weight:900; }
    .modal-body{ padding:12px; overflow:auto; }
    .modal-close{ border:1px solid var(--border); background:#fff; border-radius: 12px; padding:8px 10px; cursor:pointer; user-select:none; font-weight:900; }
    .help-box{
      background: rgba(17,26,46,.44);
      border:1px solid rgba(255,255,255,.18);
      border-radius:16px;
      padding:14px 16px;
      box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 24px rgba(0,0,0,.14);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
    }
    .help-box + .help-box{ margin-top:12px; }
    .help-box .muted{ color: rgba(255,255,255,.92) !important; font-size:13px; line-height:1.75; }
    .help-box .help-steps{ margin:0; padding-left:1.35em; line-height:1.8; color: rgba(255,255,255,.97); font-weight:700; }
    .help-box .help-steps li + li{ margin-top:8px; }
    .help-box .help-note{ color: rgba(255,255,255,.95); font-size:13px; line-height:1.75; }
    .help-box b{ color:#fff; }
    .help-image-wrap{ margin-top:12px; padding:12px; background: rgba(17,26,46,.30); border:1px solid rgba(255,255,255,.16); border-radius:16px; box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 10px 22px rgba(0,0,0,.12); }
    .help-image-wrap img{ display:block; width:100%; border-radius:14px; border:1px solid rgba(255,255,255,.18); }

    .list{ display:flex; flex-direction:column; gap:10px; }
    .listitem{ border:1px solid var(--border); border-radius: 14px; padding:12px; display:flex; align-items:center; justify-content:space-between; gap:10px; background:#fff; cursor:pointer; user-select:none; }
    .listitem:active{ transform: translateY(1px); }
    .listitem .sub{ font-size:12px; color:var(--muted); margin-top:3px; }

    .tabs{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
    .tab{ padding:9px 12px; border-radius: 12px; border:1px solid var(--border); cursor:pointer; user-select:none; font-weight:900; background:#fff; }
    .tab.active{ border-color: rgba(37,99,235,.35); background: rgba(37,99,235,.10); color: var(--primary); }

    .slotrow{ display:flex; align-items:center; justify-content:space-between; gap:10px; border:1px solid var(--border); border-radius: 16px; padding:12px; background:#fff; }
    .slot-left{ display:flex; align-items:center; gap:10px; min-width: 0; }
    .avatar{ width:60px; height:60px; border-radius:14px; background:#f3f4f6; border:1px solid var(--border); overflow:hidden; display:flex; align-items:center; justify-content:center; flex:0 0 auto; }
    .avatar img{ width:100%; height:100%; object-fit:cover; }
    .slot-meta{ min-width:0; }
    .slot-name{ font-weight:900; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .slot-cp{ font-weight:900; color:#111827; margin-top:4px; }
    .xbtn{ width:34px; height:34px; border-radius:12px; border:1px solid var(--border); background:#fff; cursor:pointer; user-select:none; display:flex; align-items:center; justify-content:center; font-weight:900; }

    .party-strip{
      display:grid;
      grid-auto-flow: column;
      grid-auto-columns: minmax(116px, 1fr);
      gap:8px;
      overflow-x:auto;
      padding-bottom:6px;
      scroll-snap-type:x mandatory;
      -webkit-overflow-scrolling: touch;
    }
    .party-tile{
      scroll-snap-align:start;
      border:1px solid var(--border);
      border-radius:16px;
      background:#fff;
      box-shadow: var(--shadow);
      overflow:hidden;
      display:flex;
      flex-direction:column;
      min-width:116px;
    }
    .pt-avatar{
      width:100%;
      aspect-ratio: 1 / 1;
      background:#f3f4f6;
      border-bottom:1px solid var(--border);
      position:relative;
      display:flex;
      align-items:center;
      justify-content:center;
      overflow:hidden;
    }
    .pt-avatar img{ width:100%; height:100%; object-fit:cover; }
    .pt-idx{ font-weight:900; color:#6b7280; font-size:18px; }
    .pt-body{ padding:7px; display:flex; flex-direction:column; gap:6px; }
    /* pt-body shrink fix */
    .pt-body *{ min-width:0; }
    .pt-kv{ padding:6px 8px; }
    .pt-kv .k{ font-size:11px; }
    .pt-kv .v{ font-size:15px; }
    .pt-mini{ padding:5px 6px; }
    .pt-mini .k{ font-size:10px; }
    .pt-mini .v{ font-size:11px; }
    .pt-actions{ padding: 6px; gap:6px; }
    .pt-actions .xbtn{ width:36px; height:34px; flex:0 0 36px; }
    .pt-name{ font-weight:900; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    /* Party screenshot helper (no horizontal/vertical scroll) */
    .pshot-wrap{ display:flex; flex-direction:column; gap:10px; width:100%; }
    .pshot-total{
      border:1px solid var(--border);
      border-radius:16px;
      padding:10px 12px;
      background:#fff;
      box-shadow: var(--shadow);
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:12px;
      width:100%;
      overflow:hidden;          /* 文字が枠外にはみ出さない */
      flex-wrap:wrap;           /* 狭い端末でタイトルだけ折り返して崩れ防止 */
    }
    .pshot-total-label{
      font-weight:900;
      flex:1 1 auto;
      min-width:0;
    }
    .pshot-total-num{
      font-weight:900;
      font-size:clamp(18px, 5.8vw, 22px);
      white-space:nowrap;
      font-variant-numeric: tabular-nums;
      text-align:right;
      margin-left:auto;
      max-width:100%;
    }
    .pshot-list{ display:flex; flex-direction:column; gap:8px; width:100%; }
    .pshot-row{ border:1px solid var(--border); border-radius:16px; padding:6px 8px; background:#fff; box-shadow: var(--shadow); display:flex; align-items:center; gap:8px; width:100%; }
    .pshot-av{ width:42px; height:42px; border-radius:12px; background:#f3f4f6; overflow:hidden; display:flex; align-items:center; justify-content:center; flex:0 0 auto; }
    .pshot-av img{ width:100%; height:100%; object-fit:cover; }
    .pshot-idx{ font-weight:900; color:#6b7280; }
    .pshot-main{ flex:1; min-width:0; }
    .pshot-name{ font-weight:900; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .pshot-sub{ margin-top:2px; display:flex; flex-wrap:wrap; gap:10px; font-size:12px; color:#374151; }
    .pshot-sub b{ font-weight:900; }


    .pshot-scale-wrap{ overflow:hidden; width:100%; }
    .pshot-scale{ transform-origin: top left; width:100%; }

    .pshot-row{ align-items:flex-start; }
    /* party screenshot modal: keep it readable on narrow screens */
    .pshot-body{ margin-top:4px; display:grid; grid-template-columns: minmax(0,1fr) 170px; gap:10px; align-items:flex-start; width:100%; }

    @media (max-width: 520px){
      .pshot-body{ grid-template-columns: minmax(0,1fr) 150px; }
    }
    /* 右側スペースを有効活用（装備欄を少し広げつつ、テキストが残り幅まで伸びて省略されるように） */
    /* equipment: vertical list (prevents text collisions / keeps stats wider) */
    .pshot-eq{ width:100%; max-width:none; display:flex; flex-direction:column; gap:2px; }
    .pshot-eq .eqline{ display:flex; gap:6px; font-size:10px; color:#374151; line-height:1.25; }
    .pshot-eq .lbl{ font-weight:900; color:#6b7280; min-width:28px; }
    .pshot-eq .txt{ flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .pshot-stats{ margin-top:0; min-width:0; display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap:3px; }
    .pshot-stat{ border:1px solid rgba(0,0,0,.06); border-radius:10px; padding:3px 5px; background:#f9fafb; }
    .pshot-stat .kv{ display:flex; align-items:baseline; justify-content:flex-start; gap:4px; }
    .pshot-stat .k{ font-size:9px; font-weight:900; color:#6b7280; line-height:1.1; }
    .pshot-stat .v{ font-size:11px; font-weight:900; line-height:1.2; }
    /* スクショ用：凸/昇を省略せず見せる（小さい枠なので折り返し許可） */
    .pshot-stat .m{ font-size:8px; color:#6b7280; margin-top:1px; line-height:1.05; white-space:normal; overflow:visible; text-overflow:clip; display:flex; gap:4px; flex-wrap:wrap; }


    .pt-kv{
      border:1px solid var(--border);
      border-radius:12px;
      background:#fff;
      padding:6px 8px;
      display:flex;
      flex-direction:column;
      gap:2px;
      min-width:0;
    }
    .pt-kv .k{
      color:var(--muted);
      font-weight:900;
      font-size:10px;
      line-height:1.1;
      white-space:nowrap;
    }
    .pt-kv .v{
      font-weight:900;
      font-size:16px;
      line-height:1.1;
      white-space:nowrap;
      align-self:flex-end;
    }

    .pt-mini-grid{ display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap:6px; }
    .pt-mini{ border:1px solid var(--border); border-radius:12px; padding:5px 6px; display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-start; gap:2px; background:#fff; min-width:0; }
    .pt-mini .k{ color:var(--muted); font-weight:900; font-size:9px; line-height:1.1; white-space:nowrap; }
    .pt-mini .v{ font-weight:900; font-size:11px; line-height:1.1; white-space:nowrap; align-self:flex-end; }
    .pt-mini .m{ color:var(--muted); font-weight:800; font-size:9px; line-height:1.1; white-space:nowrap; width:100%; overflow:hidden; text-overflow:ellipsis; }
    .pt-mini .kv{ width:100%; justify-content:space-between; gap:2px; }
    .pt-mini .v{ text-align:right; }
    @media (max-width:330px){ .pt-mini-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }

    .pt-series{ color:rgba(17,24,39,.75); font-weight:800; font-size:11px; margin-left:4px; }
    .pt-eq{ margin-top:6px; border:1px solid var(--border); border-radius:12px; padding:5px 6px; background:#fff; display:flex; flex-direction:column; gap:3px; }
    .pt-eqline{ display:flex; align-items:baseline; gap:6px; min-width:0; }
    .pt-eqline .lbl{ flex:0 0 auto; color:var(--muted); font-weight:900; font-size:10px; }
    .pt-eqline .txt{ flex:1 1 auto; font-size:10px; font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; }


    .pt-actions{ margin-top:auto; padding:10px; border-top:1px solid var(--border); background:#fff; display:flex; gap:8px; }
    .pt-actions .btn{ flex:1; }
    .pt-actions .xbtn{ flex:0 0 40px; width:40px; height:36px; }

    .note{ font-size:12px; color:var(--muted); line-height:1.6; }
  /* v49.7: Party composition list -> vertical compact cards (no wasted blank under image) */
  .party-strip{
    display:flex !important;
    flex-direction:column !important;
    gap: 10px !important;
    overflow:visible !important;
    padding-bottom:0 !important;
    scroll-snap-type:none !important;
  }
  .party-tile{
    scroll-snap-align:none !important;
    min-width:0 !important;
    width:100% !important;
    display:flex !important;
    flex-direction:column !important;
  }
  .pt-head{
    display:flex;
    gap:10px;
    padding:10px;
    align-items:flex-start;
  }
  .pt-avatar{
    width:78px !important;
    height:78px !important;
    aspect-ratio:auto !important;
    border:1px solid var(--border) !important;
    border-radius:14px !important;
    overflow:hidden;
    background:#f3f4f6;
    display:flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
  }
  .pt-headmeta{ flex:1; min-width:0; display:flex; flex-direction:column; gap:6px; }
  .pt-name{ font-size:14px; }
  .pt-kvrow{ display:grid; grid-template-columns: 1fr 1fr; gap:6px; }
  .pt-kv{ padding:6px 8px !important; }
  .pt-kv .k{ font-size:11px !important; }
  .pt-kv .v{ font-size:15px !important; }

  .pt-body{
    padding: 0 10px 10px !important;
    display:flex;
    flex-direction:column;
    gap:8px;
  }
  .pt-mini-grid{ gap:6px; }
  .pt-mini{ padding:5px 6px; }
  .pt-mini .k{ font-size:10px; }
  .pt-mini .v{ font-size:11px; }
  /* show 凸/昇 without clipping (wrap allowed) */
  .pt-mini .m{ white-space:normal; overflow:visible; text-overflow:clip; }

  .pt-eq{ margin-top:0; padding:8px 9px; }
  .pt-eqline .lbl{ font-size:11px; }
  .pt-eqline .txt{ font-size:11px; }

  .pt-actions{
    margin-top:0 !important;
    padding:8px 10px !important;
    justify-content:flex-end !important;
  }
  .pt-actions .btn{ flex:0 0 auto !important; }
  
    /* Ref/Eq: slot icons */
    .equip-name{ display:flex; align-items:center; gap:8px; }
    .equip-icon{
      width:24px; height:24px; padding:2px;
      border-radius:10px; border:1px solid var(--border);
      background:#fff;
      object-fit:contain; box-sizing:border-box;
      flex: 0 0 auto;
    }



    header .hdr-title,
    header .hdr-sub,
    header .hdr-top{
      text-shadow: 0 2px 8px rgba(0,0,0,.55);
    }

  
/* === App background image (v50.18) === */
:root{
  --app-bg-url: url('./assets/app_bg.webp');
  --app-bg-overlay: rgba(11, 18, 32, 0.45);  --modal-bg-overlay: rgba(11, 18, 32, 0.18);
  --modal-bg-blur: 6px;
}
html, body{
  background: var(--app-bg-url) center/cover fixed no-repeat;
}
/* Overlay for readability */
body::before{
  content: "";
  position: fixed;
  inset: 0;
  background: var(--app-bg-overlay);
  pointer-events: none;
  z-index: -1;
}
/* Ensure content sits above overlay */
body{
  position: relative;
  z-index: 0;
}


/* === Glass / transparency tuning for background image (v50.19) === */
:root{
  --glass: rgba(17, 26, 46, 0.62);
  --glass-soft: rgba(17, 26, 46, 0.44);
  --glass-strong: rgba(17, 26, 46, 0.78);
  --glass-line: rgba(255,255,255,0.16);
  --glass-line-soft: rgba(255,255,255,0.10);
  --glass-input: rgba(255,255,255,0.08);
  --text: #f9fafb;
  --muted: rgba(229,231,235,.72);

}

/* Base text colors */
body{ color:#e5e7eb; }
.label{ color: rgba(229,231,235,.78) !important; }
.muted{ color: rgba(229,231,235,.70) !important; }
.tag{ color:#fff !important; }
.hr{ background: rgba(255,255,255,.12) !important; }
.help-link{ color:#93c5fd !important; }

/* Cards / panels */
.card,
.equip-item,
.refStatCard,
.imgbox,
.slotrow,
.listitem,
.pshot-total,
.pshot-row,
.pt-mini,
.pt-eq,
.pt-actions,
.modal,
.modal-head{
  background: var(--glass) !important;
  border-color: var(--glass-line) !important;
  box-shadow: 0 12px 34px rgba(0,0,0,.36) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}


/* Ref modal: zebra transparency (耐性の欄くらいの透過度でハッキリ区別) */
.refStatGrid .refStatCard{
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.10) !important;   /* かなり透ける（耐性のpillに近い） */
  border-color: rgba(255,255,255,0.16) !important;
  box-shadow: 0 10px 26px rgba(0,0,0,.22) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.refStatGrid .refStatCard:nth-child(even){
  background: rgba(255,255,255,0.03) !important;   /* さらに透ける */
  border-color: rgba(255,255,255,0.12) !important;
}
/* うっすら青紫ニュアンス（塗りは薄いので“色が付いただけ”にならない） */
.refStatGrid .refStatCard::before{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(135deg,
    rgba(96,165,250,0.10),
    rgba(167,139,250,0.06) 55%,
    rgba(255,255,255,0.00));
  pointer-events:none;
  opacity: .85;
}
.refStatGrid .refStatCard:nth-child(even)::before{ opacity: .55; }

/* 内側の小枠も耐性pillっぽく（カードが透けても読みやすい） */
.refStatGrid .refStatCard .rscCell{
  background: rgba(11,18,32,0.12) !important;
  border-color: rgba(255,255,255,0.12) !important;
}
.refStatGrid .refStatCard:nth-child(even) .rscCell{
  background: rgba(11,18,32,0.08) !important;
}

.refStatGrid .refStatCard .rscLabel{ color: rgba(226,232,240,0.78) !important; }
.refStatGrid .refStatCard .rscVal{ color: rgba(255,255,255,0.96) !important; }

/* 特定4ステ（腕力/器用さ/知力/愛）は「枠のみ」(アウトライン表示) */
.refStatGrid .refStatCard.isLite{
  background: transparent !important;
  border: 2px solid transparent !important;
  /* グラデ枠（中は塗らない） */
  background:
    linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0)) padding-box,
    linear-gradient(135deg, rgba(96,165,250,0.85), rgba(167,139,250,0.70)) border-box !important;
  box-shadow: 0 10px 26px rgba(0,0,0,.22), 0 0 0 1px rgba(96,165,250,.18), 0 0 18px rgba(96,165,250,.12), 0 0 26px rgba(167,139,250,.10), inset 0 0 0 1px rgba(255,255,255,.08) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
/* 既存の薄い色味オーバーレイ/左バーは無効化 */
.refStatGrid .refStatCard.isLite::before{ opacity: 0 !important; }
.refStatGrid .refStatCard.isLite::after{ display:none !important; }

/* 内側の小枠も「枠のみ」寄せ（読みやすさは残すため極薄） */
.refStatGrid .refStatCard.isLite .rscCell{
  background: rgba(11,18,32,0.02) !important;
  border-color: rgba(255,255,255,0.16) !important;
}
.refStatGrid .refStatCard.isLite .rscLabel{ color: rgba(226,232,240,0.75) !important; }
.refStatGrid .refStatCard.isLite .rscVal{ color: rgba(255,255,255,0.98) !important; }

/* Bottom nav */
.bottom-nav{
  background: rgba(11,18,32,0.62) !important;
  border-top-color: rgba(255,255,255,0.14) !important;
  box-shadow: 0 -10px 24px rgba(0,0,0,.35) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Inputs */
input, select{
  background: var(--glass-input) !important;
  border-color: rgba(255,255,255,0.18) !important;
  color:#fff !important;
}

/* v50.26: make all pill text (including <strong>) white */
.pill strong{ color:#fff !important; }


input::placeholder{ color: rgba(229,231,235,.55) !important; }
input:focus, select:focus{
  border-color: rgba(147,197,253,.65) !important;
  box-shadow: 0 0 0 3px rgba(147,197,253,.18) !important;
}
.readonly{
  background: rgba(255,255,255,0.06) !important;
  border-color: rgba(255,255,255,0.12) !important;
  color:#fff !important;
}

/* Buttons / pills / tabs */
.btn:not(.btn-primary):not(.btn-danger):not(.btn-ghost),
.pgbtn,
.tab,
.xbtn,
.modal-close,
.pill,
.seg,
.navbtn{
  background: rgba(255,255,255,0.08) !important;
  border-color: rgba(255,255,255,0.18) !important;
  color:#fff !important;
}
.btn.btn-primary{ background: var(--primary) !important; border-color: var(--primary) !important; color:#fff !important; }
.btn.btn-danger{ background: var(--danger) !important; border-color: var(--danger) !important; color:#fff !important; }
.btn.btn-ghost{ background: transparent !important; border-color: rgba(255,255,255,0.18) !important; color:#fff !important; }

/* Active states (keep the highlight) */
.pgbtn.active,
.tab.active,
.navbtn.active{
  background: rgba(37,99,235,.22) !important;
  border-color: rgba(147,197,253,.55) !important;
  color:#93c5fd !important;
}

/* Tables */
.tablewrap{ border-color: var(--glass-line) !important; }
table{
  background: var(--glass-soft) !important;
  color:#e5e7eb !important;
}
th{
  background: var(--glass-strong) !important;
  color: rgba(229,231,235,.88) !important;
  border-bottom: 1px solid var(--glass-line) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
td{ border-bottom: 1px solid var(--glass-line-soft) !important; }
.loadtable tbody tr:hover{ background: rgba(255,255,255,0.06) !important; }

/* Small chips / cells */
.rscChip{
  background: rgba(255,255,255,0.06) !important;
  border-color: rgba(255,255,255,0.14) !important;
  color: rgba(229,231,235,.88) !important;
}
.rscLabel{ color: rgba(229,231,235,.72) !important; }
.rscVal{ color:#fff !important; }
.rscCell{ border-color: rgba(255,255,255,0.14) !important; }

.equip-icon{
  background: rgba(255,255,255,0.10) !important;
  border-color: rgba(255,255,255,0.18) !important;
}
.equip-sub{ color: rgba(229,231,235,.72) !important; }


/* === v50.20: fix remaining white panels (max/party/pshot) === */
.acc, #rvList{
  background: transparent !important;
  border-color: var(--glass-line) !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,.10) inset, 0 0 18px rgba(255,255,255,.10) !important;
}
.acc .chev path{ stroke: rgba(229,231,235,.75) !important; }

.party-tile{
  background: var(--glass) !important;
  border-color: var(--glass-line) !important;
  box-shadow: 0 12px 34px rgba(0,0,0,.36) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}



/* v50_46: party zebra — 2nd & 4th party cards are outline-only (no fill) */
#partyStrip .party-tile{ position: relative; }
#partyStrip .party-tile:nth-child(2),
#partyStrip .party-tile:nth-child(4){
  background: transparent !important;          /* no fill */
  border: 2px solid var(--glass-line) !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,.10) inset, 0 0 18px rgba(255,255,255,.10) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.pt-kv, .pshot-stat{
  background: rgba(255,255,255,0.06) !important;
  border-color: rgba(255,255,255,0.14) !important;
  color: #e5e7eb !important;
}

.pt-avatar, .pshot-av{
  background: rgba(255,255,255,0.10) !important;
  border-color: rgba(255,255,255,0.16) !important;
}
.pt-idx, .pshot-idx{ color: rgba(229,231,235,.78) !important; }

.pt-kv .k, .pt-mini .k, .pt-mini .m,
.pt-eqline .lbl, .pt-series,
.pshot-sub, .pshot-eq .eqline, .pshot-eq .lbl, .pshot-eq .txt,
.pshot-stat .k, .pshot-stat .m{
  color: rgba(229,231,235,.78) !important;
}
.pshot-sub b, .pt-kv .v, .pt-mini .v, .pshot-stat .v{ color:#fff !important; }
/* v50.26: slot CP label */
.slot-cp{ color:#fff !important; }



/* === v50.25: Plan3 "text-zone" readability plates (文字/数字だけ濃いガラス) === */
:root{
  --tz-bg-strong: rgba(10,14,26,.62);
  --tz-bg: rgba(10,14,26,.46);
  --tz-line: rgba(255,255,255,.16);
}

/* Main CP blocks */
.cp-box .cp-title{
  display:inline-block;
  padding:2px 10px;
  border-radius: 10px;
  background: var(--tz-bg);
  border: 1px solid var(--tz-line);
  box-shadow: 0 6px 18px rgba(0,0,0,.24);
}
.cp-box .cp-value,
#partyTotal{
  display:inline-block;
  padding:4px 12px;
  border-radius: 14px;
  background: var(--tz-bg-strong);
  border: 1px solid var(--tz-line);
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
}

/* Small number chips */
.pill > strong,
.pill > span:last-child{
  display:inline-block;
  padding:1px 6px;
  border-radius: 10px;
  background: rgba(10,14,26,.38);
  border: 1px solid rgba(255,255,255,.12);
  color:#fff !important;
  font-weight:900;
}

/* Party tiles / Party full-view mini stats */
.pt-kv .v, .pt-mini .v, .pshot-stat .v{
  display:inline-block;
  padding:1px 6px;
  border-radius: 10px;
  background: rgba(10,14,26,.40);
  border: 1px solid rgba(255,255,255,.12);
}
.pt-kv .k, .pt-mini .k, .pt-mini .m,
.pshot-stat .k, .pshot-stat .m{
  display:inline-block;
  padding:1px 5px;
  border-radius: 10px;
  background: rgba(10,14,26,.26);
  border: 1px solid rgba(255,255,255,.10);
}


/* === v50.27: A案（サファイア×パープル）戦闘力だけ主役化 === */
:root{
  --cpA1: rgba(96,165,250,.24);
  --cpA2: rgba(167,139,250,.16);
  --cpAline: rgba(191,219,254,.22);
  --cpAglow: rgba(96,165,250,.18);
  --cpAglow2: rgba(167,139,250,.14);
}

/* Apply only where we add .cp-main */
.cp-box.cp-main,
.card.cp-hero.cp-main{
  background: linear-gradient(135deg, var(--cpA1), var(--cpA2)) !important;
  border: 1px solid var(--cpAline) !important;
  box-shadow:
    0 18px 54px rgba(0,0,0,.30),
    0 0 22px var(--cpAglow),
    0 0 26px var(--cpAglow2),
    0 0 0 1px rgba(255,255,255,.06) inset !important;
  position: relative;
  overflow: hidden;
}
.cp-box.cp-main::after,
.card.cp-hero.cp-main::after{
  content:"";
  position:absolute;
  inset:-30% -25%;
  background:
    radial-gradient(circle at 18% 18%, rgba(96,165,250,.35), transparent 56%),
    radial-gradient(circle at 78% 30%, rgba(167,139,250,.25), transparent 58%);
  filter: blur(10px);
  opacity:.75;
  pointer-events:none;
}

/* Title + number plates: keep Plan3 readability, but tint them for A案 */
.cp-box.cp-main .cp-title{
  background: linear-gradient(135deg, rgba(96,165,250,.22), rgba(167,139,250,.14));
  border: 1px solid rgba(191,219,254,.18);
  box-shadow: 0 8px 18px rgba(0,0,0,.22), 0 0 14px rgba(96,165,250,.14);
}
.cp-box.cp-main .cp-value{
  background: linear-gradient(135deg, rgba(30,58,138,.55), rgba(88,28,135,.40));
  border: 1px solid rgba(191,219,254,.16);
  box-shadow: 0 12px 32px rgba(0,0,0,.30), 0 0 18px rgba(96,165,250,.16);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  text-shadow: 0 10px 26px rgba(0,0,0,.45);
}

/* Party header (v50_32): total + selected 5 icons */
.card.cp-hero.cp-main.party-top{
  padding: 14px 16px;
}
.card.cp-hero.cp-main.party-top .party-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.card.cp-hero.cp-main.party-top .party-label{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:900;
  opacity:.96;
}
.card.cp-hero.cp-main.party-top .party-label .ico{
  font-size:18px;
}
.card.cp-hero.cp-main.party-top .party-totalwrap{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 7px 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(30,58,138,.60), rgba(88,28,135,.46));
  border: 1px solid rgba(191,219,254,.18);
  box-shadow: 0 12px 34px rgba(0,0,0,.30), 0 0 18px rgba(96,165,250,.16);
}
.card.cp-hero.cp-main.party-top .party-totalwrap .sword{
  font-size: 16px;
  opacity:.92;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.45));
}
.card.cp-hero.cp-main.party-top #partyTotal{
  /* override previous "text-zone plate" styles */
  display:inline;
  padding:0;
  margin:0;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  color:#fff;
  font-size: 34px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  line-height: 1;
  text-shadow: 0 10px 26px rgba(0,0,0,.45);
}

/* Selected 5 icons row */
.card.cp-hero.cp-main.party-top .party-icon-row{
  margin-top: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
}
.party-icon-row .picon{
  width: 58px;
  height: 58px;
  border-radius: 18px;
  overflow:hidden;
  background: rgba(10,14,26,.34);
  border: 1px solid rgba(191,219,254,.14);
  box-shadow: 0 10px 22px rgba(0,0,0,.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  position: relative;
}
.party-icon-row .picon::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius: 18px;
  background: radial-gradient(80px 80px at 20% 20%, rgba(96,165,250,.18), transparent 55%),
              radial-gradient(90px 90px at 80% 70%, rgba(167,139,250,.14), transparent 60%);
  pointer-events:none;
}
.party-icon-row .picon img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}
.party-icon-row .picon.empty{
  display:flex;
  align-items:center;
  justify-content:center;
  color: rgba(255,255,255,.70);
  font-weight:900;
  letter-spacing:.02em;
}
.party-icon-row .picon.empty span{
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(10,14,26,.30);
  border: 1px solid rgba(255,255,255,.10);
}


/* === Zebra transparency for status blocks (v50.33) === */
/* Reference modal: HP + 8 stats cards alternate opacity (stronger zebra) */
.refStatGrid .refStatCard:nth-child(odd){
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.00)),
              rgba(17, 26, 46, 0.72) !important;
}
.refStatGrid .refStatCard:nth-child(even){
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.00)),
              rgba(17, 26, 46, 0.42) !important;
}


/* Stat detail table: alternate row tint (subtle) */
.tablewrap tbody tr:nth-child(odd){
  background: rgba(255,255,255,0.04) !important;
}
.tablewrap tbody tr:nth-child(even){
  background: rgba(255,255,255,0.00) !important;
}
.tablewrap tbody tr:hover{
  background: rgba(255,255,255,0.07) !important;
}


/* === v50.44: Party全体表示（スクショ用）キャラ枠を横に広げてステータスを2段に収める ===
   - 装備欄(右)の幅を抑えて、ステ枠(左)を広げる
   - ステは 4列固定（8枠=2段）に戻す
   - 「腕 504」など横並びを維持しつつ、省略(…)しないよう余計なパディングを削る
*/
.pshot-body{
  grid-template-columns: minmax(0,1fr) clamp(110px, 26vw, 140px) !important;
  gap:8px !important;
}
.pshot-row{
  padding:6px 6px !important;
}
.pshot-scale-wrap{
  margin-left:-8px;
  margin-right:-8px;
}
.pshot-av{
  width:40px !important;
  height:40px !important;
}
.pshot-eq .eqline{
  font-size:9px !important;
}
.pshot-eq .lbl{
  min-width:24px !important;
}

/* stats grid: 4 cols => 2 rows */
.pshot-stats{
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap:4px !important;
}
.pshot-stat{
  overflow:hidden;
  padding:4px 5px !important;
}
.pshot-stat .kv{
  display:flex !important;
  flex-direction:row !important;
  align-items:baseline !important;
  justify-content:space-between !important;
  gap:4px !important;
  min-width:0 !important;
}
.pshot-stat .k,
.pshot-stat .v{
  white-space:nowrap !important;
  overflow:visible !important;
  text-overflow:clip !important;
}

/* pshot内はチップ背景を外して横幅を節約（見やすさは影で担保） */
.pshot-stat .k{
  font-size:9px !important;
  padding:0 !important;
  background: transparent !important;
  color: rgba(229,231,235,.82) !important;
}
.pshot-stat .v{
  font-size:10.5px !important;
  padding:0 !important;
  background: transparent !important;
  font-weight:900 !important;
  font-variant-numeric: tabular-nums;
  letter-spacing:-0.01em;
  color:#fff !important;
}
.pshot-stat .m{ justify-content:center; }




/* === v50.45 Party zebra (2nd & 4th tiles are more transparent) === */
.party-strip .party-tile:nth-child(2),
.party-strip .party-tile:nth-child(4){
  /* override inherited glass variables inside these tiles */
  --glass: rgba(17, 26, 46, 0.34);
  --glass-soft: rgba(17, 26, 46, 0.26);
  --glass-strong: rgba(17, 26, 46, 0.46);
  --glass-line: rgba(255,255,255,0.12);
  --glass-line-soft: rgba(255,255,255,0.08);
  box-shadow: 0 12px 34px rgba(0,0,0,.26) !important;
}


/* v50_47: party zebra — make inner small boxes outline-only for 2nd & 4th tiles */
#partyStrip .party-tile:nth-child(2) .pt-kv,
#partyStrip .party-tile:nth-child(4) .pt-kv,
#partyStrip .party-tile:nth-child(2) .pt-mini,
#partyStrip .party-tile:nth-child(4) .pt-mini,
#partyStrip .party-tile:nth-child(2) .pt-eq,
#partyStrip .party-tile:nth-child(4) .pt-eq,
#partyStrip .party-tile:nth-child(2) .pt-actions,
#partyStrip .party-tile:nth-child(4) .pt-actions{
  background: transparent !important;          /* no fill */
  box-shadow: none !important;
  border-color: rgba(255,255,255,.22) !important;
}
/* keep separators visible but subtle */
#partyStrip .party-tile:nth-child(2) .pt-actions,
#partyStrip .party-tile:nth-child(4) .pt-actions{
  border-top-color: rgba(255,255,255,.16) !important;
}
/* inside: remove any readability plates/chips that may add fill */
#partyStrip .party-tile:nth-child(2) .pt-kv .v,
#partyStrip .party-tile:nth-child(4) .pt-kv .v,
#partyStrip .party-tile:nth-child(2) .pt-mini .v,
#partyStrip .party-tile:nth-child(4) .pt-mini .v{
  background: transparent !important;
}

/* v50.61: cross-app character linkage */
.character-link-panel{
  margin-top:12px;
  padding:12px;
  border:1px solid rgba(37,99,235,.28);
  border-radius:14px;
  background:rgba(239,246,255,.88);
}
.character-link-title{
  font-weight:900;
  color:#1e3a8a;
  margin-bottom:8px;
}
.character-link-state{
  margin-top:8px;
  font-size:12px;
  color:#64748b;
  line-height:1.5;
}
.character-link-state.is-linked{ color:#166534; font-weight:700; }

/* v50.63: status master one-click import */
#btnCharacterLink.link-update-available{
  background:linear-gradient(135deg,#f59e0b,#ea580c);
  border-color:#c2410c;
  box-shadow:0 8px 20px rgba(234,88,12,.22);
}
.character-link-state.is-update{
  color:#b45309;
  font-weight:900;
}


/* v50.72: CP is an overlay for status-master characters */
.master-source-card{border-color:#b7d7ff;background:linear-gradient(180deg,#f8fbff,#eef6ff)}
.master-char-name{font-size:20px;font-weight:900;color:#172033;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.master-readonly-note{margin-top:10px;padding:9px 10px;border-radius:10px;background:#e9f2ff;color:#31547a;font-size:12px;font-weight:700;line-height:1.55}
.master-stat-cell{display:flex;flex-direction:column;gap:2px;font-size:11px;font-weight:800;white-space:nowrap;color:#425466}
.master-summary-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.master-summary-grid>div{display:flex;flex-direction:column;gap:4px;padding:10px;border:1px solid #d8e1ec;border-radius:10px;background:#f8fafc;min-width:0}
.master-summary-grid span{font-size:11px;color:#64748b}.master-summary-grid strong{font-size:14px;color:#172033;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:380px){.master-summary-grid{grid-template-columns:1fr}.master-stat-cell{font-size:10px}}

/* v50.76: compact mobile header (about two-thirds of the former height) */
@media (max-width: 680px) {
  header {
    padding: 6px 8px calc(7px + env(safe-area-inset-top));
  }
  .hdr,
  .hdr-hideable {
    gap: 4px;
  }
  .hdr-top {
    gap: 4px;
  }
  .hdr-brand {
    margin-top: 1px;
    gap: 2px;
  }
  .hdr-main-logo {
    width: min(82vw, 450px);
    max-width: min(82vw, 450px);
    max-height: 32px;
  }
  .switchbtn {
    gap: 5px;
    padding: 5px 9px;
    border-radius: 10px;
  }
  .switchbtn .navsvg {
    width: 15px;
    height: 15px;
  }
  .switchbtn .navtxt {
    font-size: 10.5px;
  }
  .hdr-subtitle-row {
    gap: 5px;
    min-height: 0;
  }
  .hdr-subtitle {
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.05;
    letter-spacing: .10em;
  }
  .hdr-base-inline {
    gap: 5px;
    padding: 4px 7px;
    border-radius: 10px;
    font-size: 10.5px;
  }
  .hdr-base-inline input {
    width: 58px;
    min-width: 58px;
    height: 24px;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 12px;
  }
  .hdr-desc {
    max-width: min(94vw, 680px);
    margin-top: 1px;
    padding: 5px 8px;
    border-radius: 9px;
    font-size: 10.5px;
    line-height: 1.3;
  }
  .cp-toolbar-inner {
    padding: 3px 8px 5px;
  }
  .toolbar {
    gap: 6px;
    padding-bottom: 2px;
  }
  .toolbtn {
    min-width: 58px;
    min-height: 54px;
    padding: 5px 6px;
    gap: 3px;
    border-radius: 11px;
  }
  .toolbtn svg {
    width: 16px;
    height: 16px;
  }
  .toolbtn .txt {
    font-size: 9.5px;
    line-height: 1.05;
  }
  #btnHeaderStones {
    gap: 2px;
  }
  #btnHeaderStones .txt-stones {
    font-size: 8px;
  }
}

/* v50.77: improve master character readability and image-error guidance */
.master-source-card .master-char-name{
  color:#ffffff !important;
  text-shadow:0 2px 4px rgba(0,0,0,.88), 0 0 10px rgba(0,0,0,.55);
  letter-spacing:.01em;
}
.master-source-card .character-link-state.is-linked{
  color:#86efac !important;
  text-shadow:0 1px 3px rgba(0,0,0,.75);
}
.imgbox.image-load-error .ph{
  line-height:1.55;
  color:#fecaca;
  font-weight:800;
  text-align:center;
}
.imgbox.image-load-error .ph small{
  display:block;
  margin-top:5px;
  color:rgba(255,255,255,.72);
  font-size:11px;
  font-weight:600;
}

/* v50.78: make master correction / bonus values easier to read */
.master-stat-cell{
  align-items:center;
  gap:5px;
  min-width:112px;
  font-size:13px !important;
  font-weight:900 !important;
  line-height:1.15;
  color:#fff !important;
}
.master-stat-cell > span{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:100px;
  min-height:24px;
  padding:3px 7px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:8px;
  white-space:nowrap;
  letter-spacing:.01em;
  text-shadow:0 1px 3px rgba(0,0,0,.72);
}
.master-stat-corr{
  color:#7dd3fc !important;
  background:rgba(14,165,233,.14);
  border-color:rgba(125,211,252,.30) !important;
}
.master-stat-bonus{
  color:#fde68a !important;
  background:rgba(234,179,8,.13);
  border-color:rgba(253,230,138,.30) !important;
}
@media(max-width:420px){
  .master-stat-cell{
    min-width:106px;
    font-size:12.5px !important;
  }
  .master-stat-cell > span{
    min-width:96px;
    min-height:23px;
    padding:3px 6px;
  }
}
