* {
  box-sizing: border-box;
  touch-action: manipulation;
}

body,
html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'DotGothic16', sans-serif;
  background: #05060a;
  color: #fff;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  background: radial-gradient(circle at top, #16314b 0%, #060814 55%, #03040a 100%);
}

#app-shell {
  position: relative;
  width: 100%;
  height: 100vh;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
}

.screen.active {
  display: block;
}

#menu-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, rgba(6, 8, 20, 0.95), rgba(30, 44, 80, 0.95));
}

.lang-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4000;
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  backdrop-filter: blur(6px);
}

.menu-panel {
  width: min(92vw, 520px);
  padding: 28px 24px 32px;
  border-radius: 24px;
  border: 3px solid #ffe082;
  background: rgba(8, 12, 27, 0.86);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.menu-title {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: 0.08em;
  color: #ffd54f;
  text-shadow: 0 4px 0 #8e5b00;
}

.menu-subtitle {
  margin: 0 0 24px;
  font-size: 16px;
  line-height: 1.6;
  color: #dfe7ff;
}

.menu-notice {
  min-height: 24px;
  margin-top: 14px;
  font-size: 14px;
  color: #ffd54f;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.menu-notice.show {
  opacity: 1;
  transform: translateY(0);
}

.menu-buttons {
  display: grid;
  gap: 14px;
}

.menu-btn {
  border: none;
  border-radius: 18px;
  padding: 16px 18px;
  font-family: inherit;
  font-size: clamp(18px, 3.7vw, 22px);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2);
}

.menu-btn:hover,
.menu-btn:active {
  transform: translateY(-2px);
}

.menu-btn.primary {
  background: linear-gradient(135deg, #ff8f00, #ffb300);
  color: #2b1400;
}

.menu-btn.secondary {
  background: linear-gradient(135deg, #29b6f6, #1565c0);
  color: #f4f8ff;
}

.menu-btn.disabled {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: #f3f4f6;
  cursor: not-allowed;
}

#game-screen {
  position: relative;
  overflow: hidden;
}

#back-to-menu-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  color: #0f172a;
  background: #fff7cc;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  align-self: flex-start;
}

#hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2100;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px;
  pointer-events: none;
}

#hud-top > * {
  pointer-events: auto;
}

.hud-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-col-right {
  align-items: flex-end;
}

#map {
  width: 100%;
  height: 100dvh;
  min-height: 100svh;
  background: #000;
}

#status-panel {
  color: #fff;
  padding: 10px;
  border-radius: 12px;
  width: min(78vw, 240px);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.92));
  border: 2px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.hud-card {
  backdrop-filter: blur(8px);
}

.status-title {
  font-size: 13px;
  color: #ffd166;
  margin-bottom: 6px;
  text-align: center;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.35);
  padding-bottom: 4px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0;
  font-size: 12px;
}

.status-value {
  color: #7dd3fc;
  font-weight: 700;
}

.status-value.accent {
  color: #fbbf24;
}

.status-value.success {
  color: #86efac;
}

.progress-bar-bg {
  background: rgba(255, 255, 255, 0.16);
  height: 8px;
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-bar-fill {
  background: linear-gradient(90deg, #38bdf8, #2563eb);
  height: 100%;
  width: 0%;
  transition: width 0.2s;
}

.hud-divider {
  border: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.22);
  margin: 8px 0 6px;
}

#dialog-box {
  position: absolute;
  bottom: 160px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  width: 92%;
  max-width: 520px;
  background: linear-gradient(135deg, #fffdf7, #fef3c7);
  border: 3px solid #92400e;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  display: none;
  cursor: pointer;
  animation: popup 0.2s ease-out;
}

.toast {
  position: absolute;
  top: 190px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3200;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.88);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast.show {
  opacity: 1;
}

#dialog-content {
  font-size: 14px;
  color: #111827;
  line-height: 1.5;
  font-weight: bold;
}

.dialog-next {
  text-align: right;
  font-size: 11px;
  color: #dc2626;
  animation: blink 0.8s infinite;
  margin-top: 4px;
}

.facility-detail {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 3100;
  width: min(92vw, 520px);
  max-height: min(62vh, 360px);
  overflow: auto;
  background: rgba(17, 24, 39, 0.94);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
  display: none;
}

.facility-detail.active {
  display: block;
}

#detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
}

.facility-detail h3 {
  margin: 0 0 8px;
  color: #fde68a;
  font-size: 18px;
}

.facility-detail p {
  margin: 0 0 8px;
  line-height: 1.6;
  color: #e5e7eb;
  font-size: 13px;
}

.facility-detail .detail-meta {
  margin-top: 8px;
  font-size: 12px;
  color: #93c5fd;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.detail-action-btn {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.detail-action-btn.primary {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  color: #111827;
}

.detail-action-btn.secondary {
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #fff;
}

#pokedex-btn {
  background: linear-gradient(135deg, #f87171, #dc2626);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  font-family: 'DotGothic16', sans-serif;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  border-radius: 999px;
}

#quest-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fef3c7;
  font-size: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#pokedex-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4000;
  width: 90%;
  max-width: 420px;
  height: 70vh;
  background: #111;
  border: 3px solid #f1c40f;
  color: #fff;
  padding: 12px;
  display: none;
  flex-direction: column;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.9);
}

#pokedex-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.dex-filter-chip {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
}

.dex-filter-chip.active {
  background: #f1c40f;
  color: #111;
  border-color: #f1c40f;
  font-weight: bold;
}

#pokedex-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 8px;
  border-top: 1px solid #444;
}

.dex-item {
  padding: 8px 6px;
  border-bottom: 1px solid #333;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dex-item.discovered {
  color: #2ecc71;
}

.dex-item.unknown {
  color: #7f8c8d;
}

#dpad {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 2000;
  width: 132px;
  height: 132px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
}

body.gps-mode #dpad {
  display: none;
}

#mode-toggle {
  display: flex;
  gap: 6px;
}

#mode-toggle button {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  user-select: none;
}

#mode-toggle button.active {
  background: #f1c40f;
  color: #111;
  border-color: #f1c40f;
  font-weight: bold;
}

.dbtn {
  background: linear-gradient(145deg, rgba(71, 85, 105, 0.9), rgba(30, 41, 59, 0.95));
  border: 2px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  border-radius: 12px;
}

.dbtn:active {
  background: linear-gradient(145deg, #fbbf24, #f59e0b);
  color: #111827;
}

.player-icon {
  font-size: 44px;
  text-align: center;
  line-height: 44px;
  filter: drop-shadow(0 6px 3px rgba(0, 0, 0, 0.35));
  animation: bounce 0.6s infinite alternate;
}

.pixel-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: 3px solid #fff;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.15);
  text-align: center;
  line-height: 50px;
  font-size: 28px;
}

.pixel-icon.found {
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.6);
  animation: floatIcon 0.9s infinite alternate ease-in-out;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  z-index: 5000;
}

.modal-backdrop.active {
  display: flex;
}

.request-modal {
  width: min(92vw, 460px);
  border-radius: 20px;
  background: #fff;
  color: #111;
  padding: 22px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.35);
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: auto;
}

.request-modal h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.request-modal p {
  margin: 0 0 14px;
  line-height: 1.6;
}

.about-section-title {
  font-weight: bold;
  margin: 6px 0 6px !important;
}

.request-modal a {
  color: #1a73e8;
  word-break: break-all;
}

.about-list {
  margin: 0 0 14px;
  padding-left: 20px;
  line-height: 1.6;
}

.about-list li {
  margin-bottom: 8px;
}

.request-form {
  display: grid;
  gap: 10px;
}

.request-form .request-label {
  font-size: 14px;
  font-weight: bold;
  color: #374151;
}

.request-form input,
.request-form select,
.request-form textarea {
  width: 100%;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: #111;
}

.request-form select {
  cursor: pointer;
}

.request-form textarea {
  min-height: 100px;
  resize: vertical;
}

.request-form button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

.request-close-btn {
  border: none;
  background: transparent;
  color: #4b5563;
  margin-top: 12px;
  font: inherit;
  cursor: pointer;
}

.request-success {
  min-height: 1.4em;
  margin: 0;
  color: #0f766e;
  font-size: 14px;
}

#info-entries {
  display: grid;
  gap: 12px;
}

.info-entry {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.info-entry .info-entry-file {
  border: 2px solid #d1d5db;
  border-radius: 10px;
  padding: 6px;
  background: #fff;
  font-size: 12px;
}

.info-entry-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.info-hint {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
}

#info-add-entry {
  background: transparent !important;
  color: #2563eb !important;
  border: 2px dashed #2563eb !important;
  font-weight: bold;
}

#info-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .lang-toggle {
    top: 8px;
    right: 8px;
    padding: 7px 10px;
    font-size: 12px;
  }

  #menu-screen {
    padding: 16px;
  }

  #hud-top {
    padding: 6px;
    gap: 6px 8px;
  }

  #back-to-menu-btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  .menu-panel {
    width: min(96vw, 520px);
    padding: 24px 16px 24px;
  }

  .menu-subtitle {
    font-size: 14px;
  }

  #status-panel {
    width: min(88vw, 240px);
    padding: 8px;
  }

  #quest-badge {
    padding: 7px 10px;
    font-size: 11px;
  }

  #pokedex-btn {
    padding: 7px 10px;
    font-size: 11px;
  }

  #mode-toggle button {
    padding: 5px 10px;
    font-size: 11px;
  }

  #dialog-box {
    width: calc(100% - 16px);
    bottom: 140px;
    padding: 10px;
  }

  .facility-detail {
    bottom: 10px;
  }

  #dpad {
    width: 112px;
    height: 112px;
    bottom: 12px;
    left: 12px;
  }

  .player-icon {
    font-size: 34px;
    line-height: 34px;
  }

  .pixel-icon {
    width: 44px;
    height: 44px;
    line-height: 40px;
    font-size: 22px;
    border-radius: 12px;
  }
}

@media (max-width: 480px) {
  .menu-btn {
    padding: 14px 16px;
    border-radius: 16px;
  }

  #status-panel {
    width: min(80vw, 240px);
  }

  .request-modal {
    padding: 18px;
  }
}

@keyframes bounce {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-4px);
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

@keyframes popup {
  from {
    transform: translate(-50%, 15px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes floatIcon {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(-4px) scale(1.04);
  }
}

@keyframes pulseGreen {
  0%,
  100% {
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.15), 0 0 0 0 rgba(34, 197, 94, 0.4);
  }
  50% {
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.15), 0 0 0 10px rgba(34, 197, 94, 0.18);
  }
}

@keyframes pulseBlue {
  0%,
  100% {
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.15), 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  50% {
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.15), 0 0 0 10px rgba(59, 130, 246, 0.18);
  }
}

@keyframes pulseOrange {
  0%,
  100% {
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.15), 0 0 0 0 rgba(249, 115, 22, 0.4);
  }
  50% {
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.15), 0 0 0 10px rgba(249, 115, 22, 0.18);
  }
}

@keyframes pulseGold {
  0%,
  100% {
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.15), 0 0 0 0 rgba(245, 158, 11, 0.4);
  }
  50% {
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.15), 0 0 0 10px rgba(245, 158, 11, 0.18);
  }
}

/* ===== 管理画面 ===== */

html.admin-page,
body.admin-page {
  height: auto;
  min-height: 100dvh;
  overflow: auto;
}

#admin-shell {
  min-height: 100dvh;
  padding: 24px 16px 48px;
  font-family: 'DotGothic16', sans-serif;
}

.admin-header {
  max-width: 760px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-header h1 {
  margin: 0;
  font-size: clamp(20px, 4vw, 28px);
  color: #ffd54f;
  text-shadow: 0 3px 0 #8e5b00;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-link {
  color: #93c5fd;
  font-size: 14px;
  text-decoration: none;
}

.admin-link:hover {
  text-decoration: underline;
}

.admin-card {
  max-width: 760px;
  margin: 0 auto 24px;
  border: 2px solid #ffe082;
  border-radius: 18px;
  background: rgba(8, 12, 27, 0.86);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.admin-card h2 {
  margin: 0 0 12px;
  font-size: 20px;
  color: #ffd54f;
}

.admin-desc {
  margin: 0 0 14px;
  line-height: 1.6;
  color: #dfe7ff;
  font-size: 14px;
}

.admin-card input {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: #111;
}

.admin-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.admin-btn.primary {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  color: #111827;
}

.admin-btn.secondary {
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #fff;
}

.admin-error {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: #f87171;
  font-size: 14px;
}

.admin-count {
  font-size: 15px;
  color: #93c5fd;
}

.admin-request-list {
  display: grid;
  gap: 12px;
}

.admin-request-item {
  border: 1px solid rgba(255, 224, 130, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 14px;
}

.admin-request-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-request-type {
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #fff;
}

.admin-request-name {
  font-weight: 700;
  color: #fde68a;
}

.admin-request-date {
  margin-left: auto;
  font-size: 12px;
  color: #9ca3af;
}

.admin-request-note {
  margin: 10px 0 6px;
  line-height: 1.7;
  color: #f3f4f6;
}

.admin-request-contact {
  font-size: 13px;
  color: #93c5fd;
}

.admin-request-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: #dfe7ff;
}

.admin-status-select {
  border: 2px solid #d1d5db;
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: #111;
  cursor: pointer;
}

.admin-status-btn {
  padding: 6px 14px;
  font-size: 13px;
}

.admin-empty {
  margin: 0;
  color: #9ca3af;
  text-align: center;
  padding: 12px 0;
}
