[hidden]{
  display:none !important;
}

.hero-top-block,
.hero-grid,
.mode-panels,
.enemy-picker,
.action-section,
.result-section{
  width:100%;
  max-width:720px;
}

.hero-top-block{
  margin-bottom:14px;
}

.hero-top-row,
.mode-row,
.enemy-row{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:8px;
}

.hero-row{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:8px;
  min-width:0;
}

/* ステータス行だけ横並び固定 */
.hero-stat-row{
  display:flex !important;
  flex-direction:row !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:4px !important;
  min-width:0;
}

/* ラベルは文字幅ぴったり */
.hero-stat-row .hero-label{
  flex:0 0 auto !important;
  width:auto !important;
  min-width:0 !important;
  margin:0 !important;
  white-space:nowrap;
}

/* 入力欄は残り幅 */
.hero-stat-row input{
  flex:1 1 auto !important;
  width:auto !important;
  min-width:0 !important;
  margin:0 !important;
}

/* 長いラベルだけ少しだけ文字サイズを下げる */
#analysis-book-advanced-row .hero-label{
  font-size:14px;
}

#analysis-book-row,
#analysis-book-advanced-row{
  grid-column:1 / -1;
}

.hero-top-row + .hero-top-row,
.mode-panel + .mode-panel{
  margin-top:12px;
}

.hero-top-label,
.mode-label,
.enemy-label,
.hero-label{
  font-weight:700;
  white-space:nowrap;
}

.hero-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}

.hero-row input,
#monster-search,
#detail-monster-search,
.lv-input{
  width:100%;
  min-width:0;
  box-sizing:border-box;
  font-size:16px;
}

.hero-row input{
  padding:10px 8px;
  border:none;
  outline:none;
  background:transparent;
  border-bottom:1px solid #000;
  border-radius:0;
}

.mode-panels{
  margin-top:16px;
}

.enemy-section{
  margin-top:22px;
}

.enemy-input-wrap{
  position:relative;
  flex:1;
  min-width:0;
}

#monster-search,
#detail-monster-search{
  padding:10px;
  border:1px solid #000;
  border-radius:10px;
}

.suggest{
  position:absolute;
  left:0;
  right:0;
  top:calc(100% + 6px);
  border:1px solid #000;
  border-radius:10px;
  background:#fff;
  overflow:hidden;
  max-height:260px;
  overflow-y:auto;
  z-index:20;
}

.suggest button{
  display:block;
  width:100%;
  text-align:left;
  padding:10px 12px;
  border:none;
  background:transparent;
  font-size:16px;
}

.suggest button:active{
  background:rgba(0,0,0,0.06);
}

.enemy-selected{
  margin-top:10px;
}

.mt{
  margin-top:12px;
}

.lv-shortcuts{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.lv-shortcuts button{
  padding:8px 10px;
  border:1px solid #000;
  background:#fff;
  border-radius:10px;
  font-size:14px;
}

.lv-input{
  padding:10px;
  border:1px solid #000;
  border-radius:10px;
}

.action-section{
  margin-top:16px;
}

.action-row{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
  align-items:stretch;
}

#calc-btn,
.side-toggle{
  width:100%;
  padding:12px 14px;
  border:1px solid #000;
  border-radius:12px;
  background:#fff;
  font-size:16px;
  box-sizing:border-box;
}

#calc-btn:disabled{
  opacity:.35;
  background:#eee;
}

#calc-btn:not(:disabled){
  box-shadow:0 0 0 2px #000 inset;
}

#calc-btn:active:not(:disabled){
  transform:scale(0.99);
}

.side-toggle[aria-pressed="true"]{
  background:rgba(0,0,0,0.08);
  box-shadow:0 0 0 2px #000 inset;
}

.result-section{
  margin-top:20px;
}

.result-block{
  border:1px solid #000;
  border-radius:14px;
  padding:9px;
  margin-top:9px;
}

.result-title{
  font-weight:700;
  margin-bottom:6px;
}

.result-row{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:4px 0;
}

.result-label{
  font-weight:600;
  white-space:nowrap;
}

.result-value{
  text-align:left;
  word-break:break-word;
}

.muted{
  opacity:.7;
}

@media (min-width: 700px){
  .hero-top-row,
  .mode-row,
  .enemy-row{
    flex-direction:row;
    align-items:center;
    gap:10px;
  }

  .hero-top-label{
    min-width:56px;
    line-height:40px;
  }

  .mode-label{
    min-width:78px;
    line-height:40px;
  }

  .enemy-label{
    min-width:56px;
  }

  .hero-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .result-row{
    flex-direction:row;
    justify-content:space-between;
    align-items:flex-start;
    gap:12px;
  }

  .result-value{
    flex:1;
    text-align:right;
  }
}

@media (min-width: 980px){
  .hero-top-block,
  .hero-grid,
  .mode-panels{
    max-width:960px;
  }

  .hero-grid{
    grid-template-columns:repeat(3, minmax(0, 1fr));
  }

  #analysis-book-row,
  #analysis-book-advanced-row{
    grid-column:span 2;
  }

  .action-row{
    grid-template-columns:minmax(0, 1fr) auto;
  }

  .side-toggle{
    width:auto;
    white-space:nowrap;
    font-size:14px;
  }
}

/* 詳細計算機の入力欄を統合計算機に合わせる */
.detail-stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.detail-enemy-stat-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.detail-base-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 16px;
  padding: 10px 8px;
  border: none;
  outline: none;
  background: transparent;
  border-bottom: 1px solid #000;
  border-radius: 0;
}

.scaled-value {
  font-size: 13px;
  color: #666;
  white-space: nowrap;
}

.stat-grid-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  color: #888;
}

/* 闘晶立方体行：常に横並び */
.mode-row:has(#toushou-count),
.mode-row:has(#detail-toushou-count) {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 4px !important;
}

/* 闘晶立方体入力欄：下線式 */
#toushou-count,
#detail-toushou-count {
  flex: 1;
  padding: 10px 8px;
  border: none;
  outline: none;
  background: transparent;
  border-bottom: 1px solid #000;
  border-radius: 0;
  font-size: 16px;
  min-width: 0;
  box-sizing: border-box;
}

/* リセットボタン（計算ボタンの下・右寄せ・控えめ） */
.reset-row{
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.reset-btn{
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid rgba(0,0,0,0.35);
  border-radius: 10px;
  background: #fff;
  color: rgba(0,0,0,0.65);
  cursor: pointer;
}
.reset-btn:active{
  background: rgba(0,0,0,0.06);
}
