/* ============================================================
   GPS 속도계
   ============================================================ */

:root {
  --bg: #f7f5ef;

  --card: #ffffff;

  --surface-soft: #f1eee5;

  --line: #dfdcd3;

  --text: #252521;

  --text-soft: #74736c;

  --brand: #343831;

  --accent: #4c8061;

  --accent-soft: #e5f1e8;

  --blue: #47759b;

  --blue-soft: #e7f1fb;

  --warning: #ac7b2b;

  --warning-soft: #fff5dc;

  --danger: #a9574d;

  --danger-soft: #f7e9e6;

  --radius-lg: 22px;

  --radius-md: 14px;
}

/* ============================================================
   RESET
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;

  min-width: 320px;

  min-height: 100vh;

  overflow-x: hidden;

  background: var(--bg);

  color: var(--text);

  font-family:
    -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard',
    'Noto Sans KR', 'Malgun Gothic', sans-serif;

  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

/* ============================================================
   PAGE
   ============================================================ */

.speed-page {
  width: min(100%, 560px);

  min-height: 100vh;

  margin: 0 auto;

  padding: max(18px, env(safe-area-inset-top)) 16px
    max(28px, env(safe-area-inset-bottom));
}

/* ============================================================
   HEADER
   ============================================================ */

.speed-header {
  margin-bottom: 15px;
}

.speed-brand {
  display: flex;

  align-items: center;

  gap: 12px;
}

.speed-icon {
  width: 48px;
  height: 48px;

  flex: 0 0 48px;

  display: grid;

  place-items: center;

  border-radius: 15px;

  background: #e9e4d7;

  font-size: 24px;
}

.speed-brand-copy {
  min-width: 0;
}

.title-row {
  display: flex;

  align-items: center;

  gap: 7px;

  flex-wrap: wrap;
}

.speed-brand h1 {
  margin: 0;

  font-size: 22px;

  line-height: 1.25;

  letter-spacing: -0.6px;
}

.speed-brand p {
  margin: 4px 0 0;

  color: var(--text-soft);

  font-size: 13px;

  line-height: 1.45;
}

.mobile-badge {
  display: inline-flex;

  align-items: center;

  padding: 3px 7px;

  border-radius: 999px;

  background: var(--blue-soft);

  color: #416c98;

  font-size: 9px;

  font-weight: 800;

  white-space: nowrap;
}

/* ============================================================
   MAIN
   ============================================================ */

.speed-main {
  display: flex;

  flex-direction: column;

  gap: 14px;
}

/* ============================================================
   GPS MESSAGE
   ============================================================ */

.gps-message {
  min-height: 31px;

  display: flex;

  align-items: center;
  justify-content: center;

  gap: 7px;

  color: var(--text-soft);

  font-size: 12px;

  text-align: center;
}

.gps-dot {
  width: 8px;
  height: 8px;

  flex: 0 0 8px;

  border-radius: 50%;

  background: #bbb8ae;

  transition:
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.gps-message.is-searching .gps-dot {
  background: #d99b3c;

  box-shadow: 0 0 0 4px rgba(217, 155, 60, 0.1);
}

.gps-message.is-running .gps-dot {
  background: #5fa36c;

  box-shadow: 0 0 0 4px rgba(95, 163, 108, 0.11);
}

.gps-message.is-paused .gps-dot {
  background: #94928c;
}

.gps-message.is-error .gps-dot {
  background: #b75b52;

  box-shadow: 0 0 0 4px rgba(183, 91, 82, 0.1);
}

/* ============================================================
   SPEED CARD
   ============================================================ */

.speed-card {
  padding: 17px;

  border: 1px solid var(--line);

  border-radius: var(--radius-lg);

  background: var(--card);

  box-shadow: 0 10px 30px rgba(34, 31, 24, 0.055);
}

/* ============================================================
   CARD TOP
   ============================================================ */

.speed-card-top {
  min-height: 25px;

  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 8px;
}

.gps-quality,
.speed-source {
  display: inline-flex;

  align-items: center;

  padding: 4px 8px;

  border-radius: 999px;

  font-size: 9px;

  font-weight: 800;

  line-height: 1.3;

  white-space: nowrap;
}

.gps-quality {
  background: #efede8;

  color: #77756e;
}

.gps-quality.is-good {
  background: var(--accent-soft);

  color: #497656;
}

.gps-quality.is-medium {
  background: var(--warning-soft);

  color: #926a25;
}

.gps-quality.is-poor {
  background: var(--danger-soft);

  color: #95534a;
}

.speed-source {
  background: #f2f1ed;

  color: #88867f;
}

/* ============================================================
   CURRENT SPEED
   ============================================================ */

.current-speed {
  padding: 21px 0 17px;

  text-align: center;
}

.current-speed-label {
  margin-bottom: 4px;

  color: var(--text-soft);

  font-size: 11px;

  font-weight: 700;
}

.speed-number-row {
  display: flex;

  align-items: flex-end;
  justify-content: center;

  gap: 7px;

  min-height: 74px;
}

.speed-number-row strong {
  min-width: 130px;

  font-size: 68px;

  font-weight: 800;

  line-height: 0.95;

  letter-spacing: -4px;

  font-variant-numeric: tabular-nums;
}

.speed-number-row span {
  padding-bottom: 8px;

  color: var(--text-soft);

  font-size: 13px;

  font-weight: 800;
}

/* ============================================================
   SPEED METER
   ============================================================ */

.speed-meter {
  margin-bottom: 16px;
}

.speed-meter-scale {
  display: flex;

  align-items: center;
  justify-content: space-between;

  margin-bottom: 5px;

  color: #aaa8a1;

  font-size: 8px;

  font-variant-numeric: tabular-nums;
}

.speed-meter-track {
  width: 100%;
  height: 8px;

  overflow: hidden;

  border-radius: 999px;

  background: #eceae4;
}

.speed-meter-fill {
  width: 0%;
  height: 100%;

  border-radius: inherit;

  background: linear-gradient(90deg, #6e9b7b, #d8a145);

  transition: width 0.25s ease;
}

/* ============================================================
   STATS
   ============================================================ */

.stats-grid {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 7px;
}

.stat-card {
  min-width: 0;

  padding: 11px 10px;

  border: 1px solid #ece9e0;

  border-radius: 13px;

  background: #faf9f5;
}

.stat-label {
  display: block;

  margin-bottom: 3px;

  color: var(--text-soft);

  font-size: 9px;

  font-weight: 700;
}

.stat-card strong {
  display: inline;

  font-size: 16px;

  font-weight: 800;

  font-variant-numeric: tabular-nums;
}

.stat-card small {
  margin-left: 3px;

  color: #aaa79f;

  font-size: 8px;
}

/* ============================================================
   GPS INFO
   ============================================================ */

.gps-info-grid {
  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 5px;

  margin-top: 8px;

  padding-top: 9px;

  border-top: 1px solid #efede6;
}

.gps-info-item {
  min-width: 0;

  text-align: center;
}

.gps-info-item span {
  display: block;

  color: var(--text-soft);

  font-size: 8px;
}

.gps-info-item strong {
  display: block;

  overflow: hidden;

  margin-top: 2px;

  font-size: 10px;

  font-weight: 800;

  text-overflow: ellipsis;

  white-space: nowrap;

  font-variant-numeric: tabular-nums;
}

/* ============================================================
   CONTROLS
   ============================================================ */

.speed-controls {
  display: grid;

  grid-template-columns: 1.35fr 1fr 0.9fr;

  gap: 6px;
}

.control-button {
  min-width: 0;

  min-height: 47px;

  padding: 8px 7px;

  border: 1px solid var(--line);

  border-radius: 13px;

  background: #fff;

  color: var(--text);

  cursor: pointer;

  font-size: 11px;

  font-weight: 800;

  white-space: nowrap;

  -webkit-tap-highlight-color: transparent;
}

.control-button.primary {
  border-color: var(--brand);

  background: var(--brand);

  color: #fff;
}

.control-button.danger {
  color: #8c5751;
}

.control-button:disabled {
  opacity: 0.4;

  cursor: default;
}

/* ============================================================
   GPS NOTICE
   ============================================================ */

.gps-notice {
  padding: 13px 14px;

  border: 1px solid #e8d9b5;

  border-radius: 15px;

  background: #fff6e2;

  color: #785e2f;
}

.gps-notice strong {
  display: block;

  font-size: 12px;
}

.gps-notice p {
  margin: 4px 0 0;

  font-size: 10px;

  line-height: 1.5;
}

/* ============================================================
   INFO
   ============================================================ */

.speed-info {
  padding: 15px 16px;

  border: 1px solid #e2ded4;

  border-radius: 16px;

  background: rgba(255, 255, 255, 0.55);

  color: #66635c;

  font-size: 11px;

  line-height: 1.65;
}

.speed-info-title {
  margin-bottom: 6px;

  color: #343431;

  font-size: 12px;

  font-weight: 800;
}

.speed-info p {
  margin: 0;
}

.speed-info p + p {
  margin-top: 6px;
}

.privacy-note {
  color: #52705c;
}

.warning-note {
  color: #9a5f39;

  font-weight: 700;
}

/* ============================================================
   UNSUPPORTED
   ============================================================ */

.unsupported-box {
  padding: 14px;

  border-radius: 14px;

  background: var(--danger-soft);

  color: #935249;

  text-align: center;

  font-size: 11px;

  line-height: 1.65;
}

/* ============================================================
   FOOTER
   ============================================================ */

.speed-footer {
  padding: 20px 0 4px;

  color: #aaa69c;

  text-align: center;

  font-size: 11px;
}

/* ============================================================
   SMALL MOBILE
   ============================================================ */

@media (max-width: 390px) {
  .speed-page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .speed-card {
    padding: 14px;
  }

  .speed-number-row strong {
    font-size: 60px;

    letter-spacing: -3px;
  }

  .speed-controls {
    gap: 5px;
  }

  .control-button {
    padding-left: 4px;
    padding-right: 4px;

    font-size: 10px;
  }
}
