/* ===== リセット＆ベース ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: "Kosugi Maru", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  background: #faf9f3;
  color: #333;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

/* ===== アプリ全体 ===== */
.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #faf9f3;
}

/* ===== ヘッダー ===== */
.header {
  background: linear-gradient(135deg, #f5a623, #f7c86c);
  color: white;
  padding: 12px 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  flex-shrink: 0;
  z-index: 100;
}

.header h1 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.header-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

/* ===== メインコンテンツ ===== */
.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.page {
  display: none;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 12px 20px;
}

.page.active {
  display: block;
}

/* ===== 下部ナビ ===== */
.bottom-nav {
  display: flex;
  background: white;
  border-top: 1px solid #eee;
  padding: 4px 0;
  padding-bottom: calc(4px + env(safe-area-inset-bottom));
  flex-shrink: 0;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 10px;
  color: #999;
  cursor: pointer;
  transition: color 0.2s;
  position: relative;
}

.nav-btn.active {
  color: #f5a623;
}

.nav-icon {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 2px;
}

.nav-label {
  font-weight: 700;
}

/* QR中央ボタン */
.nav-qr {
  position: relative;
}

.nav-qr-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5a623, #f7c86c);
  font-size: 24px;
  color: white;
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 4px 12px rgba(245,166,35,0.4);
  transition: transform 0.2s;
}

.nav-qr:active .nav-qr-circle {
  transform: translateX(-50%) scale(0.92);
}

.nav-qr .nav-label {
  margin-top: 28px;
}

/* ===== セクションカード ===== */
.section-card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #f5a623;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #fff3d0;
}

/* ===== お知らせ ===== */
.notices-list {
  font-size: 14px;
}

.notice-item {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  line-height: 1.6;
}

.notice-item:last-child {
  border-bottom: none;
}

.notice-date {
  font-size: 11px;
  color: #999;
  display: block;
  margin-bottom: 4px;
}

/* ===== スタンプカード ===== */
.stamp-card {
  text-align: center;
}

.stamp-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.stamp-dot {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.3s;
}

.stamp-dot.filled {
  background: linear-gradient(135deg, #f5a623, #f7c86c);
  box-shadow: 0 2px 6px rgba(245,166,35,0.3);
}

.stamp-dot.filled::after {
  content: "⭐";
  font-size: 12px;
}

.stamp-count {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
}

.stamp-reward {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
}

/* ===== カレンダー ===== */
.calendar {
  padding: 0;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.calendar-title {
  font-size: 18px;
  font-weight: 700;
  color: #f5a623;
}

.calendar-nav {
  background: #f5a623;
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.calendar-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.calendar-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #888;
  padding: 6px 0;
}

.calendar-dow:first-child { color: #e74c3c; }
.calendar-dow:last-child { color: #3498db; }

.calendar-day {
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
  font-size: 13px;
  border-radius: 6px;
  background: #fafafa;
  cursor: pointer;
  transition: all 0.2s;
}

.calendar-date {
  font-weight: 600;
}

.calendar-place {
  font-size: 8px;
  color: #666;
  margin-top: 2px;
  text-align: center;
  line-height: 1.2;
  word-break: break-all;
}

.calendar-day.empty {
  background: transparent;
  cursor: default;
}

.calendar-day.has-event {
  background: #fff3d0;
  border: 2px solid #f5a623;
}

.calendar-day.today {
  background: #f5a623;
  color: white;
}

.calendar-day.today .calendar-place {
  color: white;
}

.calendar-day.has-event.today {
  background: #f5a623;
  border-color: #d4880a;
}

/* ===== ホーム内マップ ===== */
.home-map {
  height: 300px;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
}

.spot-list-wrap {
  max-height: 160px;
  overflow-y: auto;
}

.spot-list {
  list-style: decimal;
  padding-left: 22px;
  font-size: 12px;
  line-height: 1.4;
}

.spot-list li {
  margin: 6px 0;
  cursor: pointer;
}

.spot-list li:active {
  opacity: 0.6;
}

.spot-name {
  margin-right: 4px;
}

.badge {
  display: inline-block;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #fde7a8;
  color: #5a4b1a;
  white-space: nowrap;
}

/* ===== メニュー画像 ===== */
.menu-container {
  display: flex;
  justify-content: center;
}

.menu-image {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ===== 初回クーポン ===== */
.coupon-desc {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
  text-align: center;
}

.welcome-choices {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.welcome-choice-btn {
  padding: 14px 20px;
  border: 3px solid #f5a623;
  border-radius: 16px;
  background: #fff9e6;
  font-size: 16px;
  font-family: inherit;
  font-weight: 700;
  color: #d48a00;
  cursor: pointer;
  transition: all 0.2s;
}

.welcome-choice-btn:active {
  transform: scale(0.95);
  background: #f5a623;
  color: white;
}

.coupon-note {
  font-size: 11px;
  color: #999;
  text-align: center;
}

.coupon-used-badge {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #999;
  padding: 20px 0;
}

.coupon-show-card {
  background: linear-gradient(135deg, #fff9e6, #fff3cc);
  border: 3px dashed #f5a623;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
}

.coupon-show-label {
  font-size: 14px;
  color: #888;
  margin-bottom: 8px;
}

.coupon-show-item {
  font-size: 28px;
  font-weight: 700;
  color: #f5a623;
}

/* ===== FiNANCiEクーポン入力 ===== */
.code-input-wrap {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.input-field {
  flex: 1;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fafafa;
  transition: border-color 0.2s;
}

.input-field:focus {
  outline: none;
  border-color: #f5a623;
  background: white;
}

.textarea-field {
  width: 100%;
  min-height: 120px;
  resize: vertical;
}

/* ===== QRスキャン ===== */
.qr-container {
  text-align: center;
  padding: 20px 0;
}

.qr-desc {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}

.qr-reader {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 16px;
  border-radius: 16px;
  overflow: hidden;
}

.btn-qr {
  font-size: 18px;
}

.qr-note {
  font-size: 11px;
  color: #999;
  margin-top: 12px;
}

/* ===== 口コミ ===== */
.reviews-list {
  font-size: 14px;
}

.review-item {
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.review-item:last-child {
  border-bottom: none;
}

.review-nickname {
  font-weight: 700;
  color: #f5a623;
  font-size: 13px;
}

.review-date {
  font-size: 11px;
  color: #999;
  margin-left: 8px;
}

.review-body {
  margin-top: 6px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.review-reply {
  margin-top: 8px;
  padding: 10px 12px;
  background: #fff9e6;
  border-radius: 10px;
  border-left: 3px solid #f5a623;
  font-size: 13px;
}

.review-reply-label {
  font-weight: 700;
  color: #d48a00;
  font-size: 12px;
  margin-bottom: 4px;
}

.review-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.review-char-count {
  text-align: right;
  font-size: 11px;
  color: #999;
  margin-top: -6px;
}

/* ===== 設定 ===== */
.settings-card {
  background: #f9f9f9;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.settings-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #f5a623;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #fef3e0;
}

.settings-option {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  margin: 6px 0;
  background: white;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.settings-option input[type="radio"],
.settings-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0 12px 0 0;
  accent-color: #f5a623;
  flex-shrink: 0;
}

.settings-option-text {
  font-size: 14px;
  color: #333;
}

.settings-places {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #ddd;
}

.settings-places-title {
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}

.settings-places .settings-option {
  background: #f5f5f5;
}

.settings-places .settings-option.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.settings-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #888;
  margin-top: 12px;
  padding: 12px;
  background: #fffbf0;
  border-radius: 10px;
  line-height: 1.5;
}

.settings-note-icon {
  flex-shrink: 0;
}

.app-info-text {
  font-size: 13px;
  color: #888;
  margin-bottom: 4px;
}

.device-id-text {
  font-family: monospace;
  font-size: 11px;
  word-break: break-all;
}

/* ===== 汎用ボタン ===== */
.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #f5a623, #f7c86c);
  color: white;
  box-shadow: 0 3px 10px rgba(245,166,35,0.3);
}

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
  border-radius: 50px;
}

.btn-full {
  width: 100%;
  margin-top: 8px;
}

/* ===== 結果テキスト ===== */
.result-text {
  text-align: center;
  margin-top: 10px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 13px;
  border-radius: 10px;
  line-height: 1.4;
}

.result-text:empty {
  display: none;
}

.result-text.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.result-text.error {
  background: #ffebee;
  color: #c62828;
}

.result-text.loading {
  background: #e3f2fd;
  color: #1565c0;
}

.loading-text {
  text-align: center;
  color: #999;
  padding: 20px 0;
  font-size: 13px;
}

/* ===== モーダル ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-date {
  font-size: 14px;
  color: #888;
  margin-bottom: 8px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-time {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}

.modal-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: #f5a623;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  margin-bottom: 8px;
}

.modal-close {
  background: #eee;
  color: #666;
}

/* ===== Leaflet ===== */
.leaflet-popup-content strong {
  font-size: 14px;
}
