/* ===================================================
   HIKARI MOVING — Chat Simulator Styles
   =================================================== */

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

:root {
  --bg: #f0ede8;
  --surface: #ffffff;
  --primary: #e8480a;
  --primary-dk: #c43a06;
  --primary-lt: #fff0eb;
  --agent-bg: #ffffff;
  --user-bg: #e8480a;
  --user-text: #ffffff;
  --text: #1c1917;
  --text-muted: #78716c;
  --border: rgba(0, 0, 0, .08);
  --radius: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, .12);
  --font-body: 'Noto Sans JP', sans-serif;
  --font-serif: 'DM Serif Display', serif;
}

body {
  font-family: var(--font-body);
  /* background: var(--bg); */
}

/* ===== Shell ===== */
.app-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  height: auto;
  max-height: var(--app-height, 100vh);
  overflow: hidden;
  background: var(--bg);
  position: relative;
}

@media (max-width: 767px) {
  .app-wrapper {
    height: calc(var(--app-height, 100vh) - var(--fixed-bottom-offset, 0px) - var(--app-bottom-gap, 0px));
    height: calc(var(--app-height, 100svh) - var(--fixed-bottom-offset, 0px) - var(--app-bottom-gap, 0px));
    max-height: none;
    --app-bottom-gap: 40px;
  }
}

@media (min-width: 520px) {
  /* .app-wrapper {
    box-shadow: 0 0 60px rgba(0, 0, 0, .15);
  } */
}

/* ===== Header ===== */
.app-header {
  background: #0f489c;
  color: #fff;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
}

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

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 26px;
  line-height: 1;
}

.header-title {
  /* font-family: var(--font-serif); */
  font-size: 20px;
  letter-spacing: .02em;
  color: #fff;
}

.header-sub {
  font-size: 11px;
  color: #a8a29e;
  margin-top: 1px;
}

.header-badge {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: .05em;
}

/* ===== Chat ===== */
.chat-area {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

@media (max-width: 767px) {
  .chat-area {
    flex: 1;
  }
}

.chat-area::-webkit-scrollbar {
  width: 3px;
}

.chat-area::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .12);
  border-radius: 3px;
}

/* ===== Message Row ===== */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: msgIn .22s ease both;
}

.msg-row.user {
  flex-direction: row-reverse;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  /* background: #1c1917; */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.bubble {
  max-width: 75%;
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}

.msg-row.agent .bubble {
  background: var(--agent-bg);
  color: var(--text);
  border-bottom-left-radius: 5px;
}

.msg-row.user .bubble {
  background: var(--user-bg);
  color: var(--user-text);
  border-bottom-right-radius: 5px;
}

/* Typing */
.bubble.typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ccc;
  animation: bounce .9s infinite ease-in-out;
}

.dot:nth-child(2) {
  animation-delay: .15s;
}

.dot:nth-child(3) {
  animation-delay: .30s;
}

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-6px);
  }
}

/* ===== Input Zone ===== */
.input-zone {
  padding: 12px 16px 24px;/*calc(24px + env(safe-area-inset-bottom));*/
  background: var(--bg);
  border-top: 1px solid var(--border);
  /* min-height: 70px; */
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* Choice buttons */
.choices-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.from-address-prefecture-wrap {
  justify-content: flex-start;
}

.from-address-municipality-wrap {
  justify-content: flex-start;
  align-content: flex-start;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 2px 4px 0;
}

.from-address-municipality-wrap::-webkit-scrollbar {
  width: 8px;
}

.from-address-municipality-wrap::-webkit-scrollbar-thumb {
  background: rgba(232, 72, 10, .35);
  border-radius: 999px;
}

.choice-btn {
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 24px;
  padding: 9px 17px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s, transform .1s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}

.choice-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 72, 10, .3);
}

.choice-btn:active {
  transform: translateY(0);
}

.choice-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Text input */
.text-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.text-input {
  /* flex: 1; */
  padding: 11px 16px;
  border: 2px solid var(--border);
  border-radius: 24px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  width: 100%;
}

.text-input:focus {
  border-color: var(--primary);
}

.text-input::placeholder {
  color: #bbb;
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(232, 72, 10, .35);
}

.send-btn:hover {
  background: var(--primary-dk);
  transform: scale(1.05);
}

.send-btn:disabled {
  background: #ccc;
  box-shadow: none;
  cursor: default;
  transform: none;
}

/* Multi-select confirm */
.confirm-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  box-shadow: 0 3px 12px rgba(232, 72, 10, .3);
}

.confirm-btn:hover {
  background: var(--primary-dk);
}

/* ===== Progress Bar ===== */
.progress-wrap {
  padding: 0 16px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar-bg {
  flex: 1;
  height: 4px;
  background: rgba(0, 0, 0, .1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width .4s ease;
}

.progress-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===== Result Card ===== */
.result-card {
  background: #fff8f6;
  /*#1c1917; */
  color: #fff;
  border-radius: 20px;
  padding: 16px;
  margin: 4px 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
  animation: msgIn .35s ease both;
  width: 100%;
}

.result-eyebrow {
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.result-heading {
  /* font-family: var(--font-serif); */
  font-size: 22px;
  /* color: #fff; */
  color: var(--primary);
  margin-bottom: 16px;
  line-height: 1.3;
}

.result-section {
  /* background: rgba(255, 255, 255, .07); */
  background: rgba(255, 118, 118, .3);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.result-section-title {
  font-size: 11px;
  color: #504d4a;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  /* color: #e7e5e4; */
  color: initial;
  padding: 4px 0;
}

.result-row + .result-row {
  border-top: 1px solid rgba(255, 255, 255, .06);
}

.result-row-truck {
  display: none;
}

.result-row .val {
  font-weight: 600;
}

.result-row .val.highlight {
  color: #fb923c;
}

.result-total-box {
  background: var(--primary);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.result-total-label {
  font-size: 14px;
  font-weight: 700;
}

.result-total-amount {
  /* font-family: var(--font-serif); */
  font-size: 28px;
  letter-spacing: -.5px;
}

.result-note {
  font-size: 11.5px;
  color: #a8a29e;
  line-height: 1.65;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.reset-btn {
  width: 100%;
  margin-top: 14px;
  padding: 13px;
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, .3);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.reset-btn:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, .08);
}

.restart-link-wrap {
  text-align: center;
  margin-top: 8px;
}

.restart-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.restart-link:hover {
  color: var(--primary);
}

.post-result-continue-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.post-result-continue-note {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

.post-result-continue-btn {
  width: 100%;
  padding: 13px 16px;
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .15s, color .15s, transform .1s, box-shadow .15s;
}

.post-result-continue-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232, 72, 10, .25);
}

.post-result-continue-btn:active {
  transform: translateY(0);
}

/* ===== Header Tel Button ===== */
.header-tel-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 24px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  box-shadow: 0 2px 8px rgba(232, 72, 10, .4);
  transition: background .15s, transform .1s;
  white-space: nowrap;
}

.header-tel-btn:hover {
  background: var(--primary-dk);
  transform: scale(1.04);
}

.header-tel-icon {
  font-size: 14px;
}

/* ===== CTA Card (① 電話ボタン + ② コピー) ===== */
.cta-card {
  background: linear-gradient(135deg, #fff8f6 0%, #fff 100%);
  border: 2px solid var(--primary);
  border-radius: 18px;
  padding: 16px;
  margin: 4px 0;
  box-shadow: 0 4px 20px rgba(232, 72, 10, .12);
  animation: msgIn .3s ease both;
  width: 100%;
}

.cta-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.cta-heading {
  /* font-family: var(--font-serif); */
  font-size: 18px;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.cta-copy {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 16px;
}

.cta-copy strong {
  color: var(--primary);
}

.cta-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.cta-tel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: #fff !important;
  border: none;
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(232, 72, 10, .4);
  transition: background .15s, transform .1s, box-shadow .15s;
  letter-spacing: .02em;
}

.cta-tel-btn:hover {
  background: var(--primary-dk);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(232, 72, 10, .45);
}

.cta-tel-btn:active {
  transform: translateY(0);
}

.cta-form-btn,
.cta-line-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  padding: 15px 16px;
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .15s, color .15s, transform .1s, box-shadow .15s;
  letter-spacing: .02em;
}

.cta-form-btn:hover,
.cta-line-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(232, 72, 10, .25);
}

.cta-form-btn:active,
.cta-line-btn:active {
  transform: translateY(0);
}

.cta-line-btn {
  border-color: #06c755;
  color: #06c755;
}

.cta-line-btn:hover {
  background: #06c755;
  border-color: #06c755;
  color: #fff;
  box-shadow: 0 6px 20px rgba(6, 199, 85, .25);
}

.cta-tel-icon {
  font-size: 20px;
}

.cta-tel-number {
  font-size: 18px;
  letter-spacing: .05em;
}

.cta-tel-sub {
  font-size: 11px;
  opacity: .85;
  margin-top: 2px;
}

.cta-tel-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.cta-action-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.cta-action-sub {
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
}

.cta-hours {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

@media (min-width: 768px) {
  .cta-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }

  .cta-tel-btn,
  .cta-form-btn,
  .cta-line-btn {
    min-height: 92px;
  }
}

/* ===== AI Follow-up Chat ===== */
.ai-thinking {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-thinking-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  animation: bounce .8s infinite ease-in-out;
}

.ai-thinking-dot:nth-child(2) {
  animation-delay: .15s;
}

.ai-thinking-dot:nth-child(3) {
  animation-delay: .30s;
}

/* free text input (AI会話フェーズ) */
.ai-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-input {
  flex: 1;
  padding: 11px 16px;
  border: 2px solid var(--border);
  border-radius: 24px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  resize: none;
}

.ai-input:focus {
  border-color: var(--primary);
}

.ai-input::placeholder {
  color: #bbb;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, .7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.loading-box {
  background: #fff;
  border-radius: 20px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #f0ede8;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== Error bubble ===== */
.error-bubble {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
}
