:root {
  --bg: #f4efe6;
  --bg-accent: #efe3cf;
  --surface: rgba(255, 252, 247, 0.88);
  --surface-strong: #fffaf2;
  --text: #1f2a33;
  --muted: #60707f;
  --line: rgba(31, 42, 51, 0.12);
  --brand: #0a7f6f;
  --brand-strong: #07584d;
  --shadow: 0 16px 40px rgba(25, 39, 50, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top right, rgba(10, 127, 111, 0.16), transparent 30%),
    linear-gradient(180deg, var(--bg-accent), var(--bg));
  color: var(--text);
  font-family: "Noto Sans KR", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 1rem 1rem 0.9rem;
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(244, 239, 230, 0.97), rgba(244, 239, 230, 0.84));
  border-bottom: 1px solid rgba(31, 42, 51, 0.08);
}

.title-wrap h1,
.title-wrap p {
  margin: 0;
}

.topbar-actions {
  margin-top: 0.85rem;
}

.pwa-actions {
  margin-top: 0.85rem;
}

.browser-install-note {
  position: relative;
  margin-top: 0.75rem;
  padding: 0.85rem 3rem 0.85rem 1rem;
  border: 1px solid rgba(184, 108, 22, 0.2);
  border-radius: 18px;
  background: rgba(255, 243, 224, 0.88);
  color: #8f4f09;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.5;
}

.browser-install-note[hidden] {
  display: none;
}

.browser-install-note a {
  color: #7a3f00;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.browser-install-note-close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(122, 63, 0, 0.08);
  color: #7a3f00;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: rgba(10, 127, 111, 0.1);
  color: var(--brand-strong);
  font-weight: 800;
  text-decoration: none;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.title-wrap h1 {
  margin-top: 0.35rem;
  font-size: 1.55rem;
  line-height: 1.15;
}

.title-main,
.title-date {
  display: block;
}

.title-date {
  margin-top: 0.22rem;
  font-size: 0.82em;
  font-weight: 700;
  color: var(--muted);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(10, 127, 111, 0.18);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: 0 12px 30px rgba(10, 127, 111, 0.08);
}

.search-icon {
  color: var(--brand);
  font-size: 1.1rem;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.tab {
  min-height: 3rem;
  padding: 0.7rem 0.5rem;
  border: 1px solid rgba(10, 127, 111, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-weight: 700;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.tab.is-active {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff;
  box-shadow: 0 14px 24px rgba(7, 88, 77, 0.24);
}

.content {
  padding: 1rem;
}

.results-head {
  margin-bottom: 0.85rem;
}

#results-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.route-list {
  display: grid;
  gap: 0.9rem;
}

.route-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  animation: card-enter 420ms ease forwards;
}

.card-toggle {
  width: 100%;
  border: 0;
  padding: 1rem;
  background: transparent;
  color: inherit;
  text-align: left;
}

.card-main {
  display: grid;
  gap: 0.85rem;
}

.route-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.35;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.72rem;
  border-radius: 999px;
  background: rgba(10, 127, 111, 0.08);
  color: var(--brand-strong);
  font-size: 0.92rem;
  font-weight: 700;
}

.expand-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.95rem;
  color: var(--brand);
  font-weight: 800;
}

.expand-label::after {
  content: "▾";
  transition: transform 220ms ease;
}

.route-card.is-open .expand-label::after {
  transform: rotate(180deg);
}

.card-details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 240ms ease;
}

.route-card.is-open .card-details {
  grid-template-rows: 1fr;
}

.stop-list {
  min-height: 0;
  margin: 0;
  padding: 0 1rem 1rem 2.45rem;
  overflow: hidden;
  border-top: 1px solid var(--line);
}

.stop-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.8rem;
  color: var(--text);
  line-height: 1.45;
}

.stop-name {
  flex: 1;
}

.stop-name.is-match {
  font-weight: 900;
}

.stop-time {
  flex-shrink: 0;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(10, 127, 111, 0.08);
  color: var(--brand-strong);
  font-size: 0.84rem;
  font-weight: 800;
}

.empty-state {
  padding: 1.4rem 1rem;
  border: 1px dashed rgba(31, 42, 51, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  text-align: center;
}

.admin-content {
  display: grid;
  gap: 1rem;
}

.admin-panel {
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-panel h2,
.admin-copy {
  margin-top: 0;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.admin-copy {
  color: var(--muted);
  line-height: 1.5;
}

.auth-panel {
  max-width: 32rem;
}

.auth-form {
  display: grid;
  gap: 0.85rem;
}

.auth-field {
  display: grid;
  gap: 0.35rem;
}

.auth-field span {
  font-weight: 700;
}

.auth-field input {
  min-height: 3rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(10, 127, 111, 0.18);
  border-radius: 16px;
  background: var(--surface-strong);
}

.upload-form {
  display: grid;
  gap: 0.9rem;
}

.file-drop {
  display: grid;
  gap: 0.4rem;
  padding: 1.2rem;
  border: 2px dashed rgba(10, 127, 111, 0.3);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
}

.file-drop-title {
  font-size: 1rem;
  font-weight: 800;
}

.file-drop-copy {
  color: var(--muted);
  font-size: 0.92rem;
}

.file-drop input {
  margin-top: 0.5rem;
}

.primary-button {
  min-height: 3.2rem;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 16px 24px rgba(7, 88, 77, 0.22);
}

.secondary-button {
  min-height: 2.8rem;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(10, 127, 111, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--brand-strong);
  font-weight: 800;
}

.install-button[hidden] {
  display: none;
}

.admin-status,
.status-summary {
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(10, 127, 111, 0.08);
  color: var(--brand-strong);
  font-weight: 700;
  line-height: 1.5;
}

.status-summary {
  display: grid;
  gap: 0.2rem;
}

.status-summary-count,
.status-summary-updated {
  display: block;
}

.status-summary-count {
  font-size: 1rem;
  font-weight: 800;
}

.status-summary-updated {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.status-details {
  display: grid;
  gap: 1rem;
}

.status-summary-toggle {
  display: grid;
  gap: 0.8rem;
  cursor: pointer;
  list-style: none;
}

.status-summary-title {
  margin: 0;
}

.status-summary-toggle::-webkit-details-marker {
  display: none;
}

.status-summary-toggle::after {
  content: "상세 펼치기";
  color: var(--brand);
  font-size: 0.92rem;
  font-weight: 800;
}

.status-details[open] .status-summary-toggle::after {
  content: "상세 접기";
}

.auth-error {
  padding: 0.95rem 1rem;
  border: 1px solid rgba(161, 43, 43, 0.18);
  border-radius: 18px;
  background: rgba(161, 43, 43, 0.08);
  color: #8a2525;
  font-weight: 700;
}

.diagnostic-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.diagnostic-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
}

.diagnostic-card h3,
.diagnostic-card p {
  margin: 0;
}

.diagnostic-card p {
  margin-top: 0.45rem;
  color: var(--muted);
  line-height: 1.45;
}

.type-label-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.type-label-row {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
}

.type-label-meta {
  display: grid;
  gap: 0.25rem;
}

.type-label-meta strong,
.type-label-meta span {
  margin: 0;
}

.type-label-meta span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.type-label-input {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
}

.type-label-input:focus {
  outline: 2px solid rgba(10, 127, 111, 0.2);
  border-color: var(--brand);
}

.type-visibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--brand-strong);
  font-weight: 700;
}

.type-visibility-toggle input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.access-log-list {
  display: grid;
  gap: 0.75rem;
}

.access-log-card {
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.access-log-main,
.access-log-sub {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0;
}

.access-log-main {
  font-weight: 800;
}

.access-log-sub {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.access-log-empty {
  margin-top: 0.75rem;
}

.password-management {
  display: grid;
  gap: 1.5rem;
}

@keyframes card-enter {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (min-width: 720px) {
  .content,
  .topbar {
    padding-left: max(1.25rem, calc((100vw - 720px) / 2 + 1.25rem));
    padding-right: max(1.25rem, calc((100vw - 720px) / 2 + 1.25rem));
  }

  .route-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pwa-actions {
    display: flex;
    justify-content: flex-end;
  }
}
