/* ============================================================
   오늘 밤 별자리 찾기
   ============================================================ */

:root {
  --sky-bg: #f7f5ef;
  --sky-card: #ffffff;
  --sky-line: #dedbd1;

  --sky-text: #242424;
  --sky-muted: #77756d;

  --sky-dark: #30302e;

  --sky-blue: #416c98;
  --sky-blue-soft: #e8f2ff;

  --sky-purple: #66568e;
  --sky-purple-soft: #eee9f7;

  --sky-gold: #a87824;
  --sky-gold-soft: #fff3d8;

  --sky-good: #428653;
  --sky-good-soft: #e7f3e9;

  --sky-warning: #aa792b;
  --sky-warning-soft: #fff4dc;

  --sky-error: #a84f47;
  --sky-error-soft: #f8e9e7;

  --radius-lg: 22px;
  --radius-md: 15px;
}

/* ============================================================
   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(--sky-bg);

  color: var(--sky-text);

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

  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

.sky-page {
  width: min(100%, 620px);

  min-height: 100vh;

  margin: 0 auto;

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

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

.sky-header {
  margin-bottom: 17px;
}

.sky-brand {
  display: flex;

  align-items: center;

  gap: 12px;
}

.sky-icon {
  width: 50px;
  height: 50px;

  flex: 0 0 50px;

  display: grid;

  place-items: center;

  border-radius: 16px;

  background: linear-gradient(145deg, #e9e4f0, #e8e1d5);

  font-size: 26px;
}

.sky-heading {
  flex: 1;

  min-width: 0;
}

.sky-title-row {
  display: flex;

  align-items: center;

  flex-wrap: wrap;

  gap: 7px;
}

.sky-heading h1 {
  margin: 0;

  font-size: 22px;

  line-height: 1.25;

  letter-spacing: -0.7px;
}

.sky-heading p {
  margin: 4px 0 0;

  color: var(--sky-muted);

  font-size: 13px;

  line-height: 1.5;
}

.mobile-badge {
  display: inline-flex;

  align-items: center;

  min-height: 22px;

  padding: 3px 8px;

  border-radius: 999px;

  background: var(--sky-blue-soft);

  color: var(--sky-blue);

  font-size: 9px;

  font-weight: 800;

  white-space: nowrap;
}

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

.sky-main {
  display: flex;

  flex-direction: column;

  gap: 14px;
}

/* ============================================================
   INTRO
   ============================================================ */

.intro-card {
  display: flex;

  align-items: center;

  gap: 13px;

  padding: 15px 16px;

  border: 1px solid #e3ddec;

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

  background: linear-gradient(135deg, #f6f2fa, #fbf8f2);
}

.intro-icon {
  width: 42px;
  height: 42px;

  flex: 0 0 42px;

  display: grid;

  place-items: center;

  border-radius: 13px;

  background: #ffffff;

  font-size: 21px;
}

.intro-copy {
  min-width: 0;
}

.intro-copy strong {
  display: block;

  margin-bottom: 3px;

  font-size: 13px;
}

.intro-copy p {
  margin: 0;

  color: var(--sky-muted);

  font-size: 11px;

  line-height: 1.55;
}

/* ============================================================
   START
   ============================================================ */

.main-start-button {
  width: 100%;

  min-height: 52px;

  border: 0;

  border-radius: 15px;

  background: var(--sky-dark);

  color: #ffffff;

  font-weight: 800;

  cursor: pointer;

  box-shadow: 0 6px 18px rgba(31, 30, 28, 0.12);
}

.main-start-button:active {
  transform: translateY(1px);
}

.main-start-button span {
  margin-right: 6px;
}

/* ============================================================
   SENSOR STATUS
   ============================================================ */

.sensor-status {
  min-height: 30px;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 7px;

  color: var(--sky-muted);

  font-size: 11px;

  text-align: center;
}

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

  flex: 0 0 8px;

  border-radius: 50%;

  background: #bbb8ae;
}

.sensor-status.is-running .sensor-dot {
  background: #5fa46c;

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

.sensor-status.is-partial .sensor-dot {
  background: #d9a043;

  box-shadow: 0 0 0 4px rgba(217, 160, 67, 0.1);
}

.sensor-status.is-error .sensor-dot {
  background: #b75b52;

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

/* ============================================================
   COMMON CARD
   ============================================================ */

.setting-card,
.constellation-section,
.finder-section,
.notice-card {
  padding: 17px;

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

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

  background: var(--sky-card);

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

.section-heading {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 12px;

  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 1px 0 0;

  font-size: 17px;

  letter-spacing: -0.5px;
}

.section-eyebrow {
  display: block;

  color: #9a958b;

  font-size: 8px;

  font-weight: 900;

  letter-spacing: 1.2px;
}

/* ============================================================
   LOCATION
   ============================================================ */

.mini-button,
.secondary-button,
.time-buttons button {
  min-height: 38px;

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

  border-radius: 10px;

  background: #faf9f5;

  cursor: pointer;

  font-size: 11px;

  font-weight: 800;
}

.mini-button {
  padding: 8px 10px;
}

.location-result {
  display: flex;

  align-items: center;

  gap: 11px;

  padding: 13px;

  border-radius: 13px;

  background: #f5f3ed;
}

.location-icon {
  font-size: 20px;
}

.location-result div {
  min-width: 0;
}

.location-result strong {
  display: block;

  overflow-wrap: anywhere;

  font-size: 13px;
}

.location-result small {
  display: block;

  margin-top: 3px;

  color: var(--sky-muted);

  font-size: 10px;

  line-height: 1.45;
}

.manual-location {
  margin-top: 12px;
}

.manual-location summary {
  cursor: pointer;

  color: var(--sky-muted);

  font-size: 11px;

  font-weight: 700;
}

.manual-grid {
  display: grid;

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

  gap: 10px;

  margin-top: 12px;
}

.manual-grid label,
.datetime-label {
  display: flex;

  flex-direction: column;

  gap: 6px;

  color: var(--sky-muted);

  font-size: 10px;

  font-weight: 700;
}

.manual-grid input,
.datetime-label input {
  width: 100%;

  min-width: 0;

  min-height: 44px;

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

  border-radius: 11px;

  padding: 8px 10px;

  background: #fff;

  color: var(--sky-text);

  font-size: 16px;

  outline: none;
}

.manual-grid input:focus,
.datetime-label input:focus {
  border-color: #aaa29a;
}

.secondary-button {
  width: 100%;

  margin-top: 10px;
}

/* ============================================================
   TIME
   ============================================================ */

.time-buttons {
  display: grid;

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

  gap: 7px;

  margin-top: 10px;
}

.time-buttons button {
  padding: 8px 5px;
}

.setting-note {
  margin: 11px 0 0;

  color: var(--sky-muted);

  font-size: 10px;

  line-height: 1.55;
}

/* ============================================================
   CONSTELLATION LIST
   ============================================================ */

.count-badge {
  min-width: 35px;

  padding: 4px 8px;

  border-radius: 999px;

  background: var(--sky-purple-soft);

  color: var(--sky-purple);

  text-align: center;

  font-size: 10px;

  font-weight: 900;
}

.sky-summary {
  margin: -3px 0 13px;

  color: var(--sky-muted);

  font-size: 11px;

  line-height: 1.55;
}

.constellation-list {
  display: grid;

  gap: 9px;
}

.constellation-card {
  width: 100%;

  display: grid;

  grid-template-columns: auto 1fr auto;

  align-items: center;

  gap: 11px;

  border: 1px solid #e5e1d9;

  border-radius: 14px;

  padding: 12px;

  background: #fbfaf7;

  color: var(--sky-text);

  text-align: left;

  cursor: pointer;

  transition:
    border 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.constellation-card:active {
  transform: scale(0.995);
}

.constellation-card.is-selected {
  border-color: #9789b0;

  background: #f5f1f9;
}

.constellation-card-icon {
  width: 39px;
  height: 39px;

  display: grid;

  place-items: center;

  border-radius: 12px;

  background: #eeebe3;

  font-size: 19px;
}

.constellation-card-main {
  min-width: 0;
}

.constellation-card-main strong {
  display: block;

  font-size: 13px;
}

.constellation-card-main small {
  display: block;

  margin-top: 3px;

  overflow: hidden;

  color: var(--sky-muted);

  font-size: 9px;

  text-overflow: ellipsis;

  white-space: nowrap;
}

.constellation-position {
  min-width: 75px;

  text-align: right;
}

.constellation-position strong {
  display: block;

  color: var(--sky-purple);

  font-size: 11px;
}

.constellation-position small {
  display: block;

  margin-top: 2px;

  color: var(--sky-muted);

  font-size: 9px;
}

.visibility-badge {
  display: inline-flex;

  align-items: center;

  margin-top: 4px;

  padding: 2px 6px;

  border-radius: 999px;

  background: var(--sky-good-soft);

  color: var(--sky-good);

  font-size: 8px;

  font-weight: 900;
}

.visibility-badge.is-low {
  background: var(--sky-warning-soft);

  color: var(--sky-warning);
}

.empty-sky {
  padding: 18px 10px;

  color: var(--sky-muted);

  text-align: center;

  font-size: 11px;

  line-height: 1.7;
}

/* ============================================================
   FINDER
   ============================================================ */

.finder-section {
  border-color: #dad3e4;
}

.finder-heading {
  margin-bottom: 12px;
}

.finder-state {
  padding: 4px 8px;

  border-radius: 999px;

  background: #efede8;

  color: var(--sky-muted);

  font-size: 9px;

  font-weight: 900;
}

.finder-state.is-searching {
  background: var(--sky-blue-soft);

  color: var(--sky-blue);
}

.finder-state.is-found {
  background: var(--sky-good-soft);

  color: var(--sky-good);
}

.target-summary {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 12px;

  margin-bottom: 14px;

  padding: 13px;

  border-radius: 15px;

  background: linear-gradient(135deg, #f2edf7, #f7f4ed);
}

.target-name-wrap {
  display: flex;

  align-items: center;

  gap: 10px;

  min-width: 0;
}

.target-icon {
  font-size: 24px;
}

.target-name-wrap strong {
  display: block;

  font-size: 15px;
}

.target-name-wrap small {
  display: block;

  margin-top: 2px;

  color: var(--sky-muted);

  font-size: 9px;
}

.target-coordinates {
  display: flex;

  gap: 12px;
}

.target-coordinates div {
  text-align: center;
}

.target-coordinates span {
  display: block;

  color: var(--sky-muted);

  font-size: 8px;
}

.target-coordinates strong {
  display: block;

  margin-top: 2px;

  font-size: 13px;

  font-variant-numeric: tabular-nums;
}

/* ============================================================
   AIM
   ============================================================ */

.aim-card {
  padding: 14px;

  border: 1px solid #ded9e7;

  border-radius: 18px;

  background: #f8f6fa;
}

.aim-guide {
  position: relative;

  width: min(78vw, 340px);

  aspect-ratio: 1 / 0.72;

  margin: 0 auto;

  overflow: hidden;

  border: 1px solid #d4cedd;

  border-radius: 20px;

  background: radial-gradient(circle at center, #f7f4fa 0, #ebe7f0 100%);
}

.aim-horizontal,
.aim-vertical {
  position: absolute;

  background: rgba(66, 62, 72, 0.13);
}

.aim-horizontal {
  left: 8%;
  right: 8%;
  top: 50%;

  height: 1px;
}

.aim-vertical {
  top: 8%;
  bottom: 8%;
  left: 50%;

  width: 1px;
}

.aim-center {
  position: absolute;

  left: 50%;
  top: 50%;

  width: 34px;
  height: 34px;

  transform: translate(-50%, -50%);

  display: grid;

  place-items: center;

  border: 2px solid #77717d;

  border-radius: 50%;
}

.aim-center-dot {
  width: 5px;
  height: 5px;

  border-radius: 50%;

  background: #5d5961;
}

.target-dot {
  position: absolute;

  left: 50%;
  top: 50%;

  width: 36px;
  height: 36px;

  transform: translate(-50%, -50%);

  display: grid;

  place-items: center;

  border-radius: 50%;

  background: #75628e;

  color: #fff;

  font-size: 16px;

  box-shadow: 0 4px 16px rgba(92, 77, 112, 0.22);

  transition:
    left 0.18s ease,
    top 0.18s ease,
    background 0.18s ease;
}

.target-dot.is-found {
  background: #4e8d5d;
}

.aim-label {
  position: absolute;

  color: #9a949e;

  font-size: 8px;

  font-weight: 800;
}

.aim-label.top {
  top: 6px;
  left: 50%;

  transform: translateX(-50%);
}

.aim-label.bottom {
  bottom: 6px;
  left: 50%;

  transform: translateX(-50%);
}

.aim-label.left {
  left: 7px;
  top: 50%;

  transform: translateY(-50%);
}

.aim-label.right {
  right: 7px;
  top: 50%;

  transform: translateY(-50%);
}

.guide-message {
  min-height: 49px;

  display: flex;

  align-items: center;

  justify-content: center;

  margin-top: 11px;

  padding: 8px;

  border-radius: 12px;

  background: #ffffff;

  color: #4c4850;

  text-align: center;

  font-size: 13px;

  font-weight: 800;

  line-height: 1.45;
}

.guide-message.is-found {
  background: var(--sky-good-soft);

  color: var(--sky-good);
}

.current-sensor-values {
  display: grid;

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

  gap: 8px;

  margin-top: 9px;
}

.current-sensor-values div {
  padding: 8px;

  border-radius: 10px;

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

  text-align: center;
}

.current-sensor-values span {
  display: block;

  color: var(--sky-muted);

  font-size: 8px;
}

.current-sensor-values strong {
  display: block;

  margin-top: 2px;

  font-size: 12px;

  font-variant-numeric: tabular-nums;
}

.phone-guide {
  margin-top: 11px;

  padding: 12px 13px;

  border-radius: 13px;

  background: #eef5fb;

  color: #52677d;

  font-size: 10px;

  line-height: 1.55;
}

.phone-guide strong {
  display: block;

  margin-bottom: 4px;

  color: #3f607e;
}

.phone-guide p {
  margin: 0;
}

/* ============================================================
   STORY
   ============================================================ */

.constellation-info {
  margin-top: 14px;

  padding-top: 14px;

  border-top: 1px solid #e5e1d9;
}

.story-header {
  display: flex;

  align-items: center;

  gap: 10px;

  margin-bottom: 13px;
}

.story-header > span {
  font-size: 25px;
}

.story-header div span {
  color: var(--sky-purple);

  font-size: 9px;

  font-weight: 800;
}

.story-header h3 {
  margin: 2px 0 0;

  font-size: 16px;
}

.info-block {
  margin-top: 11px;
}

.info-label {
  display: block;

  margin-bottom: 3px;

  color: var(--sky-muted);

  font-size: 9px;

  font-weight: 800;
}

.info-block p {
  margin: 0;

  font-size: 11px;

  line-height: 1.65;
}

.story-block {
  padding: 12px;

  border-radius: 13px;

  background: #f8f5ed;
}

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

.notice-card {
  background: #faf8f2;
}

.notice-card strong {
  display: block;

  margin-bottom: 6px;

  font-size: 12px;
}

.notice-card p {
  margin: 5px 0 0;

  color: var(--sky-muted);

  font-size: 10px;

  line-height: 1.6;
}

/* ============================================================
   ERROR
   ============================================================ */

.error-box {
  padding: 12px 13px;

  border: 1px solid #eed0cc;

  border-radius: 13px;

  background: var(--sky-error-soft);

  color: var(--sky-error);

  font-size: 11px;

  line-height: 1.55;
}

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

.sky-footer {
  padding: 20px 4px 2px;

  color: #9a968e;

  text-align: center;

  font-size: 9px;
}

/* ============================================================
   TABLET
   ============================================================ */

@media (min-width: 700px) {
  .sky-page {
    padding-top: 24px;
  }
}

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

@media (max-width: 520px) {
  .sky-page {
    padding-left: 13px;
    padding-right: 13px;
  }

  .sky-heading h1 {
    font-size: 20px;
  }

  .sky-icon {
    width: 46px;
    height: 46px;

    flex-basis: 46px;

    font-size: 23px;
  }

  .setting-card,
  .constellation-section,
  .finder-section,
  .notice-card {
    padding: 14px;
  }

  .target-summary {
    align-items: flex-start;

    flex-direction: column;
  }

  .target-coordinates {
    width: 100%;

    justify-content: space-around;
  }

  .aim-guide {
    width: 100%;
  }
}

/* ============================================================
   VERY SMALL
   ============================================================ */

@media (max-width: 360px) {
  .manual-grid {
    grid-template-columns: 1fr;
  }

  .time-buttons {
    grid-template-columns: 1fr;
  }

  .constellation-card {
    grid-template-columns: auto 1fr;
  }

  .constellation-position {
    grid-column: 2;

    text-align: left;
  }
}
