/**
 * ============================================================
 * [CSS Version Management Specification]
 * - 採番範囲: 01 〜 99 (99の次は 01 にループ)
 * - 変更手順: style.css を修正した際、下記の --css-rev の値をインクリメントする
 * ============================================================
 */
:root {
  --css-rev: "99";
  --top-control-size: 40px;
  --setting-control-height: 48px;
  --footer-bottom-space: env(safe-area-inset-bottom, 0px);
  --footer-control-height: 54px;
  --footer-height: calc(var(--footer-control-height) + var(--footer-bottom-space));
  --main-controls-height: clamp(326px, calc((100vh - env(safe-area-inset-top) - var(--footer-height)) * 0.46), 420px);

  --sheikah-cyan: #00f3ff;
  --sheikah-cyan-glow: rgba(0, 243, 255, 0.7);
  --sheikah-orange: #ff9d00;
  --sheikah-orange-glow: rgba(255, 157, 0, 0.85);
  --sheikah-gold: #c5a059;
  --sheikah-gold-dark: #6e5426;
  --sheikah-bg: #111417;
  --sheikah-panel: #1b2228;
  --sheikah-border: #3b3226;
  --sheikah-danger: #ff4d4d;
  
  --botw-yellow: #ffee33;
  --botw-yellow-glow: rgba(255, 238, 51, 0.8);
  --botw-amber: #ffaa00;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Courier New", monospace;
}

html { overflow: hidden; overscroll-behavior: none; }

body {
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
  background-color: #080a0d;
  color: #e0f8ff;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

#app-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  position: relative;
  container-type: inline-size;
  overflow: hidden;
  background: var(--sheikah-bg);
  border-left: 2px solid var(--sheikah-border);
  border-right: 2px solid var(--sheikah-border);
  display: flex;
  flex-direction: column;
}

.overlay-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(8, 10, 13);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 24px;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.overlay-modal.show {
  display: flex;
}

.pwa-relic-box {
  width: 100%;
  max-width: 380px;
  background: var(--sheikah-panel);
  border: 2px solid var(--sheikah-gold);
  border-radius: 12px;
  padding: 24px 20px;
  box-shadow: 0 0 30px rgba(0, 243, 255, 0.15), inset 0 0 15px rgba(0,0,0,0.8);
  position: relative;
}

.pwa-lang-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(3, 8, 14, 0.85);
  border: 1.5px solid var(--sheikah-gold);
  color: var(--sheikah-gold);
  font-size: 0.75rem;
  font-weight: bold;
  padding: 5px 10px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}
.pwa-lang-btn:active {
  background: var(--sheikah-gold);
  color: #000;
}

.pwa-icon-img {
  width: 60px;
  height: 60px;
  margin: 10px auto 16px auto;
  border-radius: 12px;
  border: 1.5px solid var(--sheikah-gold);
  object-fit: cover;
  box-shadow: 0 0 12px rgba(197, 160, 89, 0.4);
  display: block;
}

.pwa-title {
  font-size: 1.15rem;
  font-weight: bold;
  color: var(--sheikah-gold);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.pwa-desc {
  font-size: 0.82rem;
  color: #b0c4de;
  line-height: 1.55;
  margin-bottom: 20px;
  text-align: left;
}

.pwa-step-card {
  background: rgba(3, 8, 14, 0.85);
  border: 1px solid var(--sheikah-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.pwa-step-item {
  font-size: 0.8rem;
  color: #e0f8ff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwa-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 243, 255, 0.15);
  border: 1px solid var(--sheikah-cyan);
  color: var(--sheikah-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.btn-dev-skip {
  background: transparent;
  border: none;
  color: #667788;
  font-size: 0.72rem;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 10px;
  display: block;
  width: 100%;
  text-align: center;
}

.btn-safety-ok {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: rgba(0, 243, 255, 0.2);
  border: 1.5px solid var(--sheikah-cyan);
  color: var(--sheikah-cyan);
  font-size: 0.95rem;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}
.btn-safety-ok:disabled {
  background: rgba(153, 170, 187, 0.1);
  border-color: #657382;
  color: #99aabb;
  cursor: default;
  box-shadow: none;
}
.btn-safety-ok:enabled:active {
  background: var(--sheikah-cyan);
  color: #000;
}

.modal-version {
  font-size: 0.62rem;
  color: #556270;
  letter-spacing: 0.5px;
  margin-top: 12px;
  text-align: center;
  min-height: 1em;
  line-height: 1em;
}

/* Keep startup copy and language changes inside a stable, centered dialog. */
#safety-prompt-overlay {
  justify-content: safe center;
  padding-block: 16px;
}
#safety-prompt-overlay .pwa-relic-box {
  height: min(390px, 100%);
  min-height: 300px;
  flex-shrink: 0;
  display: grid;
  grid-template-rows: 70px 48px minmax(0, 1fr) 48px 10px;
  row-gap: 8px;
}
#safety-prompt-overlay .pwa-icon-img {
  margin: 10px auto 0;
}
#safety-prompt-title {
  margin: 0;
  overflow-y: auto;
  overflow-wrap: anywhere;
  align-content: center;
}
#safety-prompt-desc {
  min-height: 0;
  margin-bottom: 0 !important;
  overflow-y: auto;
  overflow-wrap: anywhere;
  scrollbar-gutter: stable both-edges;
}
#safety-prompt-overlay .btn-safety-ok {
  min-height: 0;
  margin-top: 0;
  overflow-y: auto;
}
#safety-prompt-overlay .modal-version {
  margin-top: 0;
}

#arrival-flash-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 300;
}
.flash-anim {
  animation: arrival-screen-flash 0.8s ease-out forwards;
}
@keyframes arrival-screen-flash {
  0% { opacity: 0.85; background: var(--sheikah-cyan); }
  30% { opacity: 0.5; background: #fff; }
  100% { opacity: 0; }
}

.map-top-controls {
  position: absolute;
  top: calc(max(env(safe-area-inset-top), 24px) + 4px);
  left: 18px;
  right: 18px;
  z-index: 25;
  display: grid;
  grid-template-columns: var(--top-control-size) minmax(0, 1fr) auto;
  grid-template-areas: "attribution attribution attribution" "style . language";
  align-items: center;
  gap: 4px 8px;
}
.top-left-ctrl { grid-area: style; }
.top-right-ctrl { grid-area: language; }

.top-icon-btn {
  width: var(--top-control-size);
  height: var(--top-control-size);
  background: rgba(3, 8, 14, 0.85);
  border: 2px solid var(--sheikah-gold);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.9);
  transition: transform 0.2s ease;
  overflow: hidden;
  padding: 0;
}
.top-icon-btn:active {
  transform: scale(0.92);
}

.lang-toggle-btn {
  height: var(--top-control-size);
  min-width: 80px;
  background: rgba(3, 8, 14, 0.85);
  border: 2px solid var(--sheikah-gold);
  color: var(--sheikah-gold);
  font-size: 0.9rem;
  font-weight: bold;
  padding: 0 12px;
  border-radius: calc(var(--top-control-size) / 2);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.lang-toggle-btn .svg-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.lang-toggle-btn:active {
  background: var(--sheikah-gold);
  color: #000;
}

.top-section {
  width: 100%;
  height: calc(100vh - 6px - var(--footer-height) - var(--main-controls-height));
  height: calc(100dvh - 6px - var(--footer-height) - var(--main-controls-height));
  flex-shrink: 0;
  container-type: size;
  position: relative;
  background: radial-gradient(circle at center, #262c33 0%, #111417 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  z-index: 11;
  padding: calc(max(env(safe-area-inset-top), 24px) + 36px) 10px 8px;
}

.sheikah-divider-bar {
  width: 100%;
  height: 6px;
  background: linear-gradient(135deg, var(--sheikah-gold) 0%, var(--sheikah-gold-dark) 50%, var(--sheikah-gold) 100%);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.8), inset 0 0 6px #000;
  z-index: 10;
  flex-shrink: 0;
}

.relic-circuit {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.35;
  background: 
    radial-gradient(circle at 10% 15%, var(--sheikah-orange) 2px, transparent 3px),
    radial-gradient(circle at 90% 85%, var(--sheikah-cyan) 2px, transparent 3px);
}

.circle-map-wrapper {
  position: relative;
  isolation: isolate;
  width: min(100cqw, 100cqh, 420px);
  height: min(100cqw, 100cqh, 420px);
  flex-shrink: 0;
  border-radius: 50%;
  padding: 6px;
  background: none;
  --map-ring-shadow: 0 0 15px rgba(0, 0, 0, 0.8), inset 0 0 10px #000;
  margin-top: 0;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}


/* Only this rear layer receives the signal brightness filter. */
.map-signal-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: var(--map-ring-shadow);
  pointer-events: none;
  z-index: -1;
  animation-duration: inherit;
  animation-timing-function: inherit;
  animation-iteration-count: inherit;
  transition: box-shadow 0.3s ease;
}
.signal-level1 > .map-signal-glow, .signal-level1-half > .map-signal-glow { animation-name: ring-light-1; }
.signal-level2 > .map-signal-glow, .signal-level2-half > .map-signal-glow { animation-name: ring-light-2; }
.signal-level3 > .map-signal-glow, .signal-level3-half > .map-signal-glow { animation-name: ring-light-3; }
.signal-level4 > .map-signal-glow, .signal-level4-half > .map-signal-glow { animation-name: ring-light-4; }

/* The opaque circular rim covers the curved north piece's broad base. */
.circle-map-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sheikah-gold) 0%, var(--sheikah-gold-dark) 50%, var(--sheikah-gold) 100%);
  box-shadow: inset 0 0 10px #000;
  pointer-events: none;
  z-index: 1;
}

/* Extend only the north edge; preserve the circle and map viewport size. */
.circle-map-wrapper::after {
  content: "";
  position: absolute;
  inset: -10px;
  /* Darken the tip's gold by 15% to match the shaded rim, without a filter. */
  background: linear-gradient(calc(135deg - var(--map-north-rotation, 0deg)), #a7884c 0%, #5e4720 50%, #a7884c 100%);
  box-shadow: inset 0 0 10px #000;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 28'%3E%3Cpath d='M0 28V14C15 14 28 0 36 0C44 0 57 14 72 14V28Z'/%3E%3C/svg%3E") center top / 72px 28px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 28'%3E%3Cpath d='M0 28V14C15 14 28 0 36 0C44 0 57 14 72 14V28Z'/%3E%3C/svg%3E") center top / 72px 28px no-repeat;
  /* Keep the north tip opaque so the signal glow stays behind it. */
  opacity: 1;
  transform: rotate(var(--map-north-rotation, 0deg));
  pointer-events: none;
  z-index: 0;
}

.circle-map-wrapper.signal-idle {
  --map-ring-shadow: 0 0 15px rgba(0, 0, 0, 0.8), inset 0 0 10px #000;
  animation: none;
}
.circle-map-wrapper.signal-level1 {
  --map-ring-shadow: 0 0 20px var(--sheikah-cyan-glow), inset 0 0 10px var(--sheikah-cyan);
  animation: ring-pulse-1 2.5s infinite ease-in-out;
}
.circle-map-wrapper.signal-level2 {
  --map-ring-shadow: 0 0 32px var(--sheikah-cyan), inset 0 0 14px #fff;
  animation: ring-pulse-2 1.5s infinite ease-in-out;
}
.circle-map-wrapper.signal-level3 {
  --map-ring-shadow: 0 0 42px var(--sheikah-cyan), 0 0 20px var(--sheikah-orange), inset 0 0 18px #fff;
  animation: ring-pulse-3 0.8s infinite ease-in-out;
}
.circle-map-wrapper.signal-level4 {
  --map-ring-shadow: 0 0 55px var(--sheikah-orange), 0 0 30px var(--sheikah-cyan), inset 0 0 25px #fff;
  animation: ring-pulse-4 0.45s infinite ease-in-out;
  border: 2px solid #fff;
}

.day-mode .circle-map-wrapper.signal-level1 {
  --map-ring-shadow: 0 0 20px var(--botw-yellow-glow), inset 0 0 10px var(--botw-yellow);
}
.day-mode .circle-map-wrapper.signal-level2 {
  --map-ring-shadow: 0 0 32px var(--botw-yellow), inset 0 0 14px #fff;
}
.day-mode .circle-map-wrapper.signal-level3 {
  --map-ring-shadow: 0 0 42px var(--botw-yellow), 0 0 22px var(--botw-amber), inset 0 0 18px #fff;
}
.day-mode .circle-map-wrapper.signal-level4 {
  --map-ring-shadow: 0 0 55px var(--botw-amber), 0 0 30px var(--botw-yellow), inset 0 0 25px #fff;
  border: 2px solid var(--botw-yellow);
}

@keyframes ring-pulse-1 {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.01); }
}
@keyframes ring-light-1 {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
}
@keyframes ring-pulse-2 {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
@keyframes ring-light-2 {
  0%, 100% { filter: brightness(1.1); }
  50% { filter: brightness(1.35); }
}
@keyframes ring-pulse-3 {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
@keyframes ring-light-3 {
  0%, 100% { filter: brightness(1.2); }
  50% { filter: brightness(1.55); }
}
@keyframes ring-pulse-4 {
  0%, 100% { transform: scale(1.01); }
  50% { transform: scale(1.05); }
}
@keyframes ring-light-4 {
  0%, 100% { filter: brightness(1.4) contrast(1.2); }
  50% { filter: brightness(1.9) contrast(1.5); }
}

#map-container {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  z-index: 2;
  background: #03080e;
}

#map {
  width: 100%;
  height: 100%;
  transform-origin: center center;
}

.map-attribution {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  white-space: nowrap;
  color: #e4d5a8;
  background: rgba(3, 8, 14, 0.88);
  font-size: 10px;
  line-height: 1.4;
  padding: 3px 6px;
  border-radius: 4px;
  z-index: 6;
}
.map-attribution a { color: inherit; text-decoration: underline; }
.map-attribution a:focus-visible { outline: 2px solid var(--sheikah-cyan); }
.main-map-attribution {
  grid-area: attribution;
  text-align: left;
  min-width: 0;
  background: transparent;
  padding: 0;
  white-space: nowrap;
  font-size: 10px;
}
.main-map-attribution, .main-map-attribution a { font-family: Arial, sans-serif; }
.main-map-attribution a { white-space: nowrap; }
.detail-map-attribution { position: absolute; left: 4px; bottom: 4px; }
.osm-arrival-marker { width: 28px; height: 28px; pointer-events: none; }
.map-load-status {
  position: absolute;
  left: 8px;
  bottom: 42px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: #fff;
  background: #482718;
  z-index: 7;
}
.map-load-status[hidden] { display: none; }

#compass-status-btn {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  max-width: 82%;
  padding: 7px 12px;
  border: 1px solid var(--sheikah-gold);
  border-radius: 16px;
  background: rgba(3, 8, 14, 0.85);
  color: var(--sheikah-gold);
  font: inherit;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
}

#compass-status-btn[data-available="true"] {
  color: var(--sheikah-cyan);
  border-color: var(--sheikah-cyan);
}

.player-pointer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 28px;
  pointer-events: none;
  z-index: 5;
}
.player-pointer svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 0 10px var(--sheikah-cyan));
  transition: filter 0.3s ease;
}
.day-mode .player-pointer svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.75));
}

.radar-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--sheikah-cyan);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
}
.day-mode .radar-pulse-ring {
  border-color: var(--botw-yellow);
}

.pulse-anim {
  animation: pulse-out-anim 0.65s ease-out forwards;
}
.pulse-double-anim {
  animation: pulse-out-double 0.4s ease-out forwards;
}

@keyframes pulse-out-anim {
  0% { width: 30px; height: 30px; opacity: 1; border-color: #fff; }
  100% { width: 340px; height: 340px; opacity: 0; border-color: var(--sheikah-cyan); }
}
.day-mode .pulse-anim {
  animation-name: pulse-out-anim-day;
}
@keyframes pulse-out-anim-day {
  0% { width: 30px; height: 30px; opacity: 1; border-color: #fff; }
  100% { width: 340px; height: 340px; opacity: 0; border-color: var(--botw-yellow); }
}

@keyframes pulse-out-double {
  0% { width: 30px; height: 30px; opacity: 1; border-color: var(--sheikah-orange); }
  100% { width: 340px; height: 340px; opacity: 0; border-color: #fff; }
}
.day-mode .pulse-double-anim {
  animation-name: pulse-out-double-day;
}
@keyframes pulse-out-double-day {
  0% { width: 30px; height: 30px; opacity: 1; border-color: var(--botw-amber); }
  100% { width: 340px; height: 340px; opacity: 0; border-color: var(--botw-yellow); }
}

.bottom-section {
  width: 100%;
  height: var(--main-controls-height);
  flex-shrink: 0;
  background: var(--sheikah-panel);
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 46px;
}

.keyword-input-wrap {
  flex: 1;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
}

.keyword-input-wrap input {
  width: 100%;
  height: 100%;
  background: rgba(3, 8, 14, 0.9);
  border: 1.5px solid var(--sheikah-gold);
  color: var(--sheikah-cyan);
  padding: 0 38px 0 12px;
  font-size: max(16px, 0.98rem);
  border-radius: 6px;
  outline: none;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.8);
}
.keyword-input-wrap input:focus {
  border-color: var(--sheikah-cyan);
  box-shadow: 0 0 10px var(--sheikah-cyan-glow);
}

.btn-input-clear {
  position: absolute;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 243, 255, 0.15);
  border: 1px solid var(--sheikah-cyan);
  color: var(--sheikah-cyan);
  font-size: 0.75rem;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn-input-clear.show {
  display: flex;
}

.dial-lock {
  width: 72px;
  height: 46px;
  background: linear-gradient(180deg, #111 0%, #2f271a 50%, #111 100%);
  border: 1.5px solid var(--sheikah-gold);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.8);
  flex-shrink: 0;
  position: relative;
}
.dial-label {
  font-size: 0.58rem;
  color: var(--sheikah-orange);
  letter-spacing: 1px;
}
.dial-value {
  font-size: 0.88rem;
  font-weight: bold;
  color: var(--sheikah-cyan);
}

.dial-select-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
}

.btn-set {
  height: 46px;
  padding: 0 16px;
  background: rgba(0, 243, 255, 0.15);
  border: 1.5px solid var(--sheikah-cyan);
  color: var(--sheikah-cyan);
  font-size: 0.95rem;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
  flex-shrink: 0;
}
.btn-set:active {
  background: var(--sheikah-cyan);
  color: #000;
}
.btn-set.active {
  background: rgba(0, 243, 255, 0.2);
  border-color: var(--sheikah-cyan);
  color: var(--sheikah-cyan);
}
.btn-set.paused {
  background: rgba(197, 160, 89, 0.12);
  border-color: #8899aa;
  color: #8899aa;
}

.status-panel {
  position: relative;
  min-height: 58px;
  background: rgba(3, 8, 14, 0.65);
  border: 1px solid #334;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.target-meta-info {
  font-size: 0.78rem;
  color: var(--sheikah-cyan);
  margin-bottom: 2px;
  opacity: 0.95;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unknown-badge {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.unknown-count {
  font-size: 1.45rem;
  font-weight: bold;
  color: var(--sheikah-orange);
  text-shadow: 0 0 8px var(--sheikah-orange);
}

.search-status-badge {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  max-width: 55%;
}

.status-indicator {
  font-size: 0.8rem;
  font-weight: bold;
  letter-spacing: 1px;
}
.status-indicator.active {
  color: var(--sheikah-cyan);
  animation: blink-anim 1.5s infinite;
}
.status-indicator.paused {
  color: #889;
}

@keyframes blink-anim {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dual-btn-row {
  display: flex;
  gap: 5px;
  min-width: 0;
}

.dual-btn-row > .btn-sub-control {
  flex: 0 0 calc(50% - 2.5px);
  width: calc(50% - 2.5px);
  min-width: 0;
  height: var(--setting-control-height);
}

.btn-sheikah {
  background: rgba(197, 160, 89, 0.1);
  border: 1.5px solid var(--sheikah-gold);
  color: var(--sheikah-gold);
  padding: 10px;
  font-size: 0.88rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.btn-sheikah:active {
  background: var(--sheikah-gold);
  color: #000;
}

.svg-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.btn-pause-toggle {
  background: rgba(0, 243, 255, 0.12);
  border-color: var(--sheikah-cyan);
  color: var(--sheikah-cyan);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.25);
}
.btn-pause-toggle.paused {
  background: rgba(197, 160, 89, 0.08);
  border-color: #667788;
  color: #8899aa;
  box-shadow: none;
}

.btn-sub-control {
  flex: 1 1 0;
  min-width: 0;
  border-color: #556677;
  color: #778899;
  background: rgba(20, 25, 30, 0.6);
  font-size: 0.78rem;
}
.btn-sub-control.active {
  border-color: var(--sheikah-cyan);
  color: var(--sheikah-cyan);
  background: rgba(0, 243, 255, 0.15);
  box-shadow: 0 0 8px rgba(0, 243, 255, 0.3);
}
/* 3モード・サウンド切替 */
.sound-mode-btn {
  position: relative;
  white-space: nowrap;
  gap: 6px;
  justify-content: flex-start;
}

.sound-mode-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.sound-mode-icon {
  width: 16px;
  height: 16px;
  fill: #667788;
  transition: fill 0.2s, filter 0.2s;
  flex-shrink: 0;
}

.sound-mode-btn.active .sound-mode-icon.active {
  fill: var(--sheikah-cyan);
  filter: drop-shadow(0 0 3px rgba(0, 243, 255, 0.7));
}

.sound-mode-btn:not(.active) .sound-mode-icon {
  fill: #4d5965;
}

.sound-mode-btn:not(.active) .sound-mode-icon.active {
  fill: #9aa7b3;
}

.sound-mode-separator {
  color: #667788;
  flex-shrink: 0;
}

#label-sound-state {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  text-align: center;
}

.sound-mode-toast {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  z-index: 1000;
  width: 100%;
  height: 100%;
  padding: 8px 12px;
  box-sizing: border-box;
  border: 1px solid var(--sheikah-cyan);
  border-radius: 6px;
  background: rgba(10, 17, 22, 0.96);
  color: #d9faff;
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.25);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.sound-mode-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* 2モード・画面点灯切替 */
.wake-mode-btn {
  position: relative;
  white-space: nowrap;
  gap: 6px;
  justify-content: flex-start;
}

.wake-mode-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.wake-mode-icon {
  width: 16px;
  height: 16px;
  fill: #667788;
  stroke: #667788;
  stroke-width: 1.8;
  stroke-linecap: round;
  transition: fill 0.2s, stroke 0.2s, filter 0.2s;
  flex-shrink: 0;
}

.wake-mode-btn.active .wake-mode-icon.active {
  fill: var(--sheikah-cyan);
  stroke: var(--sheikah-cyan);
  filter: drop-shadow(0 0 3px rgba(0, 243, 255, 0.7));
}

.wake-mode-btn:not(.active) .wake-mode-icon {
  fill: #4d5965;
  stroke: #4d5965;
}

.wake-mode-btn:not(.active) .wake-mode-icon.active {
  fill: #9aa7b3;
  stroke: #9aa7b3;
}

.wake-mode-separator {
  color: #667788;
  flex-shrink: 0;
}

#label-wake-state {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  text-align: center;
}

/* 10段階・音量調整 */
.volume-control {
  position: relative;
  white-space: nowrap;
  gap: 4px;
  padding: 0;
  overflow: hidden;
}

.volume-step-btn {
  align-self: stretch;
  width: 36px;
  flex: 0 0 36px;
  border: none;
  background: transparent;
  color: var(--sheikah-cyan);
  font: inherit;
  font-size: 0.72rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.volume-step-btn:active {
  background: rgba(0, 243, 255, 0.22);
}

.volume-label {
  flex: 1;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.volume-control.disabled {
  border-color: #556677;
  color: #667788;
  background: rgba(20, 25, 30, 0.6);
  box-shadow: none;
}

.volume-control.disabled .volume-step-btn {
  color: #4d5965;
  cursor: default;
  pointer-events: none;
}

.volume-control.disabled .volume-label {
  color: #667788;
}

/* 3段階・探知信号の周期倍率 */
.pulse-rate-btn {
  position: relative;
  white-space: nowrap;
  gap: 6px;
  justify-content: flex-start;
}

.pulse-rate-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.pulse-rate-icon {
  width: 16px;
  height: 16px;
  fill: #667788;
  transition: fill 0.2s, filter 0.2s;
  flex-shrink: 0;
}

.pulse-rate-btn .pulse-rate-icon.active {
  fill: var(--sheikah-cyan);
  filter: drop-shadow(0 0 3px rgba(0, 243, 255, 0.7));
}

.pulse-rate-separator {
  color: #667788;
  flex-shrink: 0;
}

#label-pulse-state {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  text-align: center;
}

.app-version-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: #556270;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* 固定フッターナビゲーション */
.app-footer-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--footer-height);
  padding-bottom: var(--footer-bottom-space);
  background: #0d1114;
  border-top: 1.5px solid var(--sheikah-gold);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.85);
}

.footer-nav-btn {
  background: transparent;
  border: none;
  color: #556677;
  padding: 8px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}
.footer-nav-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.8));
}
.footer-nav-btn.active {
  color: var(--sheikah-cyan);
}
.footer-nav-btn.active svg {
  filter: drop-shadow(0 0 8px var(--sheikah-cyan));
}
.footer-nav-btn:active {
  transform: scale(0.9);
}

/* 全スライドページ共通 */
.slide-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - var(--footer-height));
  min-height: 0;
  overflow: hidden;
  background: var(--sheikah-bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
  pointer-events: none;
  visibility: hidden;
  box-shadow: -6px 0 25px rgba(0,0,0,0.85);
}
.slide-page.open {
  transform: translateX(0);
  pointer-events: auto;
  visibility: visible;
}

/* チャレンジ画面（左側からのスライドイン配置） */
#page-challenges {
  transform: translateX(-100%);
  box-shadow: 6px 0 25px rgba(0,0,0,0.85);
  z-index: 110;
}
#page-challenges.open {
  transform: translateX(0);
}

/* ページヘッダー（ノッチ・セーフエリア完全対応） */
.page-header {
  /* Keep mobile browsers from inflating header text after rotation. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  padding-top: calc(max(env(safe-area-inset-top), 24px) + 10px);
  padding-bottom: 12px;
  padding-left: 16px;
  padding-right: 16px;
  background: var(--sheikah-panel);
  border-bottom: 1.5px solid var(--sheikah-gold);
  flex-shrink: 0;
}

.header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.header-left-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.page-title-text {
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--sheikah-gold);
  letter-spacing: 0.5px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.back-btn {
  color: var(--sheikah-cyan);
  background: rgba(0, 243, 255, 0.1);
  border: 1.5px solid var(--sheikah-cyan);
  font-size: 0.82rem;
  font-weight: bold;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.back-btn:active {
  background: var(--sheikah-cyan);
  color: #000;
}

.filter-bar {
  padding: 10px 14px;
  background: rgba(0,0,0,0.4);
  display: flex;
  gap: 8px;
  align-items: center;
  height: 58px;
}

.sheikah-input-wrap {
  flex: 1;
  height: 42px;
  position: relative;
  display: flex;
  align-items: center;
}
.sheikah-input-wrap input {
  width: 100%;
  height: 100%;
  background: rgba(3, 8, 14, 0.9);
  border: 1.5px solid var(--sheikah-gold);
  color: var(--sheikah-cyan);
  padding: 0 32px 0 10px;
  font-size: 0.9rem;
  border-radius: 6px;
  outline: none;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.8);
}
.sheikah-input-wrap input:focus {
  border-color: var(--sheikah-cyan);
  box-shadow: 0 0 8px var(--sheikah-cyan-glow);
}

.sheikah-select-box {
  flex: 1;
  height: 42px;
  background: linear-gradient(180deg, #111 0%, #2b2214 50%, #111 100%);
  border: 1.5px solid var(--sheikah-gold);
  color: var(--sheikah-cyan);
  padding: 0 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: bold;
  outline: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

.action-sub-bar {
  padding: 6px 16px 10px 16px;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.btn-clean-zero {
  background: rgba(255, 77, 77, 0.12);
  border: 1.5px solid var(--sheikah-danger);
  color: var(--sheikah-danger);
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-clean-zero:active {
  background: var(--sheikah-danger);
  color: #fff;
}

.list-scroll {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  padding: 12px 14px calc(64px + env(safe-area-inset-bottom)) 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-item {
  background: rgba(27, 34, 40, 0.95);
  border: 1px solid var(--sheikah-border);
  border-left: 5px solid var(--sheikah-gold);
  padding: 12px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.list-item:active {
  background: rgba(45, 55, 65, 0.95);
}

.list-item-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.list-item-left {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-weight: bold;
  font-size: 1.05rem;
  color: #fff;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  display: block;
}

.list-item-sub {
  font-size: 0.78rem;
  color: #99a;
  margin-top: 4px;
}

.item-right-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-sheikah-sm {
  padding: 6px 12px;
  font-size: 0.76rem;
  font-weight: bold;
  background: rgba(0, 243, 255, 0.12);
  border: 1.5px solid var(--sheikah-cyan);
  color: var(--sheikah-cyan);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-sheikah-sm:active {
  background: var(--sheikah-cyan);
  color: #000;
}
.btn-sheikah-sm.off {
  border-color: #666;
  color: #888;
  background: transparent;
}

.btn-copy-sm {
  border-color: var(--sheikah-gold);
  color: var(--sheikah-gold);
  background: rgba(197, 160, 89, 0.1);
}

.btn-maps-intent {
  border-color: #ffaa00;
  color: #ffbb33;
  background: rgba(255, 170, 0, 0.12);
}
.btn-maps-intent:active {
  background: #ffaa00;
  color: #000;
}

.btn-danger-sm {
  border-color: var(--sheikah-danger);
  color: var(--sheikah-danger);
  background: rgba(255, 77, 77, 0.12);
}
.btn-danger-sm:active {
  background: var(--sheikah-danger);
  color: #fff;
}

.action-button-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px dashed rgba(255,255,255,0.08);
  flex-wrap: wrap;
}

#page-spot-detail {
  z-index: 150;
}
#page-all-history {
  z-index: 140;
}
.spot-detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px calc(64px + env(safe-area-inset-bottom)) 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.detail-card-panel {
  background: rgba(27, 34, 40, 0.95);
  border: 1.5px solid var(--sheikah-gold);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.8);
}
.spot-name-header {
  font-size: 1.25rem;
  font-weight: bold;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 6px;
  word-break: break-word;
}
.spot-address-text {
  font-size: 0.82rem;
  color: #99aabb;
  line-height: 1.4;
  word-break: break-word;
}
.photo-gallery-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.gallery-minimap-wrap {
  flex: 0 0 100%;
  height: 220px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--sheikah-gold);
  box-shadow: 0 0 12px rgba(197, 160, 89, 0.3);
  scroll-snap-align: center;
  background: #03080e;
  position: relative;
}
#detail-minimap {
  width: 100%;
  height: 100%;
}
.minimap-badge {
  position: absolute;
  top: 8px;
  bottom: auto;
  left: 8px;
  background: rgba(3, 8, 14, 0.85);
  border: 1px solid var(--sheikah-cyan);
  color: var(--sheikah-cyan);
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 10px;
  pointer-events: none;
  font-weight: bold;
}

.gallery-img-wrap {
  flex: 0 0 85%;
  height: 220px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--sheikah-cyan);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.25);
  scroll-snap-align: center;
  background: #000;
}
.gallery-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-photos-box {
  padding: 30px 10px;
  text-align: center;
  color: #889;
  font-size: 0.85rem;
  border: 1px dashed #445;
  border-radius: 6px;
}

#toast-banner {
  position: absolute;
  top: calc(max(env(safe-area-inset-top), 32px) + 10px);
  left: 5%;
  width: 90%;
  background: rgba(3, 8, 14, 0.95);
  border: 2px solid var(--sheikah-cyan);
  box-shadow: 0 0 25px var(--sheikah-cyan-glow);
  color: #fff;
  padding: 14px;
  border-radius: 8px;
  text-align: center;
  z-index: 400;
  transform: translateY(-250%);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
}
#toast-banner.show {
  transform: translateY(0);
}

/* Search conditions share the same two-column widths as the controls below. */
.condition-row { position: relative; }
.condition-btn { justify-content: flex-start; gap: 1px; padding: 10px 0 10px 10px; white-space: nowrap; }
.condition-symbols { display: inline-flex; align-items: center; gap: 1px; flex-shrink: 0; }
.condition-icon { width: 14px; height: 16px; flex-shrink: 0; color: #667788; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: color 0.2s, filter 0.2s; }
.condition-star, .condition-question-dot { fill: currentColor; stroke: none; }
.condition-icon.selected { color: var(--sheikah-cyan); filter: drop-shadow(0 0 3px rgba(0, 243, 255, 0.7)); }
.condition-label { display: flex; flex: 1; min-width: 0; align-items: center; justify-content: center; gap: 1px; }
.condition-filter-icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 420px) {
  .condition-icon { width: 16px; }
}
@media (max-width: 360px) {
  .condition-btn { gap: 0; }
  .condition-symbols { gap: 0; }
  .condition-icon { width: 8px; }
  .condition-filter-icon { width: 14px; }
}

/* Keep the complete setting labels readable within each half-width button. */
.bottom-section {
  container-type: inline-size;
  overflow-y: auto;
  gap: 8px;
}
.bottom-section > * { flex-shrink: 0; }
.bottom-section .btn-sub-control {
  font-size: clamp(10px, 3.1cqw, 12.5px);
  letter-spacing: 0;
  gap: 3px;
  padding-inline: 6px;
  line-height: 1.2;
}
#label-sound-state,
#label-wake-state,
#label-pulse-state,
.volume-label,
.condition-label {
  white-space: nowrap;
  overflow-wrap: normal;
}
.sound-mode-icons,
.wake-mode-icons,
.pulse-rate-icons {
  gap: 2px;
}
.sound-mode-icon,
.wake-mode-icon,
.pulse-rate-icon {
  width: clamp(10px, 3.5cqw, 16px);
  height: clamp(10px, 3.5cqw, 16px);
}
.bottom-section .volume-control {
  padding-inline: 0;
  gap: 0;
}
.volume-step-btn {
  width: 28px;
  flex-basis: 28px;
}
.app-version-footer {
  flex-wrap: wrap;
  gap: 2px 8px;
}
@supports (height: 100dvh) {
  :root {
    --main-controls-height: clamp(326px, calc((100dvh - env(safe-area-inset-top) - var(--footer-height)) * 0.46), 420px);
  }
}
/* Short windows retain a useful map and allow the controls to scroll. */
@media (max-height: 650px) {
  #page-main-wrap {
    overflow-y: auto;
    padding-bottom: var(--footer-height);
  }
  .top-section {
    min-height: 260px;
  }
}

.bottom-section {
  --setting-control-height: clamp(44px, calc(var(--main-controls-height) * 0.145), 56px);
  --setting-icon-size: clamp(12px, 3.8cqw, 16px);
}
.sound-mode-icon, .wake-mode-icon, .pulse-rate-icon,
.condition-icon, .condition-filter-icon {
  width: var(--setting-icon-size);
  height: var(--setting-icon-size);
}
.bottom-section .btn-sub-control { overflow: hidden; padding-block: 4px; }
.sound-mode-toast {
  overflow: hidden;
}
.overlay-modal { overflow-y: auto; }
@media (orientation: landscape) {
  #app-container {
    max-width: 960px;
    --landscape-nav-width: calc(54px + env(safe-area-inset-right, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: var(--landscape-nav-width);
  }
  #page-main-wrap {
    flex-direction: row !important;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .top-section {
    width: 45%;
    height: 100%;
    min-height: 0;
    padding: calc(env(safe-area-inset-top) + 36px) 12px 12px;
  }
  .map-top-controls {
    top: calc(env(safe-area-inset-top) + 8px);
    left: 12px;
    right: 12px;
  }
  .app-footer-nav {
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: var(--landscape-nav-width);
    height: 100%;
    flex-direction: column;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) 0;
    border-top: 0;
    border-left: 1.5px solid var(--sheikah-gold);
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.85);
  }
  .footer-nav-btn { padding: 8px; }
  .slide-page {
    left: env(safe-area-inset-left, 0px);
    width: calc(100% - env(safe-area-inset-left, 0px) - var(--landscape-nav-width));
    height: 100%;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .sheikah-divider-bar { width: 6px; height: 100%; }
  .bottom-section {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
  }
  .bottom-section > * { flex-shrink: 0; }
  .slide-page .page-header {
    padding-top: calc(env(safe-area-inset-top) + 8px);
    padding-left: 16px;
    padding-right: 16px;
  }
  .slide-page .list-scroll { padding-bottom: 16px; }
  .overlay-modal { justify-content: flex-start; padding-block: 16px; }
}

/* Compact standalone navigation; browser spacing remains unchanged. */
@media (display-mode: standalone) {
  :root {
    --footer-control-height: 48px;
    --footer-bottom-space: 4px;
  }
}
:root.is-standalone {
  --footer-control-height: 48px;
  --footer-bottom-space: 4px;
}
.footer-nav-btn { min-width: 44px; min-height: 44px; }
.volume-step-btn { height: 100%; }

/* Keep the mode label on one line, matching the other setting controls. */
.lock-question { stroke-width: 2; }
.lock-question-dot { fill: currentColor; stroke: none; }
.circle-map-wrapper.signal-level1-half {
  --map-ring-shadow: 0 0 26px var(--sheikah-cyan), inset 0 0 12px var(--sheikah-cyan);
  animation: ring-pulse-1 2.05s infinite ease-in-out;
}
.circle-map-wrapper.signal-level2-half {
  --map-ring-shadow: 0 0 37px var(--sheikah-cyan), inset 0 0 16px #fff;
  animation: ring-pulse-2 1.15s infinite ease-in-out;
}
.circle-map-wrapper.signal-level3-half {
  --map-ring-shadow: 0 0 48px var(--sheikah-cyan), 0 0 25px var(--sheikah-orange), inset 0 0 21px #fff;
  animation: ring-pulse-3 0.625s infinite ease-in-out;
}
.circle-map-wrapper.signal-level4-half {
  --map-ring-shadow: 0 0 62px var(--sheikah-orange), 0 0 35px var(--sheikah-cyan), inset 0 0 28px #fff;
  animation: ring-pulse-4 0.35s infinite ease-in-out;
  border: 2px solid #fff;
}
.day-mode .circle-map-wrapper.signal-level1-half {
  --map-ring-shadow: 0 0 26px var(--botw-yellow), inset 0 0 12px var(--botw-yellow);
}
.day-mode .circle-map-wrapper.signal-level2-half {
  --map-ring-shadow: 0 0 37px var(--botw-yellow), inset 0 0 16px #fff;
}
.day-mode .circle-map-wrapper.signal-level3-half {
  --map-ring-shadow: 0 0 48px var(--botw-yellow), 0 0 25px var(--botw-amber), inset 0 0 21px #fff;
}
.day-mode .circle-map-wrapper.signal-level4-half {
  --map-ring-shadow: 0 0 62px var(--botw-amber), 0 0 35px var(--botw-yellow), inset 0 0 28px #fff;
  border: 2px solid var(--botw-yellow);
}

/* Challenge progression and unavailable controls. aria-disabled retains explanation taps. */
.condition-btn.feature-locked { opacity: .5; cursor: default; }
#condition-mode-toast { white-space: pre-line; }
.challenge-help { padding: 12px 16px; font-size: .8rem; line-height: 1.6; color: var(--sheikah-gold); }
.challenge-active { flex-direction: row; align-items: center; justify-content: space-between; }
.challenge-row .list-item-left { min-width: 0; }
.challenge-row .list-item-title { overflow-wrap: anywhere; }
.challenge-set { flex-shrink: 0; }
.challenge-set:disabled { opacity: .35; cursor: default; }
.challenge-milestone, .challenge-milestone:active { margin: 0; width: 100%; box-sizing: border-box; border-color: var(--sheikah-gold); background: rgba(180, 140, 60, .1); color: var(--sheikah-gold); cursor: default; }
.challenge-milestone .list-item-title { color: inherit; }
.challenge-milestone.achieved { border-color: #75bd93; color: #75bd93; }
.challenge-dialog { position: fixed; inset: 0; margin: auto; height: fit-content; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow-y: auto; width: min(360px, 85vw); border: 1px solid var(--sheikah-gold); border-radius: 12px; padding: 24px; background: #101c25; color: #fff; }
.challenge-dialog::backdrop { background: rgba(0, 0, 0, .7); }
.challenge-dialog-actions { display: flex; justify-content: flex-end; gap: 16px; margin-top: 24px; }
.rewarded-access-dialog { padding-top: 56px; }
.rewarded-access-dialog h2 { font-size: 18px; margin-top: 0; }
.rewarded-access-dialog p { line-height: 1.7; }
.rewarded-access-dialog .challenge-dialog-actions { flex-wrap: wrap; gap: 12px; }
.rewarded-access-dialog button { white-space: normal; }
#rewarded-access-status { color: #f5ce70; }
#applixir-ad-container:not([hidden]) { position: fixed; inset: 0; z-index: 20000; background: #000; }

#page-challenge-keywords { z-index: 125; }
.challenge-row.challenge-locked { background: rgba(22, 27, 32, .95); border-color: #49525b; border-left-color: #63707c; }
.challenge-row.challenge-locked .list-item-title { color: #929ca6; }
.challenge-row.challenge-locked .list-item-sub { color: #78838e; }
.challenge-row.challenge-locked .challenge-set { border-color: #63707c; color: #929ca6; background: rgba(99, 112, 124, .08); }
.challenge-completed-check, .challenge-completed-label, .arrival-count-number { color: var(--sheikah-gold); }
.arrival-count-number { font-weight: 800; font-size: 1.2em; font-variant-numeric: tabular-nums; }
.challenge-history-arrow { color: var(--sheikah-gold); font-size: 1.3rem; }
.challenge-row.challenge-locked .challenge-history-arrow { color: #63707c; }
#challenge-arrivals-title { min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }

.status-panel { gap: 8px; }
.status-panel > div:first-child { flex: 1; min-width: 0; }
.unknown-badge #label-detecting { min-width: 0; line-height: 1.4; }
.unknown-badge #label-unvisited, .unknown-count { flex-shrink: 0; }

/* Challenge names are display-only during a run; keep Safari from focusing/zooming. */
#keyword-input:disabled { opacity: 1; color: var(--sheikah-cyan); -webkit-text-fill-color: var(--sheikah-cyan); }
.challenge-dialog:focus, .challenge-dialog :focus,
.challenge-row:focus, .challenge-row button:focus,
#title-page-challenges:focus { outline: none; }
.challenge-dialog button:focus-visible,
.challenge-row .challenge-set:focus-visible { outline: 2px solid var(--sheikah-gold); outline-offset: 2px; }

/* Let the radius control receive taps while challenge settings are fixed. */
.dial-select-overlay:disabled { pointer-events: none; }

.location-access-notice {
  padding: 10px 12px;
  border: 1px solid var(--sheikah-cyan);
  border-radius: 8px;
  color: var(--sheikah-cyan);
  background: rgba(0, 243, 255, 0.06);
  font-size: 0.8rem;
  line-height: 1.6;
}
.location-access-notice[hidden] { display: none; }
.location-access-notice button {
  display: block;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid var(--sheikah-cyan);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.location-access-notice button[hidden] { display: none; }

/* Detail map fills remaining space while keeping the renderer's zoom unchanged. */
.spot-detail-content { min-height: 0; gap: 10px; padding: 12px 16px 12px; }
.detail-card-panel { flex: 0 0 auto; padding: 12px; }
#detail-gallery-header { flex: 0 0 auto; }
#detail-map-container { display: flex; flex: 1 0 260px; min-height: 260px; }
#detail-map-container .photo-gallery-scroll { flex: 1; min-width: 0; padding-bottom: 0; }
#detail-map-container .gallery-minimap-wrap { height: auto; min-height: 260px; box-sizing: border-box; }
.detail-navigation { display: flex; gap: 16px; justify-content: center; flex: 0 0 auto; }
.detail-navigation button { min-width: 80px; min-height: 48px; font-size: 1.35rem; justify-content: center; text-align: center; }
.detail-navigation button:disabled { opacity: 0.3; cursor: default; box-shadow: none; }
#all-history-count { color: #99aabb; font-size: 0.8rem; margin-left: 12px; }
#page-all-history .page-header { justify-content: flex-start; flex-wrap: wrap; }

/* Challenge announcements float above navigation without blocking map gestures. */
.challenge-presentation {
  --announcement-color: #e9dda0;
  --announcement-tint: rgba(218, 207, 145, .58);
  --announcement-center: rgba(239, 228, 171, .76);
  position: absolute;
  inset: calc(env(safe-area-inset-top, 0px) + 76px) 0 auto;
  z-index: 450;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}
.challenge-presentation.is-complete {
  --announcement-color: #ffe9a2;
  --announcement-tint: rgba(224, 193, 98, .65);
  --announcement-center: rgba(248, 224, 139, .8);
}
.challenge-presentation.is-visible {
  visibility: visible;
  opacity: 1;
  animation: challenge-announcement .6s ease both;
}
.challenge-presentation.is-visible.is-leaving { animation: challenge-announcement-fade 1.4s ease both; }
.challenge-presentation-band {
  position: relative;
  overflow: hidden;
  padding: 16px 24px 18px;
  text-align: center;
  color: #252317;
  background: linear-gradient(90deg, transparent, var(--announcement-tint) 14%, var(--announcement-center) 50%, var(--announcement-tint) 86%, transparent);
  border-block: 1px solid var(--announcement-color);
  box-shadow: 0 0 22px color-mix(in srgb, var(--announcement-color) 20%, transparent);
  text-shadow: 0 1px 2px rgba(255, 249, 211, .5);
}
.challenge-presentation-band::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 225, .45) 50%, transparent 65%);
  transform: translateX(-110%);
}
.is-visible .challenge-presentation-band::before { animation: challenge-light-sweep 1.1s .12s ease-out both; }
.challenge-presentation-label {
  color: #595032;
  font-size: 11px;
  letter-spacing: .18em;
  margin-bottom: 8px;
}
.challenge-presentation-label::before { content: '◇'; margin-right: 8px; }
.challenge-presentation-name {
  font-size: clamp(20px, 6cqw, 30px);
  font-weight: 900;
  font-style: italic;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.challenge-presentation-state {
  color: #595032;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  letter-spacing: .14em;
  margin-top: 10px;
}
.is-complete .challenge-presentation-state {
  color: #fff9df;
  text-shadow: 0 1px 4px rgba(100, 73, 19, .8);
  font-size: 27px;
  letter-spacing: .06em;
}
.is-visible .challenge-presentation-state { animation: challenge-state-reveal .4s .35s both; }
.is-visible.is-complete .challenge-presentation-state { animation-delay: 1.5s; }
.challenge-presentation-place {
  margin: 10px 0;
  font-size: clamp(18px, 5cqw, 22px);
  font-weight: 800;
  line-height: 1.6;
  color: #252317;
  overflow-wrap: anywhere;
}
.is-place-visible .challenge-presentation-place { animation: challenge-state-reveal .6s ease both; }
.challenge-presentation-name[hidden],
.challenge-presentation-state[hidden],
.challenge-presentation-place[hidden] { display: none; }
.is-complete.is-arrival .challenge-presentation-place[hidden] {
  display: block;
  visibility: hidden;
}
.is-complete .challenge-presentation-band::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 10% 30%, #ffe9a2 0 1px, transparent 3px), radial-gradient(circle at 80% 20%, #fff6d7 0 1px, transparent 3px), radial-gradient(circle at 90% 75%, #ffe9a2 0 1px, transparent 3px), radial-gradient(circle at 20% 85%, #fff6d7 0 1px, transparent 3px);
}
.is-visible.is-complete .challenge-presentation-band::after { animation: challenge-state-reveal .8s .25s both; }
@keyframes challenge-announcement {
  0% { opacity: 0; clip-path: inset(0 50%); }
  100% { opacity: 1; clip-path: inset(0); }
}
@keyframes challenge-announcement-fade { from { opacity: 1; } to { opacity: 0; } }
@keyframes challenge-light-sweep { to { transform: translateX(110%); } }
@keyframes challenge-state-reveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .challenge-presentation.is-visible { animation: none; opacity: 1; }
  .challenge-presentation.is-visible.is-leaving { animation: none; opacity: 0; }
  .is-visible .challenge-presentation-state,
  .is-place-visible .challenge-presentation-place,
  .is-visible .challenge-presentation-band::before,
  .is-visible.is-complete .challenge-presentation-band::after { animation: none; }
}

/* Stable volume layout: only bar brightness and the numeric value change. */
#volume-mode-toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 4ch;
  gap: 10px;
  font-size: clamp(8px, 2.5vw, 13px);
  white-space: nowrap;
}
.volume-toast-label { text-align: left; }
.volume-toast-bars {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 3px;
  height: 18px;
  align-items: stretch;
}
.volume-toast-bars > span {
  width: 2px;
  max-width: 100%;
  justify-self: center;
  background: var(--sheikah-cyan);
  opacity: 0.18;
}
.volume-toast-bars > span.active { opacity: 1; }
.volume-toast-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Visual installation guide, scoped to keep the safety dialog unchanged. */
#pwa-prompt-overlay { overflow-y: auto; justify-content: flex-start; padding: 20px 16px; }
#pwa-prompt-overlay .pwa-relic-box { margin: auto; padding: 18px 16px; flex-shrink: 0; }
#pwa-prompt-overlay .pwa-icon-img { width: 44px; height: 44px; margin: 4px auto 12px; }
#pwa-prompt-overlay .pwa-desc { text-align: center; margin-bottom: 14px; }
#pwa-prompt-overlay .pwa-step-card { padding: 12px; gap: 14px; margin-bottom: 12px; }
#pwa-prompt-overlay .pwa-step-item { align-items: flex-start; }
#pwa-prompt-overlay .pwa-step-num { margin-top: 2px; }
.pwa-step-content { flex: 1; min-width: 0; line-height: 1.5; }
.pwa-menu-picture { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 10px; background: #f0f0f2; color: #16181b; border: 2px solid var(--sheikah-cyan); border-radius: 10px; }
.pwa-menu-picture svg { width: 30px; height: 30px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.pwa-menu-picture strong { font-size: .88rem; }
.pwa-tap-mark { margin-left: auto; color: #007a86; font-size: 1.5rem; font-weight: bold; }
.pwa-confirm-picture { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; padding: 10px; background: #f0f0f2; color: #16181b; border-radius: 10px; font-size: .75rem; }
.pwa-confirm-picture strong { border: 2px solid var(--sheikah-cyan); border-radius: 7px; padding: 5px 8px; color: #006fbd; }
.pwa-launch-hint { display: flex; align-items: center; justify-content: center; gap: 10px; color: #e0f8ff; font-size: .8rem; }
.pwa-launch-hint img { width: 36px; height: 36px; border-radius: 8px; }
.pwa-platform-note { color: #b0c4de; font-size: .7rem; line-height: 1.5; text-align: left; margin: 12px 0 6px; }

.pwa-browser-help { padding: 12px; margin-bottom: 12px; border-left: 3px solid var(--sheikah-gold); background: rgba(197,160,89,.09); text-align: left; color: #e0f8ff; font-size: .8rem; line-height: 1.6; }
.pwa-browser-help strong { color: var(--sheikah-gold); }
.pwa-browser-help p { margin: 6px 0 0; }
.pwa-example-note { color: #e0f8ff; font-size: .78rem; line-height: 1.6; text-align: left; margin: 0 0 12px; }
.pwa-screen-example { margin-top: 6px; background: #dadce0; color: #16181b; border: 1px solid #8d939b; border-radius: 3px; overflow: hidden; pointer-events: none; user-select: none; }
.pwa-crop-neighbor { height: 15px; overflow: hidden; padding: 0 10px; line-height: 24px; font-size: .8rem; color: #656970; white-space: nowrap; }
.pwa-crop-neighbor:first-child { line-height: 16px; }
.pwa-address-context { font-size: .7rem; text-align: center; }
.pwa-screen-example .pwa-menu-picture { margin: 3px 5px; padding: 8px; border: 0; border-radius: 0; outline: 2px dashed #007a86; outline-offset: -2px; }
.pwa-screen-example .pwa-confirm-picture { margin: 3px 5px; border-radius: 0; }
.pwa-screen-example .pwa-confirm-picture strong { border: 2px dashed #007a86; border-radius: 0; }

.pwa-browser-help .pwa-menu-picture strong { color: #16181b; }

.pwa-home-example { margin: 8px 0 16px; }
.pwa-home-picture { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; }
.pwa-home-example figcaption { margin-top: 6px; font-size: .72rem; color: #b0c4de; line-height: 1.5; text-align: left; }
.pwa-step-content .pwa-home-example { margin-bottom: 0; }

.pwa-home-picture { margin: 0 auto; }

/* Keep sensor help outside the scrolling controls so it can overlay the map. */
.sensor-explanation-diagram {
  display: none;
  position: absolute;
  z-index: 1000;
  top: clamp(70px, 20dvh, 230px);
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100% - 32px));
  height: auto;
  max-height: calc(35dvh + 62px);
  box-sizing: border-box;
  padding: 48px 0 12px;
  object-fit: contain;
  border: 1px solid var(--sheikah-cyan);
  border-radius: 8px;
  background: var(--sheikah-bg);
  pointer-events: none;
}
#app-container:has(#condition-mode-toast.show.has-sensor-diagram) > .sensor-explanation-diagram {
  display: block;
}
@media (orientation: landscape) {
  .sensor-explanation-diagram {
    left: 22%;
    top: 28%;
    width: 40%;
  }
}

.sensor-explanation-diagram > img {
  display: block;
  width: 100%;
  max-height: 35dvh;
  object-fit: contain;
  border-radius: inherit;
}
.sensor-explanation-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--sheikah-cyan);
  border-radius: 6px;
  background: var(--sheikah-bg);
  color: var(--sheikah-cyan);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}
.sensor-explanation-close:focus-visible {
  outline: 2px solid var(--sheikah-cyan);
  outline-offset: 2px;
}
