:root {
  color-scheme: light;
  --bg: #f6fbf8;
  --surface: #ffffff;
  --surface-strong: #eefaf3;
  --text: #253744;
  --muted: #66747b;
  --line: #d8e7df;
  --green: #27d884;
  --green-deep: #0b6b57;
  --green-soft: #dff8eb;
  --amber: #d98919;
  --amber-soft: #fff1d6;
  --red: #c23b30;
  --red-soft: #ffe0dd;
  --blue: #2f4050;
  --shadow: 0 18px 45px rgba(37, 55, 68, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(39, 216, 132, 0.16), transparent 260px),
    var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.eyebrow,
.panel-label,
.route-point p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: 28px;
  line-height: 1.1;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--green-deep);
  box-shadow: 0 8px 20px rgba(20, 32, 29, 0.08);
}

.icon-button svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-panel {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(39, 216, 132, 0.24);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.watch-grid {
  display: grid;
  gap: 10px;
}

.watch-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(39, 216, 132, 0.24);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(20, 32, 29, 0.08);
}

.watch-card .score-badge {
  min-width: 86px;
  min-height: 54px;
  padding: 10px 12px;
}

.watch-card .score-badge strong {
  display: none;
}

.watch-card.is-waiting {
  grid-template-columns: 1fr;
}

.watch-card.is-waiting .score-badge {
  display: none;
}

.watch-card h2 {
  margin-top: 5px;
  font-size: 18px;
}

.watch-card p:last-child {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.inline-link {
  display: inline;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--green);
  font-weight: 900;
  text-decoration: underline;
}

.status-panel h2 {
  margin-top: 6px;
  font-size: 24px;
}

.status-panel p:last-child {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.score-badge {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 8px;
}

.score-badge span {
  font-size: 13px;
  font-weight: 900;
}

.score-badge strong {
  font-size: 32px;
  line-height: 1;
}

.warning {
  background: var(--amber-soft);
  color: #8f5100;
}

.waiting {
  background: #eef2f7;
  color: #56606b;
}

.safe {
  background: var(--green-soft);
  color: var(--green);
}

.danger {
  background: var(--red-soft);
  color: var(--red);
}

.route-card {
  display: grid;
  grid-template-columns: 1fr 34px 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.notification-panel {
  display: none;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.status-guide {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.status-guide-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.status-guide-item strong {
  font-size: 13px;
}

.status-guide-item span {
  color: inherit;
  opacity: 0.86;
}

.map-header,
.my-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.map-header h2,
.section-title h2 {
  margin-top: 5px;
  font-size: 17px;
}

.map-header p:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.map-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.map-header-compact {
  display: none;
}

.map-header button {
  min-width: 78px;
  min-height: 42px;
  padding: 0 12px;
}

.notification-panel h2 {
  margin-top: 5px;
  font-size: 17px;
}

.notification-panel p:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.notification-panel button {
  min-width: 92px;
  min-height: 42px;
  padding: 0 12px;
}

.route-point {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.route-point strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.dot.home {
  background: var(--green);
}

.dot.work {
  background: var(--blue);
}

.route-line {
  height: 2px;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.map-preview {
  position: relative;
  overflow: hidden;
  height: 255px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e8eee9;
}

.kakao-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
}

.kakao-map.loaded {
  opacity: 1;
}

.user-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 18px;
  height: 18px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 10px rgba(43, 101, 217, 0.18), 0 8px 18px rgba(20, 32, 29, 0.22);
  transform: translate(-50%, -50%);
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(20, 32, 29, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 29, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
}

.kakao-map.loaded + .map-grid,
.kakao-map.loaded ~ .station-marker {
  display: none;
}

.map-preview::before,
.map-preview::after {
  position: absolute;
  content: "";
  border-radius: 999px;
  background: rgba(11, 107, 87, 0.14);
}

.map-preview::before {
  width: 260px;
  height: 26px;
  left: -28px;
  top: 82px;
  transform: rotate(-19deg);
}

.map-preview::after {
  width: 230px;
  height: 22px;
  right: -26px;
  bottom: 72px;
  transform: rotate(26deg);
}

.station-marker {
  position: absolute;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 10px 20px rgba(20, 32, 29, 0.2);
  font-weight: 900;
  transform: translate(-50%, -50%);
}

.map-count-marker {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 10px 20px rgba(20, 32, 29, 0.2);
  font-weight: 900;
  transform: translateY(-4px);
}

.map-count-marker.selected {
  outline: 4px solid var(--blue);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}

.tabbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tab-button {
  min-height: 40px;
  background: transparent;
  color: var(--muted);
}

.tab-button.active {
  background: var(--green);
  color: var(--text);
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}

.time-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(11, 107, 87, 0.18);
  border-radius: 8px;
  background: var(--surface-strong);
}

.time-strip span,
.time-strip p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.time-strip strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
}

.place-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.alarm-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.alarm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.alarm-targets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.alarm-targets label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.alarm-targets input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.alarm-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.alarm-grid input {
  width: 100%;
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0 10px;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.alarm-panel button {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
}

.place-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.place-form input,
.place-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

.place-form button {
  min-height: 44px;
}

.place-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.place-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.place-card span {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.place-card h3 {
  margin: 4px 0 0;
  font-size: 15px;
}

.place-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.place-actions {
  display: grid;
  gap: 6px;
}

.place-actions button {
  min-width: 54px;
  min-height: 32px;
  padding: 0 8px;
  background: var(--text);
  font-size: 12px;
}

.section-help {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.section-header h2 {
  font-size: 18px;
}

.section-header button {
  min-height: 38px;
  padding: 0 12px;
  background: var(--text);
  font-size: 14px;
}

.station-list {
  display: grid;
  gap: 10px;
}

.station-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.station-card.highlighted {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(43, 101, 217, 0.16);
}

.station-card h3 {
  margin: 0;
  font-size: 16px;
}

.station-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.station-pill {
  min-width: 72px;
  padding: 9px 10px;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 32, 29, 0.42);
}

.modal-backdrop[hidden] {
  display: none;
}

.install-modal {
  width: min(100%, 430px);
  max-height: min(86vh, 680px);
  overflow: auto;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.modal-header h2 {
  font-size: 20px;
}

.modal-close {
  min-height: 36px;
  padding: 0 12px;
  background: var(--text);
  font-size: 13px;
}

.install-guide-list {
  display: grid;
  gap: 10px;
}

.install-guide-list article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.install-guide-list h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.install-guide-list ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

@media (min-width: 760px) {
  .app-shell {
    padding-top: 32px;
  }
}
