* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7f5;
  color: #222;
  min-height: 100vh;
}

/* ヘッダー */
header {
  background: #2e7d32;
  color: #fff;
  padding: 16px 20px;
  text-align: center;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
}

header .subtitle {
  font-size: 0.8rem;
  margin-top: 2px;
  opacity: 0.85;
}

/* メイン */
main {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 12px 60px;
}

/* 部屋追加エリア */
.add-room-section {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  font-size: 0.95rem;
}

.input-row input:focus {
  outline: none;
  border-color: #2e7d32;
}

.input-row button,
button#addRoomBtn {
  background: #2e7d32;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.input-row button:hover {
  background: #1b5e20;
}

/* 部屋カード */
.room-card {
  background: #fff;
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #e8f5e9;
  border-bottom: 1px solid #c8e6c9;
}

.room-name {
  font-size: 1rem;
  font-weight: 700;
  color: #1b5e20;
}

.room-actions {
  display: flex;
  gap: 8px;
}

.btn-add-measure {
  background: #2e7d32;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-add-measure:hover {
  background: #1b5e20;
}

.btn-delete-room {
  background: none;
  color: #b71c1c;
  border: 1.5px solid #ef9a9a;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-delete-room:hover {
  background: #ffebee;
}

/* 採寸テーブル */
.measure-table-wrap {
  padding: 12px 16px;
}

.empty-msg {
  text-align: center;
  color: #999;
  font-size: 0.85rem;
  padding: 12px 0;
}

.measure-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.measure-table th {
  background: #f1f8e9;
  color: #2e7d32;
  text-align: left;
  padding: 7px 8px;
  font-weight: 600;
  border-bottom: 1.5px solid #c8e6c9;
}

.measure-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}

.measure-table tr:last-child td {
  border-bottom: none;
}

.btn-del-measure {
  background: none;
  border: none;
  color: #e53935;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
}

.btn-del-measure:hover {
  color: #b71c1c;
}

/* モーダル */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 12px;
  width: 92%;
  max-width: 420px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
}

.hidden {
  display: none !important;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #eee;
}

.modal-header h2 {
  font-size: 1rem;
  color: #1b5e20;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #888;
  padding: 2px 6px;
}

.modal-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-body label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
}

.required {
  color: #e53935;
  margin-left: 2px;
}

.modal-body input[type="text"],
.modal-body input[type="number"] {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid #ccc;
  border-radius: 7px;
  font-size: 0.93rem;
}

.modal-body input:focus {
  outline: none;
  border-color: #2e7d32;
}

.size-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.size-grid label {
  display: block;
  margin-bottom: 4px;
}

.save-btn {
  background: #2e7d32;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 4px;
}

.save-btn:hover {
  background: #1b5e20;
}

/* 空状態 */
.no-room-msg {
  text-align: center;
  color: #aaa;
  margin-top: 40px;
  font-size: 0.9rem;
  line-height: 1.8;
}

@media (max-width: 400px) {
  .size-grid {
    grid-template-columns: 1fr 1fr;
  }

  .measure-table {
    font-size: 0.8rem;
  }

  .measure-table th,
  .measure-table td {
    padding: 6px 5px;
  }
}
