:root {
  font-family: "Noto Sans KR", "Pretendard", "Apple SD Gothic Neo", system-ui,
    sans-serif;
  color: #111827;
  background-color: #f3f4f6;
}

.stage-overlay {
  display: none;
}

.mission-panel {
  display: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #0b1220;
  color: inherit;
}

main.game-layout {
  min-height: 100vh;
}

body.is-fullscreen {
  overflow: hidden;
}

.hidden {
  display: none;
}

.hud {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 40;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hud span {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  color: #111827;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
}

.health-bar {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 180px;
  height: 22px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.3);
}

.health-bar__fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.2s ease;
}

.health-bar__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #e2e8f0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.logout-button {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 40;
  border: 1px solid rgba(15, 23, 42, 0.3);
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
}

.app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.simple-header {
  background: #fff;
  border-radius: 18px;
  padding: 20px 24px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
}

.user-status {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  color: #111827;
}

.multiplayer-status {
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  color: #0f172a;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 600;
}

.user-status button {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: transparent;
  color: #111827;
  padding: 6px 16px;
  cursor: pointer;
}

.resource-status {
  margin-top: 12px;
  display: flex;
  gap: 16px;
  font-weight: 600;
  color: #111827;
  flex-wrap: wrap;
}

.resource-status span {
  background: #fef9c3;
  border-radius: 999px;
  padding: 4px 12px;
  border: 1px solid #fde047;
}

.game-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  min-height: 100vh;
}

.game-stage {
  position: relative;
  background: transparent;
  border-radius: 0;
  border: 0;
  padding: 0;
  box-shadow: none;
  min-height: 100vh;
  overflow: hidden;
}

#gameCanvas {
  width: 100%;
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
  background: rgb(90, 165, 130);
  display: block;
  box-shadow: none;
  touch-action: none;
}

.stage-overlay {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.overlay-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 16px;
  border: 2px solid #cbd5f5;
  box-shadow: 0 15px 30px rgba(15, 23, 42, 0.18);
}

.overlay-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.overlay-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 120px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.overlay-card ul li {
  font-size: 0.9rem;
  color: #475569;
}

.mission-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mission-panel--corner {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 35;
  width: min(340px, 90vw);
  max-height: 45vh;
  overflow: auto;
  display: flex;
}

.mission-panel--corner .mission-board {
  padding: 16px;
}

.mission-board--compact h2 {
  font-size: 1.1rem;
}

.mission-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mission-hide-button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: #e2e8f0;
  color: #0f172a;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

button {
  touch-action: manipulation;
}

@media (max-width: 768px) {
  .mission-hide-button {
    display: none;
  }
}

.mission-header span {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

.mission-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 12px;
  color: #475569;
  font-size: 0.85rem;
}

.mission-board--compact h3 {
  margin: 6px 0 4px;
  font-size: 1rem;
}

.mission-board--compact p {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: #64748b;
}

.mission-board--compact ul {
  margin: 0;
  padding-left: 16px;
  color: #475569;
  font-size: 0.82rem;
}

.mission-board {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(226, 232, 240, 0.95));
  border-radius: 24px;
  padding: 24px;
  border: 2px solid #cbd5f5;
  box-shadow: 0 15px 30px rgba(15, 23, 42, 0.18);
}

.mission-board h2 {
  margin: 0;
  font-size: 1.3rem;
}

.mission-board p {
  color: #64748b;
  margin: 8px 0 16px;
}

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

.mission-line {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #cbd5f5;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.mission-line.active {
  border-color: #fcd34d;
  box-shadow: 0 10px 25px rgba(252, 211, 77, 0.35);
}

.mission-line h3 {
  margin: 0;
  font-size: 1.05rem;
}

.mission-line p {
  margin: 4px 0;
  color: #64748b;
  font-size: 0.85rem;
}

.mission-line span {
  font-size: 0.8rem;
  color: #94a3b8;
}

.mission-line button {
  border: none;
  background: #38bdf8;
  color: #020617;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.detail-card {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.95), rgba(226, 232, 240, 0.95));
  border-radius: 22px;
  padding: 22px;
  border: 2px solid #cbd5f5;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-card .summary {
  margin: 0;
  color: #64748b;
}

.tasks {
  margin: 0;
  padding-left: 14px;
  color: #111827;
  display: grid;
  gap: 6px;
  list-style: disc;
}

.detail-actions {
  margin-top: auto;
  display: flex;
  gap: 12px;
}

.detail-actions button {
  flex: 1;
  border-radius: 12px;
  border: none;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
}

#completeMission {
  background: #4ade80;
  color: #021014;
}

#searchFragment {
  background: rgba(59, 130, 246, 0.3);
  color: #0f172a;
  border: 1px solid rgba(59, 130, 246, 0.7);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(224, 231, 255, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.auth-overlay.hidden {
  display: none;
}

.auth-card {
  max-width: 900px;
  width: 100%;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 32px;
  box-shadow: 0 30px 60px rgba(2, 6, 23, 0.8);
  text-align: center;
}

.auth-card h2 {
  margin: 0;
  font-size: 1.8rem;
  color: #f8fafc;
}

.auth-card p {
  color: #cbd5f5;
  margin: 12px 0 24px;
}

.auth-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.auth-forms form {
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(59, 130, 246, 0.5);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-forms h3 {
  margin: 0;
  color: #e0f2fe;
  font-size: 1.1rem;
}

.auth-forms label {
  font-size: 0.9rem;
  color: #cbd5f5;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-forms input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: #0f172a;
  color: #f8fafc;
}

.auth-forms button {
  border-radius: 12px;
  border: none;
  background: #38bdf8;
  color: #020617;
  padding: 10px;
  cursor: pointer;
  font-weight: 700;
}

.auth-feedback {
  min-height: 1.2rem;
  font-size: 0.85rem;
  color: #fca5a5;
  text-align: left;
}

.shop-overlay,
.map-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}

.shop-overlay.hidden,
.map-overlay.hidden {
  display: none;
}

.wire-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
  padding: 20px;
}

.wire-overlay.hidden {
  display: none;
}

.wire-card {
  width: min(720px, 100%);
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.6);
}

.wire-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wire-header button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: transparent;
  color: #e2e8f0;
  padding: 6px 14px;
  cursor: pointer;
}

.wire-help {
  margin: 8px 0 12px;
  color: #94a3b8;
}

.wire-canvas {
  width: 100%;
  height: 360px;
  border-radius: 16px;
  background: #0b1220;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.wire-status {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: #38bdf8;
}

.bag-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
  padding: 20px;
}

.bag-overlay.hidden {
  display: none;
}

.bag-card {
  width: min(720px, 100%);
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.6);
}

.bag-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bag-header button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: transparent;
  color: #e2e8f0;
  padding: 6px 14px;
  cursor: pointer;
}

.bag-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

.bag-items {
  min-height: 200px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bag-item {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: grab;
  font-size: 0.9rem;
}

.bag-empty {
  color: #94a3b8;
  font-size: 0.9rem;
}

.bag-campfire {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.campfire-drop {
  width: 180px;
  height: 180px;
  border-radius: 16px;
  background: #111827;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 120 120'%3E%3Crect width='120' height='120' fill='none'/%3E%3Cellipse cx='40' cy='78' rx='18' ry='8' fill='%234b5563'/%3E%3Cellipse cx='80' cy='78' rx='18' ry='8' fill='%234b5563'/%3E%3Crect x='30' y='84' width='60' height='8' fill='%231f2937'/%3E%3Cpath d='M60 30 C45 50 48 70 60 78 C72 70 75 50 60 30 Z' fill='%23f97316'/%3E%3Cpath d='M60 40 C52 54 54 66 60 70 C66 66 68 54 60 40 Z' fill='%23fbbf24'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 120px 120px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e2e8f0;
  font-weight: 700;
}

.campfire-note {
  color: #94a3b8;
  font-size: 0.85rem;
}

.campfire-panel {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tutorial-toast {
  position: fixed;
  left: 16px;
  bottom: 100px;
  z-index: 80;
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.35;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.4);
}

.shop-card,
.map-card {
  width: min(520px, 100%);
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 20px;
  padding: 24px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.6);
}

.shop-header,
.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shop-header h2,
.map-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.shop-header button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: transparent;
  color: #e2e8f0;
  padding: 6px 14px;
  cursor: pointer;
}

.map-header button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: transparent;
  color: #e2e8f0;
  padding: 6px 14px;
  cursor: pointer;
}

.map-body #mapOverlayStatus {
  font-weight: 600;
  color: #cbd5f5;
}

.map-button {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 30;
  border-radius: 999px;
  border: none;
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

.map-button:hover {
  background: rgba(51, 65, 85, 0.95);
}

.shop-summary {
  margin: 12px 0 18px;
  color: #cbd5f5;
}

.shop-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.shop-status span {
  background: rgba(148, 163, 184, 0.15);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
}

.shop-actions {
  display: grid;
  gap: 12px;
}

.shop-actions button {
  border-radius: 12px;
  border: none;
  padding: 10px 14px;
  background: #38bdf8;
  color: #0f172a;
  font-weight: 700;
  cursor: pointer;
}

.shop-actions button:disabled {
  background: rgba(148, 163, 184, 0.4);
  color: #e2e8f0;
  cursor: not-allowed;
}

.campfire-panel {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.campfire-panel p {
  font-weight: 600;
  color: #1f2937;
}

.campfire-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.shop-feedback {
  min-height: 1.2rem;
  margin: 12px 0 0;
  color: #fca5a5;
}

.map-header #mapHint {
  margin: 0;
  font-size: 0.85rem;
  color: #94a3b8;
}

.map-body {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.map-canvas {
  width: 100%;
  height: 280px;
  border-radius: 16px;
  background: #0b1220;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.5);
}

.map-body ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.map-body li {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.15);
}

@media (max-width: 1100px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .mission-panel {
    order: -1;
  }
}

@media (max-width: 768px) {
  .app-shell {
    padding: 24px 16px 32px;
  }

  .simple-header {
    padding: 18px;
  }

  .header-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .game-stage {
    padding: 12px;
  }

  .stage-overlay {
    position: static;
    margin-top: 12px;
    grid-template-columns: 1fr;
  }
}


@media (max-width: 640px) {
  .app-shell {
    padding: 20px 12px 28px;
  }

  .brand {
    font-size: 1.05rem;
  }

  .resource-status span {
    font-size: 0.85rem;
    padding: 4px 10px;
  }

  .game-layout {
    gap: 16px;
  }

  .game-stage {
    padding: 10px;
    border-radius: 14px;
  }

  #gameCanvas {
    aspect-ratio: 4 / 3;
    border-radius: 12px;
  }

  .stage-overlay {
    position: static;
    margin-top: 12px;
    grid-template-columns: 1fr;
  }

  .overlay-card {
    padding: 12px;
  }

  .overlay-card ul {
    max-height: 90px;
  }

  .mission-panel {
    gap: 12px;
    order: 1;
  }

  .mission-line {
    flex-direction: column;
    align-items: stretch;
  }

  .mission-line button {
    align-self: flex-end;
  }

  .detail-actions {
    flex-direction: column;
  }

  .auth-card {
    padding: 20px;
  }

  .auth-forms {
    grid-template-columns: 1fr;
  }

  .shop-card,
  .map-card {
    padding: 18px;
  }

  .shop-actions button {
    font-size: 0.95rem;
  }
}
