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

:root {
  --bg: #f7f3ee;
  --text: #2c2c2c;
  --muted: #6b6b6b;
  --accent: #8b7355;
  --accent-hover: #6d5a43;
  --card: #ffffff;
  --border: #e8e0d6;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --radius: 12px;
}

body {
  font-family: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(247, 243, 238, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--muted);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--accent);
}

.site-hero-text {
  max-width: 1200px;
  margin: 5.5rem auto 0;
  padding: 0 1rem;
  text-align: center;
}

.site-hero-inner {
  position: relative;
  padding: clamp(2rem, 5vw, 3rem) clamp(1.5rem, 4vw, 2.5rem);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.92) 0%,
    rgba(255, 252, 248, 0.72) 100%
  );
  border: 1px solid rgba(139, 115, 85, 0.14);
  border-radius: calc(var(--radius) + 4px);
  box-shadow:
    0 8px 32px rgba(139, 115, 85, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.site-main-title {
  font-family: "Noto Serif KR", "Pretendard", serif;
  font-size: clamp(2.25rem, 5.5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #2e2218 0%, #6d5a43 45%, #8b7355 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  margin-bottom: 0;
}

.site-title-divider {
  width: 56px;
  height: 3px;
  margin: 1.25rem auto 1rem;
  background: linear-gradient(90deg, transparent, var(--accent) 20%, var(--accent) 80%, transparent);
  border-radius: 99px;
  opacity: 0.85;
}

.site-title-divider.hidden {
  display: none;
}

.site-slogan {
  display: inline-block;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: 0.02em;
  color: #2a2622;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  border: 1px solid rgba(139, 115, 85, 0.12);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  word-break: keep-all;
}

.site-slogan:empty {
  display: none;
}

.site-settings-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

.site-settings-section h2 {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
}

.site-settings-form {
  display: grid;
  gap: 1rem;
}

.site-settings-form .btn {
  justify-self: start;
}

/* Main hero */
.hero-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 1.5rem auto 2rem;
  padding: 0 1rem;
}

.hero-image-wrapper {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #fff;
}

.hero-image-wrapper img {
  display: block;
  width: 100%;
  height: auto;
}

.hotspot-layer {
  position: absolute;
  inset: 0;
}

.hotspot {
  position: absolute;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  background: transparent;
  padding: 0;
  font: inherit;
}

.hotspot:hover,
.hotspot:focus-visible {
  background: rgba(139, 115, 85, 0.15);
  border-color: rgba(139, 115, 85, 0.6);
  box-shadow: 0 0 20px rgba(139, 115, 85, 0.25);
}

.hotspot-badge {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.25s ease;
  pointer-events: none;
}

.hotspot:hover .hotspot-badge,
.hotspot:focus-visible .hotspot-badge {
  opacity: 1;
  transform: scale(1);
}

.hero-hint {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.title-overlay {
  position: absolute;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  pointer-events: none;
  animation: overlayFadeIn 0.2s ease;
}

.title-overlay-text {
  color: #fff;
  font-size: clamp(0.75rem, 2.5vw, 1.25rem);
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  word-break: keep-all;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bag-grid {
  max-width: 1200px;
  margin: 3rem auto;
  padding: 0 1rem 4rem;
}

.bag-grid h2 {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2rem;
  color: var(--text);
}

.bag-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.bag-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.bag-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.bag-card-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.bag-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.bag-card p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Bag detail page */
.bag-detail {
  max-width: 800px;
  margin: 6rem auto 4rem;
  padding: 0 1.5rem;
}

.bag-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.bag-number-large {
  width: 56px;
  height: 56px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.bag-detail h1 {
  font-size: 2rem;
  font-weight: 700;
}

.bag-color-bar {
  height: 6px;
  border-radius: 3px;
  margin-bottom: 2rem;
}

.bag-description {
  background: var(--card);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-weight: 500;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent-hover);
}

/* Admin */
.admin-container {
  max-width: 1000px;
  margin: 6rem auto 4rem;
  padding: 0 1.5rem;
}

.admin-login {
  max-width: 400px;
  margin: 8rem auto;
  padding: 2.5rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.admin-login h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--muted);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-block {
  width: 100%;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.admin-header h1 {
  font-size: 1.75rem;
}

.admin-bag-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-bag-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.admin-bag-item-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-bag-item-header h3 {
  flex: 1;
  font-size: 1.1rem;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  cursor: pointer;
  transition: 0.3s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.admin-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.hotspot-editor {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
}

.hotspot-editor h4 {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.hotspot-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.hotspot-inputs .form-group {
  margin-bottom: 0;
}

.hotspot-editor-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.hotspot-editor-title h4 {
  margin-bottom: 0;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.admin-section-title {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.visual-editor-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.visual-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.visual-editor-header h2 {
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}

.visual-editor-desc {
  font-size: 0.9rem;
  color: var(--muted);
}

.upload-btn {
  cursor: pointer;
  white-space: nowrap;
}

.bag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.bag-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.bag-select-btn:hover {
  border-color: var(--accent);
}

.bag-select-btn.active {
  border-color: var(--accent);
  background: rgba(139, 115, 85, 0.1);
  font-weight: 600;
}

.bag-select-num {
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.visual-editor-canvas {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

.visual-editor-canvas img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.editor-overlay {
  position: absolute;
  inset: 0;
}

.editor-hotspot {
  position: absolute;
  border: 2px solid var(--bag-color, var(--accent));
  background: color-mix(in srgb, var(--bag-color, var(--accent)) 20%, transparent);
  border-radius: 4px;
  cursor: move;
  transition: box-shadow 0.2s;
}

.editor-hotspot.selected {
  border-width: 3px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.editor-hotspot-label {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  background: var(--bag-color, var(--accent));
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  pointer-events: none;
}

.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 2px;
  z-index: 3;
}

.resize-nw { top: -5px; left: -5px; cursor: nw-resize; }
.resize-ne { top: -5px; right: -5px; cursor: ne-resize; }
.resize-sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.resize-se { bottom: -5px; right: -5px; cursor: se-resize; }

.draw-preview {
  position: absolute;
  border: 2px dashed var(--accent);
  background: rgba(139, 115, 85, 0.15);
  pointer-events: none;
  z-index: 5;
}

.visual-editor-toolbar {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

.admin-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #c0392b;
}

.error-message {
  color: #c0392b;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 768px) {
  .site-header {
    padding: 0.75rem 1rem;
  }

  .site-hero-text {
    margin-top: 4.5rem;
  }

  .site-hero-inner {
    padding: 1.75rem 1.25rem;
  }

  .site-slogan {
    border-radius: 12px;
    padding: 0.75rem 1rem;
  }

  .hero-container {
    margin-top: 1.25rem;
  }

  .admin-form-row {
    grid-template-columns: 1fr;
  }

  .hotspot-inputs {
    grid-template-columns: repeat(2, 1fr);
  }

  .visual-editor-header {
    flex-direction: column;
  }

  .visual-editor-toolbar {
    flex-direction: column;
  }

  .visual-editor-toolbar .btn {
    width: 100%;
  }
}