/**
 * modal.css - スマホのボトムシート操作にも対応した柔らかいライトテーマモーダル
 */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(32, 26, 18, 0.42);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 8px;
  z-index: 40;
}

@media (min-width: 560px) {
  .modal-backdrop {
    align-items: center;
    padding: 16px;
  }
}

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px 20px 14px 14px;
  padding: 12px 14px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: var(--shadow-modal);
}

@media (max-width: 559px) {
  .modal-card::before {
    content: '';
    align-self: center;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
    margin-bottom: -2px;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.04rem;
  color: var(--text-main);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field select,
.form-field input[type="number"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 9px;
  min-height: 38px;
  font-size: 0.86rem;
  color: var(--text-main);
  text-overflow: ellipsis;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 2px;
  font-size: 0.82rem;
  font-weight: 500;
}

.toggle-row input[type="checkbox"] {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  accent-color: var(--accent-primary);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 2px;
}

.modal-actions .btn {
  flex: 1;
  min-height: 42px;
}

.kifu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kifu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.kifu-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  font-weight: 600;
}

.kifu-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.srs-rating-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.srs-rating-row .btn {
  min-height: 42px;
}
