/* ============================================================
   ピタリ一会 — スタイルシート
   コンセプト：墨と藍の夜
   ダーク和風 / スマートフォンファースト / 大きなボタン
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Zen+Old+Mincho:wght@400;700;900&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

:root {
  --bg:           #0e0f13;
  --bg2:          #161820;
  --bg3:          #1e2029;
  --bg4:          #252733;
  --ai:           #3a6ea8;
  --ai-light:     #5a8ec8;
  --ai-pale:      rgba(58,110,168,.15);
  --matcha:       #6a8f58;
  --matcha-pale:  rgba(106,143,88,.15);
  --sakura:       #c97880;
  --sakura-pale:  rgba(201,120,128,.12);
  --kinari:       #e8e0d0;
  --sumizumi:     #8a8a9a;
  --border:       rgba(255,255,255,.07);
  --border2:      rgba(58,110,168,.3);
  --radius:       20px;
  --radius-sm:    12px;
  --radius-xs:    8px;
  --safe-top:     env(safe-area-inset-top,    0px);
  --safe-bot:     env(safe-area-inset-bottom, 0px);
  --shadow-ai:    0 4px 24px rgba(58,110,168,.25);
  --shadow-card:  0 2px 20px rgba(0,0,0,.4);
}

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

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--kinari);
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  overflow: hidden;
}

/* ─── 画面管理 ─────────────────────────── */
.screen {
  position: fixed; inset: 0;
  display: none; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  background: var(--bg);
  opacity: 0; transform: translateY(10px);
  transition: opacity .26s ease, transform .26s ease;
}
.screen.active { display: flex; opacity: 1; transform: translateY(0); }

/* ─── HOME ─────────────────────────────── */
.home-bg {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.home-bg::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 100% 55% at 25%   0%,  rgba(58,110,168,.13) 0%, transparent 65%),
    radial-gradient(ellipse  70% 45% at 85% 100%,  rgba(201,120,128,.08) 0%, transparent 60%),
    radial-gradient(ellipse  50% 35% at  5%  80%,  rgba(106,143,88,.06) 0%, transparent 55%);
}
.home-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.013) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.013) 1px, transparent 1px);
  background-size: 36px 36px;
}

.home-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 0;
  padding: calc(var(--safe-top) + 56px) 28px calc(var(--safe-bot) + 44px);
  min-height: 100dvh;
}

.logo-area {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; margin-bottom: 48px;
}
.logo-icon {
  width: 64px; height: 64px; margin-bottom: 6px;
  color: var(--ai-light);
  filter: drop-shadow(0 0 22px rgba(90,142,200,.5));
}
.logo-icon svg { width: 100%; height: 100%; }
.logo-title {
  font-family: 'Zen Old Mincho', serif;
  font-size: 2.3rem; font-weight: 900;
  letter-spacing: .1em; color: var(--kinari); line-height: 1;
}
.logo-title .kanji-accent { color: var(--ai-light); }
.logo-sub {
  font-size: .7rem; color: var(--sumizumi);
  letter-spacing: .2em; margin-top: 4px;
}

.home-form { display: flex; flex-direction: column; gap: 30px; }

/* ─── インプット ───────────────────────── */
.input-group  { display: flex; flex-direction: column; gap: 10px; }
.input-label  {
  font-size: .68rem; color: var(--sumizumi);
  letter-spacing: .12em;
  display: flex; align-items: center; gap: 7px;
}
.input-label::before {
  content: ''; display: block;
  width: 3px; height: 13px;
  background: var(--ai); border-radius: 2px; flex-shrink: 0;
}
.input-field {
  width: 100%; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--kinari); font-size: 1.05rem; font-family: inherit;
  padding: 17px 18px; outline: none;
  transition: border-color .2s, background .2s; -webkit-appearance: none;
}
.input-field:focus { border-color: var(--ai); background: var(--bg3); }
.input-field::placeholder { color: var(--sumizumi); font-size: .93rem; }

/* ─── 移動手段 ─────────────────────────── */
.transport-grid {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 8px;
}
.transport-btn {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 15px 4px; background: var(--bg2);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  color: var(--sumizumi); cursor: pointer; transition: all .2s;
  font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.transport-btn.active {
  border-color: var(--ai); background: var(--ai-pale); color: var(--ai-light);
}
.t-icon  { font-size: 1.55rem; line-height: 1; }
.t-label { font-size: .67rem; letter-spacing: .03em; }
.transit-note {
  font-size: .72rem; color: var(--sakura); padding: 9px 13px;
  background: var(--sakura-pale); border-radius: var(--radius-xs);
  border-left: 3px solid var(--sakura);
}

/* ─── ボタン ───────────────────────────── */
.btn-primary, .btn-secondary {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 22px 24px;
  border: none; border-radius: var(--radius);
  font-size: 1.1rem; font-weight: 700; font-family: inherit;
  letter-spacing: .07em; cursor: pointer; transition: all .2s;
  -webkit-tap-highlight-color: transparent;
  position: relative; overflow: hidden;
}
.btn-primary::after, .btn-secondary::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,.09); opacity: 0; transition: opacity .15s;
}
.btn-primary:active::after,
.btn-secondary:active::after { opacity: 1; }
.btn-primary:active   { transform: scale(.98); }
.btn-secondary:active { transform: scale(.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--ai) 0%, var(--ai-light) 100%);
  color: #fff; box-shadow: var(--shadow-ai);
}
.btn-primary:disabled  { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary {
  background: var(--bg2); border: 1.5px solid var(--border2); color: var(--ai-light);
}
.btn-secondary:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-small {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--kinari); border-radius: var(--radius-xs);
  padding: 12px 18px; font-size: .9rem;
  font-family: inherit; cursor: pointer; transition: background .15s;
}
.btn-small:active { background: var(--bg4); }
.btn-text {
  background: none; border: none; color: var(--ai-light);
  font-family: inherit; font-size: .85rem; cursor: pointer; padding: 4px 0;
  letter-spacing: .05em;
}
.btn-icon      { font-size: 1.2rem; }
.action-buttons { display: flex; flex-direction: column; gap: 14px; }

/* ─── 登録地点 ─────────────────────────── */
.saved-places-section { display: flex; flex-direction: column; gap: 10px; }
.section-label { font-size: .67rem; color: var(--sumizumi); letter-spacing: .12em; }
.saved-places-list { display: flex; flex-wrap: wrap; gap: 8px; }
.place-chip {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 20px; padding: 9px 17px;
  font-size: .85rem; color: var(--kinari);
  cursor: pointer; white-space: nowrap;
  transition: all .18s; font-family: inherit;
}
.place-chip:active { border-color: var(--ai); background: var(--ai-pale); color: var(--ai-light); }

/* ─── 画面ヘッダー ─────────────────────── */
.screen-header {
  display: flex; align-items: center; gap: 14px;
  padding: calc(var(--safe-top) + 18px) 22px 18px;
  border-bottom: 1px solid var(--border); background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
.screen-title {
  font-family: 'Zen Old Mincho', serif;
  font-size: 1.05rem; font-weight: 700; letter-spacing: .08em;
}
.btn-back {
  background: none; border: none; color: var(--ai-light);
  font-family: inherit; font-size: .92rem; cursor: pointer; white-space: nowrap;
}
.screen-body {
  padding: 28px 22px calc(var(--safe-bot) + 28px);
  display: flex; flex-direction: column; gap: 22px; flex: 1;
}

/* ─── 目的地検索 ───────────────────────── */
.dest-search { display: flex; gap: 8px; }
.dest-search .input-field { flex: 1; }
.search-results {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.search-result-item {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:active { background: var(--bg3); }
.result-name { font-weight: 600; font-size: .95rem; }
.result-addr { font-size: .75rem; color: var(--sumizumi); margin-top: 3px; }
.dest-selected-label {
  font-size: .9rem; color: var(--matcha); padding: 14px 18px;
  background: var(--matcha-pale); border-radius: var(--radius-sm);
  border-left: 3px solid var(--matcha);
}

/* ─── 待ち合わせ画面 ───────────────────── */
.waiting-body { gap: 26px; }
.departed-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 30px 24px; box-shadow: var(--shadow-card);
}
.departed-icon { font-size: 2.6rem; }
.departed-msg  {
  font-family: 'Zen Old Mincho', serif;
  font-size: 1.15rem; font-weight: 700; letter-spacing: .07em; text-align: center;
}
.departed-time { font-size: .75rem; color: var(--sumizumi); }

/* ─── マップ画面 ───────────────────────── */
#screen-map    { padding: 0; overflow: hidden; }
#map-container { position: absolute; inset: 0; }
.map-hud {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 16px calc(var(--safe-bot) + 16px);
}
.hud-top {
  display: flex; align-items: center; justify-content: space-between;
  pointer-events: auto;
}
.btn-back-map {
  width: 42px; height: 42px; background: rgba(14,15,19,.9);
  border: 1px solid var(--border); border-radius: 50%;
  color: var(--kinari); font-size: 1rem; cursor: pointer;
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center; font-family: inherit;
}
.hud-room-info  { display: flex; align-items: center; gap: 8px; }
.hud-room-label {
  font-size: .67rem; color: var(--sumizumi);
  background: rgba(14,15,19,.9); padding: 7px 13px;
  border-radius: 20px; backdrop-filter: blur(12px); letter-spacing: .06em;
}
.btn-share-line {
  background: #06c755; border: none; border-radius: 20px;
  color: #fff; font-size: .78rem; font-weight: 700; font-family: inherit;
  padding: 9px 16px; cursor: pointer; pointer-events: auto;
}
.waiting-msg {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: rgba(14,15,19,.93); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 22px 20px;
  backdrop-filter: blur(14px); pointer-events: auto;
  text-align: center; max-width: 300px; width: calc(100% - 32px);
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 10;
}
.waiting-msg p { font-size: .88rem; line-height: 1.65; }
.waiting-spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border); border-top-color: var(--ai-light);
  border-radius: 50%; animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.polling-status { font-size: .67rem; color: var(--sumizumi); min-height: 1em; }

.info-card {
  background: rgba(14,15,19,.93); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  backdrop-filter: blur(14px);
  display: flex; flex-direction: column; gap: 14px; pointer-events: auto;
}
.info-row    { display: flex; align-items: center; gap: 10px; }
.info-block  { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.info-divider { color: var(--sumizumi); font-size: .85rem; flex-shrink: 0; }
.info-name   { font-size: .7rem; color: var(--sumizumi); font-weight: 500; letter-spacing: .05em; }
.info-eta    {
  font-family: 'Zen Old Mincho', serif;
  font-size: 1.15rem; font-weight: 700; color: var(--kinari);
  letter-spacing: .02em; line-height: 1.25; text-align: center;
}
.info-dist   { font-size: .68rem; color: var(--sumizumi); }
.progress-section { display: flex; flex-direction: column; gap: 5px; }
.progress-label-row {
  display: flex; justify-content: space-between;
  font-size: .63rem; color: var(--sumizumi); letter-spacing: .07em;
}
.progress-bar-track {
  position: relative; height: 5px;
  background: var(--bg4); border-radius: 3px; overflow: visible;
}
.progress-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--ai), var(--ai-light));
  border-radius: 3px; transition: width .7s ease;
}
.progress-dot {
  position: absolute; top: 50%; left: 0%;
  transform: translate(-50%,-50%);
  width: 13px; height: 13px;
  background: var(--ai-light); border: 2px solid var(--bg);
  border-radius: 50%; transition: left .7s ease;
  box-shadow: 0 0 10px rgba(90,142,200,.6);
}
.delay-notice {
  text-align: center; font-size: .8rem; color: var(--sakura);
  background: var(--sakura-pale); border: 1px solid rgba(201,120,128,.25);
  border-radius: var(--radius-xs); padding: 9px;
}
.btn-update-pos {
  width: 100%; padding: 13px; background: var(--bg3);
  border: 1px solid var(--border); color: var(--kinari);
  border-radius: var(--radius-xs); font-size: .88rem;
  font-family: inherit; cursor: pointer; transition: background .15s;
}
.btn-update-pos:active { background: var(--bg4); }
.map-error {
  position: absolute; bottom: calc(var(--safe-bot) + 180px);
  left: 16px; right: 16px;
  background: rgba(201,120,128,.12); border: 1px solid rgba(201,120,128,.35);
  border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: .84rem; color: var(--sakura); backdrop-filter: blur(8px);
}

/* ─── 共有画面 ─────────────────────────── */
.section-header-row {
  display: flex; align-items: center; justify-content: space-between;
}
.section-hint { font-size: .75rem; color: var(--sumizumi); }

.share-info-card {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); overflow: hidden;
}
.share-info-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.share-info-row:last-child { border-bottom: none; }
.share-info-label { font-size: .75rem; color: var(--sumizumi); letter-spacing: .06em; }
.share-info-value { font-size: .95rem; font-weight: 600; }
.share-eta-text   { font-family: 'Zen Old Mincho', serif; color: var(--ai-light); font-size: 1.1rem; }

.qr-section {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 24px 0 8px;
}
.qr-code-container {
  background: #fff; padding: 12px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}
.qr-code-container canvas, .qr-code-container img { display: block; }
.qr-note { font-size: .72rem; color: var(--sumizumi); letter-spacing: .06em; }

.url-copy-row {
  display: flex; gap: 8px; align-items: center;
}
.share-url-field {
  flex: 1; font-size: .82rem; color: var(--sumizumi); cursor: text;
}
.share-buttons {
  display: flex; flex-direction: column; gap: 10px;
}
.btn-line {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 18px; border: none; border-radius: var(--radius);
  background: #06c755; color: #fff;
  font-size: 1.05rem; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: opacity .2s;
}
.btn-line:active { opacity: .85; }
.share-hint {
  font-size: .75rem; color: var(--sumizumi); text-align: center; line-height: 1.6;
}

/* 合流予想時間ブロック */
.meet-eta-block {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.meet-eta-label {
  font-size: .68rem; color: var(--sumizumi); letter-spacing: .1em;
}
.meet-eta-value {
  font-family: 'Zen Old Mincho', serif;
  font-size: 2rem; font-weight: 900; color: var(--ai-light);
  letter-spacing: .04em; line-height: 1.15;
  text-shadow: 0 0 20px rgba(90,142,200,.4);
}

/* ─── 登録地点管理 ─────────────────────── */
.place-form          { display: flex; flex-direction: column; gap: 10px; }
.places-manager-list { display: flex; flex-direction: column; gap: 10px; }
.place-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 18px;
}
.place-item-info .place-item-name { font-weight: 600; font-size: .95rem; }
.place-item-info .place-item-addr { font-size: .75rem; color: var(--sumizumi); margin-top: 3px; }
.btn-delete-place {
  background: none; border: none; color: var(--sakura);
  font-size: 1.2rem; cursor: pointer; padding: 4px 8px;
}

/* ─── トースト ─────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--safe-bot) + 28px); left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--kinari); border-radius: 24px; padding: 13px 26px;
  font-size: .88rem; white-space: nowrap; z-index: 9999;
  opacity: 0; transition: opacity .25s, transform .25s;
  backdrop-filter: blur(14px); box-shadow: var(--shadow-card); letter-spacing: .04em;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hidden { display: none !important; }

/* ─── PC表示：中央に400px幅でスマホ風に ── */
@media (min-width: 480px) {
  body { background: #07080b; }
  .screen {
    max-width: 430px;
    left: 50%; right: auto;
    transform: translateX(-50%);
    box-shadow: 0 0 80px rgba(0,0,0,.8);
  }
  .screen.active { transform: translateX(-50%); }
}

/* ─── 地図HUD（v5追加スタイル）──────────────────────── */
.hud-center {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.btn-hud-action {
  background: var(--bg2); border: 1px solid var(--border2);
  color: var(--nari); font-size: .78rem; font-family: inherit;
  padding: 7px 12px; border-radius: 20px; cursor: pointer;
  white-space: nowrap; transition: background .15s;
  touch-action: manipulation;
}
.btn-hud-action:active { background: var(--border2); }

/* 共有バー（地図画面内） */
.share-url-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin: 0 12px 8px;
}
.share-url-bar .share-url-field {
  flex: 1; font-size: .76rem; color: var(--sumizumi); min-width: 0;
}
.btn-line-small {
  background: #06c755; color: #fff; border: none;
  font-size: .78rem; font-weight: 700; font-family: inherit;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  white-space: nowrap; touch-action: manipulation;
}
.btn-line-small:active { opacity: .85; }

/* section-hint */
.section-hint { font-size: .75rem; color: var(--sumizumi); margin-bottom: 10px; }
