* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: linear-gradient(160deg, #fff1e6 0%, #e6f0ff 100%);
  color: #2b2b2b;
  padding: 24px;
}

.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

header {
  text-align: center;
}

header h1 {
  margin: 0 0 6px;
  font-size: 1.7rem;
}

.subtitle {
  margin: 0;
  color: #6b6b6b;
  font-size: 0.9rem;
}

.maintabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.5);
  padding: 6px;
  border-radius: 14px;
}

.maintab {
  flex: 1;
  border: none;
  background: transparent;
  color: #666;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.maintab:hover {
  background: rgba(255, 255, 255, 0.6);
}

.maintab.active {
  background: #2b2b2b;
  color: white;
}

.view {
  display: none;
  flex-direction: column;
  gap: 18px;
}

.view.active {
  display: flex;
}

.tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.tab {
  border: none;
  background: rgba(255, 255, 255, 0.6);
  color: #555;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.9);
}

.tab.active {
  background: #ff8a5c;
  color: white;
  font-weight: 600;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.card {
  width: 100%;
  min-height: 220px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 24px;
  text-align: center;
  transition: transform 0.25s ease;
}

.card.pop {
  animation: pop 0.35s ease;
}

@keyframes pop {
  0% {
    transform: scale(0.9);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.card-emoji {
  font-size: 3rem;
}

.card-text {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.5;
  margin: 0;
}

.card-tag {
  font-size: 0.8rem;
  color: #999;
  background: #f4f4f4;
  padding: 4px 12px;
  border-radius: 999px;
}

.card-tag:empty {
  display: none;
}

.cta {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 16px;
  background: #2b2b2b;
  color: white;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.cta:hover {
  background: #444;
}

.cta:active {
  transform: scale(0.97);
}

.map-wrap {
  background: white;
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  padding: 12px 12px 6px;
}

#seoulMap {
  width: 100%;
  height: auto;
  display: block;
}

.gu-path {
  stroke: #fbf9f7;
  stroke-width: 1.2;
  stroke-linejoin: round;
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.2s ease, stroke-width 0.2s ease, transform 0.2s ease,
    filter 0.2s ease;
}

.gu-path:hover {
  opacity: 0.85;
}

.gu-path.dimmed {
  opacity: 0.35;
}

.gu-path.selected {
  stroke: #2b2b2b;
  stroke-width: 2;
  opacity: 1;
  transform: scale(1.015);
  filter: drop-shadow(0 4px 10px rgba(43, 43, 43, 0.35));
}

.gu-labels {
  pointer-events: none;
}

.gu-label {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  fill: #4a3d34;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: #fbf9f7;
  stroke-width: 2.6px;
  stroke-linejoin: round;
  transition: opacity 0.2s ease, font-size 0.2s ease, fill 0.2s ease;
}

.gu-label.dimmed {
  opacity: 0.4;
}

.gu-label.selected {
  font-size: 14px;
  font-weight: 800;
  fill: #2b2b2b;
  stroke: #ffffff;
  stroke-width: 3.2px;
}

.map-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 0 4px;
  font-size: 0.72rem;
  color: #999;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}

.seoul-controls {
  display: flex;
  justify-content: flex-end;
}

.seoul-controls select {
  border: none;
  background: rgba(255, 255, 255, 0.7);
  color: #444;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.event-status {
  text-align: center;
  color: #999;
  font-size: 0.9rem;
  padding: 40px 0;
}

.event-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.event-card-top {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.event-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #ff8a5c;
  background: #fff1e6;
  padding: 3px 9px;
  border-radius: 999px;
}

.event-badge.free {
  color: #2e9e6e;
  background: #e6f7ef;
}

.event-gu {
  font-size: 0.75rem;
  color: #999;
}

.event-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
}

.event-meta {
  font-size: 0.82rem;
  color: #666;
  margin: 0;
}

.event-link {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2b2b2b;
  text-decoration: none;
  border-bottom: 1px solid #2b2b2b;
}

.updated-at {
  text-align: center;
  color: #aaa;
  font-size: 0.75rem;
  margin: 0;
}

footer {
  text-align: center;
  color: #aaa;
  font-size: 0.75rem;
}

@media (max-width: 400px) {
  header h1 {
    font-size: 1.4rem;
  }
}

@media (min-width: 700px) {
  .app {
    max-width: 760px;
  }

  #randomView {
    max-width: 420px;
    margin: 0 auto;
  }

  .event-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .app {
    max-width: 960px;
  }

  .event-list {
    grid-template-columns: repeat(3, 1fr);
  }
}
