/* ─── カラーパレット（ウォームブラウン×クリーム） ─── */
:root {
  --bg:           #f5f0e8;
  --card:         #ffffff;
  --header-bg:    #8a7055;
  --accent:       #9e8e78;
  --accent-dark:  #7a6248;
  --accent-light: #d5c9b5;
  --text:         #3a3020;
  --text-light:   #8a7e6e;
  --border:       #e0d5c3;
  --premium:      #faf6f0;
  --danger:       #c25656;
  --taken:        #b8b0a5;
  --closed:       #ece7de;
}

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

body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding: 0 0 32px;
}

#app { max-width: 480px; margin: 0 auto; }

.screen { animation: fadeIn 0.3s ease; }
.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── ヘッダー（全幅バナー） ─── */
.header {
  background: var(--header-bg);
  text-align: center;
  padding: 16px 20px 22px;
  margin-bottom: 0;
}
.header-back-row {
  text-align: left;
  margin-bottom: 6px;
}
.btn-header-back {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  font-weight: bold;
  padding: 4px 2px;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.btn-header-back:active { opacity: 0.6; }
.header h1 {
  font-size: 24px;
  color: #ffffff;
  font-weight: bold;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.header-title-main {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.header-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
  line-height: 1;
}
.subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.08em;
}
/* ヘッダー下の区切り線（ゴールド） */
.header::after {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  background: rgba(255,255,255,0.4);
  margin: 12px auto 0;
  border-radius: 2px;
}

/* ─── コンテンツ余白 ─── */
.content-pad {
  padding: 20px 16px 0;
}

/* ─── カード ─── */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  margin: 16px 16px 0;
}
.card h2 {
  font-size: 16px;
  color: var(--text);
  font-weight: bold;
  margin-bottom: 4px;
}
.card .card-sub {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 14px;
}

/* ─── 案内リスト ─── */
.info-list { list-style: none; padding: 0; margin: 4px 0; }
.info-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
}
.info-list li:last-child { margin-bottom: 0; }

.note {
  font-size: 13px;
  color: var(--text-light);
  margin: 16px 0 20px;
  text-align: center;
  padding: 10px;
  background: var(--premium);
  border-radius: 10px;
  border: 1px dashed var(--border);
}

/* ─── ボタン ─── */
.btn-primary, .btn-secondary {
  display: block;
  width: calc(100% - 32px);
  margin: 16px 16px 0;
  padding: 15px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  font-family: inherit;
  letter-spacing: 0.04em;
}
/* カード内のボタンは幅100% */
.card .btn-primary, .card .btn-secondary {
  width: 100%;
  margin: 12px 0 0;
}
.btn-primary  { background: var(--header-bg); color: #ffffff; }
.btn-primary:active  { transform: scale(0.98); opacity: 0.85; }
.btn-primary:disabled { background: var(--accent-light); cursor: not-allowed; opacity: 0.6; }
.btn-secondary { background: transparent; color: var(--accent-dark); border: 1.5px solid var(--accent-light); }
.btn-secondary:active { background: var(--premium); }

/* ─── 週ナビ ─── */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 16px 10px;
  gap: 8px;
}
.week-label {
  font-size: 14px;
  font-weight: bold;
  color: var(--accent-dark);
  text-align: center;
  flex: 1;
}
.btn-week {
  background: var(--card);
  border: 1px solid var(--accent-light);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--accent-dark);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.btn-week:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-week:not(:disabled):active { background: var(--premium); }

/* ─── カレンダー ─── */
.calendar-wrap {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin: 0 16px;
}

.cal-header, .cal-row {
  display: grid;
  grid-template-columns: 42px repeat(7, 1fr);
}
.cal-header {
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.cal-time-col {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-light);
  padding: 4px 2px;
  border-right: 1px solid var(--border);
}
.cal-day-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 2px;
  border-right: 1px solid rgba(255,255,255,0.15);
}
.cal-day-col:last-child { border-right: none; }
.cal-day-col.cal-today { background: rgba(255,255,255,0.15); }
.cal-day-num  { font-size: 10px; color: rgba(255,255,255,0.8); line-height: 1.2; }
.cal-day-name { font-size: 13px; font-weight: bold; color: #ffffff; line-height: 1.2; }
.cal-row { border-bottom: 1px solid var(--border); }
.cal-row:last-child { border-bottom: none; }
.cal-row .cal-time-col { font-size: 10px; color: var(--text-light); background: var(--premium); }
.cal-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 2px;
  font-size: 15px;
  font-weight: bold;
  border-right: 1px solid var(--border);
  min-height: 44px;
}
.cal-cell:last-child { border-right: none; }
.cal-available { color: var(--accent-dark); cursor: pointer; background: var(--card); transition: background 0.15s; }
.cal-available:active { background: var(--premium); transform: scale(0.95); }
.cal-taken    { color: var(--taken); cursor: not-allowed; background: var(--bg); }
.cal-closed   { color: var(--closed); background: var(--closed); font-size: 10px; }
.empty-slots  { text-align: center; padding: 20px; color: var(--text-light); font-size: 14px; }

/* ─── フォーム ─── */
.form-note {
  font-size: 13px;
  color: var(--text-light);
  text-align: center;
  margin: 0 16px 4px;
  padding: 10px;
  background: var(--premium);
  border-radius: 10px;
  border: 1px dashed var(--border);
}

.field { display: block; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > span {
  display: block;
  font-size: 14px;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 6px;
}
.field em {
  font-style: normal;
  color: var(--danger);
  font-size: 11px;
  margin-left: 4px;
  font-weight: normal;
}
.field-hint {
  display: block;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a6248' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}
.field textarea { resize: vertical; min-height: 72px; }

/* ─── ラジオボタン ─── */
.radio-group { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.radio-label {
  display: flex;
  align-items: center;
  font-size: 15px;
  cursor: pointer;
  padding: 11px 14px 11px 44px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.radio-label input[type="radio"] { display: none; }
.radio-label::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--accent-light);
  border-radius: 4px;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
}
.radio-label:has(input:checked) {
  border-color: var(--accent-dark);
  background: var(--premium);
}
.radio-label:has(input:checked)::before {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}
.radio-label:has(input:checked)::after {
  content: '✓';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
}

/* ─── 確認画面 ─── */
.confirm-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.confirm-row:last-child { border-bottom: none; }
.confirm-label { color: var(--text-light); white-space: nowrap; min-width: 80px; font-size: 13px; }
.confirm-row span:last-child { text-align: right; word-break: break-all; }

/* ─── 完了画面 ─── */
.done-message {
  font-size: 18px;
  text-align: center;
  color: var(--accent-dark);
  font-weight: bold;
  margin-bottom: 16px;
}
.confirm-box {
  background: var(--premium);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  border: 1px solid var(--border);
}
.confirm-box p { font-size: 15px; padding: 4px 0; }

/* ─── ローディング ─── */
#loading { text-align: center; padding: 60px 0; }
.loader {
  display: inline-block;
  width: 32px; height: 32px;
  border: 3px solid var(--accent-light);
  border-top-color: var(--accent-dark);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
