/* ==============================================
   第2問ドリル – 勘定記入・補助簿記入
   dai2mon-drill.css  v1.00
   ============================================== */

/* ---- 全体ラッパー ---- */
.d2-wrap {
  max-width: 1000px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
               "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.8;
  color: #222;
}

/* ---- イントロ説明 ---- */
.d2-intro {
  margin-bottom: 20px;
}
.d2-intro p {
  margin: 0 0 6px;
}

/* ---- セクション見出し ---- */
.d2-section-head {
  margin: 0 0 10px;
  padding: 7px 14px 5px;
  background: #eef6fa;
  border: 1px solid #d6edf6;
  font-weight: 700;
  font-size: 1.05rem;
}

/* ---- 取引リスト ---- */
.d2-txn-list {
  padding-left: 1.6em;
  margin: 0 0 24px;
  line-height: 1.9;
}
.d2-txn-list li {
  margin-bottom: 5px;
}

/* ======================================================
   T 字形勘定
   ====================================================== */

/* 複数勘定をまとめるグループ */
.d2-account-group {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

/* 1 つの勘定ブロック */
.d2-account {
  flex: 1 1 420px;
  min-width: 300px;
}

/* 勘定名バー */
.d2-acct-name-bar {
  text-align: center;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.2em;
  padding: 6px 0;
  background: #f5f5f5;
  border: 2px solid #333;
  border-bottom: none;
}

/* T 字形コンテナ（借方 + 貸方） */
.d2-taccount-outer {
  display: flex;
  border: 2px solid #333;
}

/* 借方・貸方 各半分 */
.d2-half {
  flex: 1 1 0;
  min-width: 0;
  overflow-x: auto;
}
.d2-debit-side {
  border-right: 2px solid #333;
}

/* 各サイドのテーブル */
.d2-side-tbl {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* ヘッダー行 */
.d2-side-tbl thead th {
  background: #f0f0f0;
  border-bottom: 1px solid #888;
  padding: 5px 6px;
  text-align: center;
  font-weight: 700;
  white-space: nowrap;
}
.d2-side-tbl thead tr:first-child th {
  font-size: 1rem;
  padding: 7px 6px;
  border-bottom: 1px solid #555;
  letter-spacing: 0.15em;
}
.d2-side-tbl thead tr:last-child th {
  font-size: 0.88rem;
  color: #444;
}

/* データ行 */
.d2-side-tbl tbody tr {
  height: 44px;  /* 入力行・テキスト行の高さを統一 */
}
.d2-side-tbl tbody td {
  padding: 4px 7px;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: middle;
}

/* 列幅 */
.d2-th-date, .d2-date {
  width: 2.8em;
  text-align: center;
  white-space: nowrap;
}
.d2-th-acct {
  /* flexible */
}
.d2-th-amt, .d2-amt {
  width: 7.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.d2-amt .num,
.d2-amt.num {
  text-align: right;
}

/* 合計行 */
.d2-total-row td,
.d2-side-tbl tfoot td {
  border-top: 2px solid #444 !important;
  border-bottom: 2px solid #444 !important;
  font-weight: 700;
  background: #fafafa;
  height: 44px;
  padding: 4px 7px;
  vertical-align: middle;
}

/* ======================================================
   単一テーブル型 T 字形勘定（借貸の行を完全同期）
   ====================================================== */
.d2-unified-tbl {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 2px solid #333;
}
.d2-unified-tbl thead th {
  background: #f0f0f0;
  border-bottom: 1px solid #888;
  padding: 5px 6px;
  text-align: center;
  font-weight: 700;
  white-space: nowrap;
}
.d2-unified-tbl thead tr:first-child th {
  font-size: 1rem;
  padding: 7px 6px;
  border-bottom: 1px solid #555;
  letter-spacing: 0.15em;
}
.d2-unified-tbl thead tr:last-child th {
  font-size: 0.88rem;
  color: #444;
}
/* 借方・貸方の境界線（縦の T 字線） */
.d2-unified-tbl .d2-divider {
  border-right: 2px solid #333 !important;
}
/* データ行・合計行の高さを統一 */
.d2-unified-tbl tbody tr,
.d2-unified-tbl tfoot tr {
  height: 44px;
}
.d2-unified-tbl tbody td {
  padding: 4px 7px;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: middle;
}
.d2-unified-tbl tfoot td {
  padding: 4px 7px;
  border-top: 2px solid #444 !important;
  border-bottom: 2px solid #444 !important;
  font-weight: 700;
  background: #fafafa;
  vertical-align: middle;
}

/* ======================================================
   補助簿テーブル（現金出納帳など）
   ====================================================== */
.d2-book-section {
  margin-bottom: 24px;
}
.d2-book-tbl {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid #444;
  table-layout: auto;
}
.d2-book-tbl th {
  background: #f0f0f0;
  border: 1px solid #888;
  padding: 7px 8px;
  text-align: center;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
}
.d2-book-tbl td {
  border: 1px solid #ccc;
  padding: 7px 8px;
  vertical-align: middle;
}
.d2-book-tbl tr:last-child td {
  border-bottom: 2px solid #444;
}
.d2-book-tbl .d2-b-date {
  text-align: center;
  white-space: nowrap;
  width: 3.2em;
}
.d2-book-tbl .d2-b-desc {
  min-width: 8em;
}
.d2-book-tbl .d2-b-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 7.2em;
  white-space: nowrap;
}

/* ======================================================
   入力フィールド
   ====================================================== */
.d2-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 3px 6px;
  border: 1px solid #b3b3b3;
  border-radius: 2px;
  background: #fffef0;
  font-size: 0.95rem;
  font-family: inherit;
}
.d2-money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.d2-text {
  text-align: center;
  letter-spacing: 0.05em;
}

/* 採点カラー */
.d2-ok {
  background: #eefbea !important;
  border-color: #6fbf73 !important;
}
.d2-ng {
  background: #fff2f2 !important;
  border-color: #d66 !important;
}

/* ======================================================
   ボタン・タイマー
   ====================================================== */
.d2-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 20px;
}
.d2-btn {
  padding: 8px 18px;
  border: 1px solid #666;
  background: #f7f7f7;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  border-radius: 2px;
}
.d2-btn:hover {
  background: #e8e8e8;
}
.d2-timer {
  font-weight: 700;
  font-size: 0.95rem;
  margin-left: 4px;
}

/* ======================================================
   レスポンシブ
   ====================================================== */
@media (max-width: 680px) {
  .d2-taccount-outer {
    flex-direction: column;
  }
  .d2-debit-side {
    border-right: none;
    border-bottom: 2px solid #333;
  }
  .d2-account-group {
    flex-direction: column;
  }
  .d2-book-tbl {
    font-size: 0.85rem;
  }
}
