@charset "utf-8";

/* // 作成レギュレーション
---------------------------------------------------------------------------------------------------- */
/* 列は「作成方式｜初期IP｜初期所持金｜成長（残りの幅）」の4つ */
#regulation > dl {
  grid-template-columns: max-content max-content max-content 1fr;
  input[type="number"] { width: 6.5em; text-align: center; }
  select { font-size: 1rem; }
  dd.grow input { width: 100%; box-sizing: border-box; margin-inline: 0; }
  @media screen and (width <= 735px){
    grid-template-columns: 1fr 1fr;
    & dt { grid-row: auto; }
    & dd { grid-row: auto; }
  }
}

/* // 基本情報・能力値
---------------------------------------------------------------------------------------------------- */
#area-status {
  min-height: 0%;
  margin: var(--box-v-gap) 0;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas:
    "PRF PRF IMG"
    "DRV DRV IMG"
    "STT STT IMG"
  ;
}
@media screen and (width <= 735px){
  #area-status {
    grid-template-columns: 1fr;
    grid-template-areas:
      "IMG"
      "PRF"
      "DRV"
      "STT"
    ;
  }
}
#profile {
  grid-area: PRF;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  input, select {
    width: 100%;
  }
}
#derived {
  grid-area: DRV;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  input {
    width: 100%;
  }
  @media screen and (width <= 735px){
    grid-template-columns: repeat(2, 1fr);
    #ip {
      grid-column: span 2;
    }
  }
}
.role-only-medtech input[readonly] {
  background-color: var(--box-head-bg-color);
  color: var(--base-font-color);
  cursor: not-allowed;
  opacity: 0.85;
}
#lifestyle-and-money {
  margin: var(--box-v-gap) 0;
}
#lifestyle-money-table {
  width: 100%;
  td input[type="text"] { width: 100%; }
  td.money, td.deposit {
    white-space: nowrap;
    text-align: center;
    label.check-button { margin-right: .3em; }
    input[type="text"] { width: 6em; text-align: right; }
  }
}
#status {
  grid-area: STT;
  .status-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--box-h-gap);
  }
  .status-table {
    width: 100%;
    th.name {
      text-align: left;
      padding-left: .5em;
      white-space: nowrap;
    }
    td.base, td.add, td.total {
      text-align: center;
    }
    td.total {
      font-weight: bold;
      font-size: 110%;
    }
    input[type="number"] {
      width: 3.5em;
      text-align: center;
    }
  }
  .status-footer {
    margin-top: .5em;
    padding: 0 .3em;
  }
  .status-total-row {
    font-weight: bold;
    margin: .3em 0;
  }
}
@media screen and (width <= 735px){
  #status .status-columns {
    grid-template-columns: 1fr;
    gap: var(--box-v-gap);
  }
}
#derived {
  grid-area: DRV;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  input {
    width: 4em;
    text-align: center;
  }
}
@media screen and (width <= 735px){
  #profile,
  #derived {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* // 技能
---------------------------------------------------------------------------------------------------- */
#skills {
  summary #skill-search {
    margin-left: 1.5em;
    font-size: .85rem;
    font-weight: normal;
    padding: .2em .6em;
    width: 14em;
    max-width: 50%;
    vertical-align: middle;
  }
  .skill-point-panel {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--box-border-color, #444);
    border-radius: 6px;
    padding: .8em 1em;
    margin: .8em 0;

    .panel-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: .5em;
    }
    .panel-title {
      font-weight: bold;
      font-size: 1.05em;
      color: var(--box-headline-color, #fff);
    }
    .status-badge {
      display: inline-block;
      padding: .2em .7em;
      border-radius: 4px;
      font-size: .85em;
      font-weight: bold;
      white-space: nowrap;

      &.status-ok {
        background: #1b5e20;
        color: #a5d6a7;
        border: 1px solid #2e7d32;
      }
      &.status-remain {
        background: #01579b;
        color: #81d4fa;
        border: 1px solid #0288d1;
      }
      &.status-over {
        background: #b71c1c;
        color: #ffcdd2;
        border: 1px solid #d32f2f;
      }
    }
    .point-meter {
      font-size: 1.05em;
      margin-bottom: .4em;
      b { font-size: 1.25em; }
    }
    .point-rest-wrap {
      margin-left: .5em;
      font-size: .95em;
      opacity: .9;
    }
    .meter-bar-container {
      width: 100%;
      height: 7px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 4px;
      overflow: hidden;
      margin-bottom: .6em;
    }
    .meter-bar {
      height: 100%;
      background: linear-gradient(90deg, #0288d1, #2e7d32);
      transition: width .2s ease;

      &.over {
        background: #d32f2f;
      }
    }
    .validation-alerts {
      font-size: .88em;
      .alert-item {
        padding: .35em .6em;
        border-radius: 4px;
        margin-top: .35em;
        line-height: 1.4;
      }
      .alert-warning {
        background: rgba(230, 81, 0, 0.18);
        color: #ffb74d;
        border-left: 3px solid #ff9800;
      }
      .alert-danger {
        background: rgba(183, 28, 28, 0.18);
        color: #ef9a9a;
        border-left: 3px solid #f44336;
      }
      .alert-success {
        background: rgba(27, 94, 32, 0.18);
        color: #a5d6a7;
        border-left: 3px solid #4caf50;
      }
      .alert-info {
        background: rgba(1, 87, 155, 0.18);
        color: #81d4fa;
        border-left: 3px solid #03a9f4;
      }
    }
    .panel-actions {
      display: flex;
      gap: .6em;
      flex-wrap: wrap;
      margin-top: .6em;
    }
    .assist-btn {
      font-size: .82rem;
      padding: .35em .8em;
      background: rgba(255, 255, 255, 0.08);
      color: var(--text-color, #eee);
      border: 1px solid var(--box-border-color, #555);
      border-radius: 4px;
      cursor: pointer;
      transition: background .15s ease, border-color .15s ease;

      &:hover {
        background: rgba(255, 255, 255, 0.16);
        border-color: #888;
      }
      &.secondary {
        opacity: .75;
        &:hover { opacity: 1; }
      }
    }
  }

  /* 入力欄ハイライト */
  input.warning-base {
    border-color: #ff9800 !important;
    box-shadow: 0 0 3px rgba(255, 152, 0, 0.6) !important;
    background-color: rgba(255, 152, 0, 0.1) !important;
  }
  input.error-max {
    border-color: #f44336 !important;
    box-shadow: 0 0 3px rgba(244, 67, 54, 0.7) !important;
    background-color: rgba(244, 67, 54, 0.15) !important;
  }

  .skill-table {
    width: 100%;
    table-layout: fixed;
    margin-bottom: .5em;
    thead th { white-space: nowrap; }
    th.name { text-align: left; }
    th.stat, td.stat { width: 3.8em; text-align: center; white-space: nowrap; }
    th.lv, td.lv     { width: 3.8em; text-align: center; }
    th.add, td.add   { width: 3.8em; text-align: center; }
    th.grow, td.grow { width: 2.8em; text-align: center; }
    th.base, td.base { width: 2.8em; text-align: center; }
    th.total, td.total { width: 3.2em; text-align: center; font-weight: bold; }
    input[type="number"] {
      width: 100%;
      max-width: 3.2em;
      text-align: center;
      box-sizing: border-box;
    }
    td.name input {
      width: calc(100% - 2em);
    }
    tbody.specialty th.name .add-del-button {
      display: inline-flex;
      margin-left: .5em;
    }
  }
}
#base-skills-area {
  margin-bottom: var(--box-v-gap);
  h3 {
    margin: .8em 0 .4em;
    font-size: 1.05em;
  }
  #base-skill-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--box-h-gap);
  }
}
@media screen and (width <= 735px){
  #base-skills-area #base-skill-columns {
    grid-template-columns: 1fr;
    gap: var(--box-v-gap);
  }
}
#general-skills-area {
  h3 {
    margin: .8em 0 .4em;
    font-size: 1.05em;
  }
}
#skill-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--box-h-gap);
}
@media screen and (width <= 735px){
  #skill-columns {
    grid-template-columns: 1fr;
    gap: var(--box-v-gap);
  }
}

/* // ロール
---------------------------------------------------------------------------------------------------- */
#role-table {
  width: 100%;
  td.name select { width: 100%; }
  td.ability { white-space: nowrap; padding: 0 .5em; text-align: center; }
  td.note input { width: 100%; }
  td.rank input { width: 4em; text-align: center; }
  td.grow, td.rank-total { text-align: center; }
}
#roles .role-detail {
  margin-top: .8em;
  > dl {
    display: grid;
    grid-template-columns: max-content 6em max-content 6em;
    gap: .2em .5em;
    align-items: center;
    @media screen and (width <= 735px){
      grid-template-columns: max-content 6em;
    }
  }
  input { width: 100%; }
}

/* // 装備
---------------------------------------------------------------------------------------------------- */
#weapon-table,
#armor-table,
#shield-table,
#cyberware-table,
#program-table,
#item-table {
  width: 100%;
  input[type="text"]:not([name$="Note"]) { width: 100%; }
  input[type="number"] { width: 4em; text-align: center; }
  td.note input { width: 100%; }
  td.total { text-align: center; font-weight: bold; }
}
#weapon-table td.name { min-width: 10em; }
#weapon-table td.skill { min-width: 8em; }
#weapon-table td.acc input { width: 3.5em; }
#weapon-table td.total { min-width: 3.5em; }
#weapon-table td.damage input { width: 5em; }
#weapon-table td.mag input,
#weapon-table td.rof input { width: 3.5em; }
#weapon-table td.ammo select { width: 7.5em; }
#weapon-table td.type select { width: 10em; }
#weapon-table td.sub select { width: 7em; }
#weapon-table input[readonly] { background: transparent; border-color: transparent; }
#weapon-table td.weapon-options {
  > span { margin-right: 1em; white-space: nowrap; }
  select { width: auto; margin-left: 0.3em; }
  /* アタッチメントは6つ並ぶので、まとまりの中では折り返す（折り返さないと表が本体の幅を越える） */
  > span.attachments { white-space: normal; }
  .attachments .att { margin-right: 0.4em; white-space: nowrap; display: inline-block; }
  .slots.error { color: #c00; font-weight: bold; }
  input[name$="Note"] { width: 100%; margin-top: 0.2em; }
}
#shield-table { margin-top: 1em; }
#cyberware-table {
  td.name      { min-width: 10em; }
  td.type      { width: 8.5em; }
  td.place     { width: 7.5em; }
  td.loss      { width: 6.5em; }
  td.cap       { width: 7.5em; }
  td.installed { width: 3.5em; text-align: center; }
  td.note      { width: auto; }

  td.loss input { width: 100%; text-align: center; }
  td.cap select { width: 100%; }
}
#cyberdeck-info {
  margin-bottom: 0.8em;
  p { margin: 0.3em 0; }
  input[name="cyberdeckName"] { width: 14em; }
  input[name="cyberdeckSlots"] { width: 4.5em; text-align: center; }
  input[name="cyberdeckNote"] { width: 28em; max-width: 100%; }
  #cyberdeck-slots-display {
    display: inline-block;
    padding: 0.1em 0.5em;
    background: #eef2f7;
    border-radius: 3px;
    &.over {
      background: #fde8e8;
      color: #c00;
      font-weight: bold;
    }
  }
}
#program-table {
  td.name  { min-width: 9em; }
  td.class { width: 10em; }
  td.slots { width: 4.2em; }
  td.per,
  td.spd,
  td.atk,
  td.def,
  td.rez   { width: 3.5em; text-align: center; input { text-align: center; } }
}
#item-table td.qty { width: 5em; text-align: center; }
#item-table td.qty input { width: 4em; text-align: center; }

/* // セッション履歴・収支履歴
---------------------------------------------------------------------------------------------------- */
#history-table {
  width: 100%;
  td.date input { width: 8em; }
  td.ip input,
  td.money input { width: 6em; text-align: center; }
  td.grow input { width: 100%; min-width: 8em; }
  td.title input,
  td.gm input,
  td.member input,
  td.left input { width: 100%; }
}
/* 弾薬の入力欄（作成時設定とセッション履歴の各行） */
.ammo-inputs .ammo-io {
  display: inline-block;
  margin-right: 1.2em;
  white-space: nowrap;
  .ammo-name { margin-right: 0.4em; font-weight: bold; }
  input { width: 4.5em; margin: 0 0.4em 0 0.2em; text-align: center; }
}
/* 履歴の td.left input { width: 100% } より強く指定する */
#history-table .ammo-inputs .ammo-io input,
#regulation .ammo-inputs .ammo-io input { width: 4.5em; }
.ammo-cell .ammo-label { margin-right: 0.8em; color: var(--txt-shadow-color, #888); }
.ammo-cost { font-size: 0.9em; }
#history-ammo-total .error { color: #c00; font-weight: bold; }
#ammo-extra {
  margin: 0.5em 0 0.2em;
  .label { margin-right: 0.6em; font-weight: bold; }
  .ammo-extra-chip {
    display: inline-block;
    margin-right: 0.6em;
    padding: 0 0.2em 0 0.5em;
    border: 1px solid var(--border-color, #aaa);
    border-radius: 3px;
    button { margin-left: 0.3em; padding: 0 0.3em; }
  }
  select { display: inline-block; width: auto; margin-right: 0.3em; }
  button { width: auto; }
}
#cashbook textarea,
#cashbook-others textarea {
  width: 100%;
  min-height: 6em;
}
#money input[name="money"],
#money input[name="deposit"] {
  width: calc(100% - 2em);
}
#ip-footer {
  text-align: right;
}

/* // テキスト欄
---------------------------------------------------------------------------------------------------- */
#lifepath textarea,
#injuries textarea {
  width: 100%;
  min-height: 8em;
}
