/* うららん プロフィール編集
 * - 自分/相手タブ
 * - フォーム（姓名/かな/生年月日/性別/血液型/出生時間/出生地/婚姻状態）
 * - 下部固定の保存ボタン（状態: idle / dirty / saved）
 */

:root {
  --c-bg: #F8F8F8;
  --c-surface: #FFFFFF;
  --c-border: #ECECEC;
  --c-text: #2C2C2A;
  --c-text-muted: #7A7770;
  --c-text-hint: #B5B0A8;
  --c-purple: #7B5BC4;
  --c-purple-soft: #B5A0DC;
  --c-purple-tab-inactive: #E5E5EA;
  --c-hint-bg: #FBEFE7;
  --c-disabled-bg: #C8C8CE;
  --c-disabled-text: #FFFFFF;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--c-surface);
  color: var(--c-text);
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  background: var(--c-surface);
  display: flex;
  flex-direction: column;
}

/* ===== ヘッダー ===== */
.app-header {
  flex: 0 0 auto;
  background: var(--c-surface);
  border-bottom: 0.5px solid var(--c-border);
}
.topbar {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  position: relative;
}
.topbar-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--c-text);
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}
.topbar-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--c-text);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ===== 本文スクロール領域 ===== */
.profile-main {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 24px;
  scrollbar-width: none;
}
.profile-main::-webkit-scrollbar { display: none; }

/* ----- Section title（home.cssと同形式。profile-mainのpaddingを考慮して上下padding=0） ----- */
.section-title {
  font-size: 17px;
  font-weight: 500;
  padding: 0 0 12px;
  margin: 0;
}

/* ===== 自分/相手タブ ===== */
.who-tabs {
  display: flex;
  background: var(--c-purple-tab-inactive);
  border-radius: 24px;
  padding: 4px;
  margin-bottom: 16px;
}
.who-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: #5A5A60;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.who-tab.is-active {
  background: var(--c-purple);
  color: #fff;
}

/* ===== ヒント帯 ===== */
.hint-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--c-hint-bg);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 24px;
}
.hint-icon {
  font-size: 22px;
  line-height: 1;
  flex: 0 0 auto;
}
.hint-text {
  margin: 0;
  font-size: 13px;
  color: var(--c-text);
  line-height: 1.55;
}

/* ===== フォーム ===== */
.profile-form { margin: 0; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 20px;
  row-gap: 20px;
}
.field {
  display: block;
}
.field-full {
  grid-column: 1 / -1;
}
.field-label {
  display: block;
  font-size: 12px;
  color: var(--c-text-muted);
  margin-bottom: 6px;
}
.field-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--c-border);
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--c-text);
  padding: 4px 0 8px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  font-family: inherit;
}
.field-input::placeholder {
  color: var(--c-text-hint);
}
.field-input:focus {
  border-bottom-color: var(--c-purple);
}

/* selectは右側に小さい▼を表示 */
select.field-input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%239A968C' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 4px center;
  background-size: 10px 6px;
  padding-right: 20px;
}
/* 空（未選択）時はプレースホルダー色 */
select.field-input:invalid,
select.field-input.is-placeholder {
  color: var(--c-text-hint);
}

/* date / time も同じ下線スタイルに揃える */
input[type="date"].field-input,
input[type="time"].field-input {
  min-height: 30px;
}
/* iOSでdate/timeが空のときフォントサイズが小さくなる対策 */
input[type="date"].field-input:not([value=""]),
input[type="time"].field-input:not([value=""]) {
  color: var(--c-text);
}

/* ===== ボタン型フィールド（生年月日など、カスタムピッカー起動用） ===== */
.field-button {
  text-align: left;
  cursor: pointer;
  display: block;
  /* iOSのボタンデフォルト装飾を消す */
  -webkit-tap-highlight-color: transparent;
}
.field-button-text {
  color: var(--c-text-hint);
  font-size: 15px;
}
.field-button[data-value]:not([data-value=""]) .field-button-text {
  color: var(--c-text);
}
.field-button:focus {
  border-bottom-color: var(--c-purple);
}

/* ===== ホイールピッカー モーダル ===== */
.wheel-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  pointer-events: none;
}
.wheel-modal[aria-hidden="false"] {
  display: block;
  pointer-events: auto;
}
.wheel-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.2s;
}
.wheel-modal[aria-hidden="false"] .wheel-modal-overlay {
  opacity: 1;
}
.wheel-modal-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #F4F4F6;
  border-radius: 14px 14px 0 0;
  transform: translateY(100%);
  transition: transform 0.25s ease-out;
  max-width: 430px;
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
}
.wheel-modal[aria-hidden="false"] .wheel-modal-sheet {
  transform: translateY(0);
}
.wheel-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
  background: #FFFFFF;
  border-radius: 14px 14px 0 0;
}
.wheel-modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
}
.wheel-modal-action {
  border: 0;
  background: transparent;
  color: var(--c-purple);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 8px;
}
.wheel-modal-action:active { opacity: 0.6; }
.wheel-modal-confirm { font-weight: 700; }

/* ===== ホイール本体 ===== */
.wheel-picker {
  height: 220px;
  display: flex;
  position: relative;
  background: #FFFFFF;
  overflow: hidden;
}
.wheel-column {
  flex: 1;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.wheel-column::-webkit-scrollbar { display: none; }
.wheel-list {
  /* 上下に余白を入れて、先頭と末尾の項目も中央に来るようにする
     ピッカー高さ 220 - 1項目の高さ 44 = 176 / 2 = 88 */
  padding: 88px 0;
}
.wheel-item {
  height: 44px;
  line-height: 44px;
  scroll-snap-align: center;
  text-align: center;
  font-size: 20px;
  color: #B5B0A8;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.wheel-item.is-selected {
  color: var(--c-text);
  font-weight: 600;
}
/* 中央のハイライト枠（マスク） */
.wheel-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.95) 0%,
      rgba(255, 255, 255, 0.3) 38%,
      rgba(255, 255, 255, 0) 50%,
      rgba(255, 255, 255, 0.3) 62%,
      rgba(255, 255, 255, 0.95) 100%
    );
}
.wheel-mask::before,
.wheel-mask::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
}
.wheel-mask::before { top: calc(50% - 22px); }
.wheel-mask::after { top: calc(50% + 22px); }

/* ===== 下部固定: 保存ボタン ===== */
.save-footer {
  flex: 0 0 auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--c-surface);
  border-top: 0.5px solid var(--c-border);
}
.save-btn {
  width: 100%;
  background: var(--c-disabled-bg);
  color: var(--c-disabled-text);
  border: 0;
  border-radius: 28px;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: not-allowed;
  transition: background 0.15s;
}
.save-btn.is-active {
  background: var(--c-purple);
  cursor: pointer;
}
.save-btn.is-active:active {
  background: #6a4cb0;
}
/* saved状態（保存しました）はis-activeを外した非活性スタイルと同じ */

/* ===== 確認ダイアログ（profile.css の confirm-dialog と同構造） ===== */
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.confirm-dialog[aria-hidden="false"] {
  display: flex;
}
.confirm-dialog-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.confirm-dialog-card {
  position: relative;
  width: 100%;
  max-width: 300px;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.confirm-dialog-header {
  padding: 22px 20px 18px;
  text-align: center;
  border-bottom: 0.5px solid var(--c-border);
}
.confirm-dialog-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--c-purple);
  line-height: 1.55;
}
.confirm-dialog-body {
  padding: 22px 20px;
  text-align: center;
  border-bottom: 0.5px solid var(--c-border);
}
.confirm-dialog-desc {
  margin: 0;
  font-size: 13px;
  color: var(--c-text);
  line-height: 1.7;
}
.confirm-dialog-actions {
  display: flex;
}
.confirm-dialog-btn {
  flex: 1;
  border: 0;
  padding: 14px 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
}
.confirm-dialog-btn + .confirm-dialog-btn {
  border-left: 0.5px solid var(--c-border);
}
.confirm-dialog-cancel {
  color: var(--c-purple);
  background: #fff;
}
.confirm-dialog-confirm {
  color: #fff;
  background: var(--c-purple);
}
.confirm-dialog-btn:active {
  opacity: 0.85;
}
