/* World Sweeper — app styles */

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

html, body {
  height: 100%;
  height: 100dvh; /* iOS Safari: dynamic viewport height */
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a2530;
  color: #ECEFF1;
}

/* ---- Layout ---- */

.app-wrapper {
  display: flex;
  flex-direction: column;
  /* AdSense 等による body 直下への要素注入・広告による高さ膨張から
     ゲームレイアウトを守るため、強制的にビューポート全体を占有する */
  position: fixed;
  inset: 0;
  height: 100%;
  height: 100dvh;
  min-height: 100%;
  min-height: 100dvh;
}

.ad-banner {
  /* flex-basis を固定値にし、Google の ins が何 px でも親は 90px 固定。
     max-height だけでは Google 側 JS の height 指定と衝突するケースがあるため、
     height / flex: 0 0 90px で確実に固定する。 */
  flex: 0 0 90px;
  width: 100%;
  height: 90px;
  max-height: 90px;
  background: #0f1720;
  overflow: hidden;
}
.ad-banner:empty {
  /* slot 未設定・広告未配信時は枠を出さない */
  flex: 0 0 0;
  height: 0;
}

.game-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

#game-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  display: block;
}

#effects-layer,
.effects-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#effects-layer {
  z-index: 2;
}

/* ---- エリアクリア時のフロート演出（pt + スタミナ） ---- */
.stamina-award-float {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  font-weight: bold;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8), 0 0 2px rgba(0, 0, 0, 0.9);
  animation: stamina-award-rise 1.4s ease-out forwards;
  white-space: nowrap;
}
.stamina-award-float .pts {
  font-size: 1.4rem;
  color: #FFD54F;
}
.stamina-award-float .sp {
  font-size: 1.1rem;
  color: #80DEEA;
}
@keyframes stamina-award-rise {
  0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  15%  { transform: translate(-50%, -60%) scale(1.15); opacity: 1; }
  35%  { transform: translate(-50%, -80%) scale(1.0); opacity: 1; }
  100% { transform: translate(-50%, -160%) scale(0.95); opacity: 0; }
}

/* ---- Header ---- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.8rem;
  background: #1C313A;
  border-bottom: 2px solid #37474F;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.title {
  font-size: 1.1rem;
  font-weight: bold;
}

.user-id {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: #90A4AE;
  font-family: monospace;
}

.user-id.clickable {
  cursor: pointer;
  border-bottom: 1px dashed #546E7A;
}

.user-id.clickable:hover {
  color: #ECEFF1;
}

.score {
  font-size: 0.85rem;
  color: #FFD54F;
  font-weight: bold;
  white-space: nowrap;
}

.score.stamina {
  color: #80DEEA;
  cursor: help;
}

.score.color-swap {
  color: #B7E66E;
}

.score.stamina.low {
  color: #FF8A65;
}

.stamina-timer {
  margin-left: 0.35rem;
  font-size: 0.72rem;
  color: #90A4AE;
  font-weight: normal;
}

.stamina-debug {
  display: inline-flex;
  gap: 0.2rem;
  margin-left: 0.3rem;
}
.stamina-debug[hidden] { display: none; }
.stamina-debug-btn {
  background: #455A64;
  border: 1px solid #78909C;
  color: #ECEFF1;
  border-radius: 3px;
  padding: 0 0.4rem;
  font-size: 0.85rem;
  line-height: 1.4;
  cursor: pointer;
}
.stamina-debug-btn:hover { background: #546E7A; }
.stamina-debug-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.header-btn {
  background: #37474F;
  border: 1px solid #546E7A;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  color: #ECEFF1;
}

.header-btn:hover {
  background: #455A64;
}

.header-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid #546E7A;
  border-radius: 4px;
  background: #263238;
  color: #CFD8DC;
  font-size: 0.78rem;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.header-toggle input {
  accent-color: #4FC3F7;
}

/* ---- Toast ---- */

.toast {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  max-width: calc(100% - 2rem);
  padding: 0.7rem 1.2rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: bold;
  z-index: 2000;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-success { background: #2E7D32; color: #fff; }
.toast-danger  { background: #C62828; color: #fff; }
.toast-warn    { background: #E65100; color: #fff; }
.toast-info    { background: #1565C0; color: #fff; }

/* ---- Overlay / Modal ---- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.overlay.visible {
  display: flex;
}

#active-overlay {
  padding: max(0.75rem, env(safe-area-inset-top, 0px)) max(0.75rem, env(safe-area-inset-right, 0px)) max(0.75rem, env(safe-area-inset-bottom, 0px)) max(0.75rem, env(safe-area-inset-left, 0px));
  align-items: flex-start;
  overflow-y: auto;
}

.modal {
  background: var(--site-panel-strong);
  border: 1px solid var(--site-line);
  box-sizing: border-box;
  color: var(--site-ink);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 420px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

#active-overlay .modal {
  margin: auto;
  max-height: calc(100dvh - 1.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}

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

.modal-header h2 {
  font-size: 1.1rem;
}

.overlay-close {
  background: none;
  border: none;
  color: var(--site-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.overlay-close:hover {
  color: var(--site-ink);
}

/* ---- Leaderboard ---- */

.lb-list {
  list-style: none;
  padding: 0;
}

.lb-list li {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #37474F;
  font-size: 0.85rem;
}

.lb-list li.me {
  color: #FFD54F;
  font-weight: bold;
}

.lb-list .rank {
  min-width: 1.5rem;
  text-align: center;
  color: #78909C;
}

.lb-list .uid {
  flex: 1;
  font-family: monospace;
  font-size: 0.8rem;
  color: #90A4AE;
}

.lb-list .pts {
  color: #FFD54F;
  font-weight: bold;
  min-width: 60px;
  text-align: right;
}

.lb-list .areas {
  color: #80DEEA;
  min-width: 50px;
  text-align: right;
  font-size: 0.8rem;
}

.lb-list .lb-jump {
  background: none;
  border: 1px solid #546E7A;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
  margin-left: 4px;
  color: #ECEFF1;
}
.lb-list .lb-jump:hover {
  background: #37474F;
}

.lb-list .active-ago {
  color: #90A4AE;
  font-size: 0.75rem;
}

/* ---- Help ---- */

.help-content h3 {
  margin: 0.8rem 0 0.4rem;
  font-size: 0.95rem;
  color: #80DEEA;
}

.help-content p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #B0BEC5;
}

.help-content ul {
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: #B0BEC5;
  line-height: 1.6;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.help-table td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid #37474F;
}

.help-table td:first-child {
  white-space: nowrap;
  color: #FFD54F;
}

/* ---- Jump button ---- */

.jump-btn {
  background: #1B5E20 !important;
  border-color: #4CAF50 !important;
  font-size: 0.8rem;
}

.jump-btn:hover {
  background: #2E7D32 !important;
}

/* ---- Area switch dialog ---- */

.modal-small {
  max-width: 340px;
}

.modal-body-text {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--site-muted);
  margin-bottom: 1rem;
}

.modal-stamina-info {
  font-size: 0.85rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.7rem;
  border-radius: 4px;
  background: var(--site-panel-strong);
  border: 1px solid var(--site-line);
  color: var(--site-muted);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  white-space: nowrap;
}
.modal-stamina-info.insufficient {
  border-color: #E65100;
  color: #FF8A65;
}
.modal-stamina-info .ms-cost { color: var(--site-secondary); font-weight: bold; }
.modal-stamina-info .ms-cost.premium { color: #FFD54F; }
.modal-stamina-info .ms-current { color: var(--site-ink); font-weight: bold; }
.modal-stamina-info .ms-current.low { color: #FF8A65; }
.modal-stamina-info[hidden] { display: none; }

.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

/* リザルトオーバーレイはcanvas上のズーム操作を通過させる。
   #game-stage（position: relative）配下に配置し、ビューポート全体ではなく
   ゲームキャンバスの下部にモーダルを表示する（Toast と同じ基準）。 */
#result-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
  align-items: flex-end;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  z-index: 1000;
}

#result-overlay .modal {
  pointer-events: auto;
  background: rgba(18, 28, 36, 0.92);
}

/* Demo replay controls */
.demo-replay {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 0;
}

.demo-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.demo-speed-btns {
  display: flex;
  gap: 0.25rem;
}

.demo-speed-btns .demo-speed {
  background: #263238;
}

.demo-speed-btns .demo-speed.active {
  background: #1565C0;
  border-color: #1976D2;
  color: #fff;
}

.demo-seek {
  width: 100%;
  accent-color: #1976D2;
  cursor: pointer;
}

.demo-camera-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #B0BEC5;
  cursor: pointer;
  user-select: none;
}

.btn {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: 1px solid #546E7A;
  font-size: 0.85rem;
  cursor: pointer;
  color: #ECEFF1;
}

.btn-primary {
  background: #1565C0;
  border-color: #1976D2;
}

.btn-primary:hover {
  background: #1976D2;
}

.btn-secondary {
  background: #37474F;
}

.btn-secondary:hover {
  background: #455A64;
}

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

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* ---- Profile modal ---- */

.profile-section {
  margin-bottom: 1.2rem;
}

.profile-label {
  display: block;
  font-size: 0.75rem;
  color: var(--site-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-hint {
  font-size: 0.75rem;
  color: var(--site-muted);
  margin: 0 0 0.6rem;
}

.profile-name-row {
  display: flex;
  gap: 0.5rem;
}

.profile-custom-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.profile-input {
  flex: 1;
  padding: 0.4rem 0.6rem;
  background: var(--site-panel);
  border: 1px solid var(--site-line);
  border-radius: 4px;
  color: var(--site-ink);
  font-size: 0.85rem;
}

.profile-input:focus {
  outline: none;
  border-color: var(--site-secondary, #0f596c);
}

.profile-icon-input {
  flex: 0 0 4.2rem;
  text-align: center;
  font-size: 1.1rem;
}

.profile-icon-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
  max-height: 10rem;
  overflow-y: auto;
  padding: 0.4rem;
  background: var(--site-bg);
  border: 1px solid var(--site-line);
  border-radius: 6px;
}

.profile-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

.profile-icon-btn:hover {
  background: rgba(255,255,255,0.1);
}

.profile-icon-btn.selected {
  border-color: #42A5F5;
  background: rgba(66,165,245,0.2);
}

.profile-color-input {
  flex: 0 0 3.4rem;
  height: 2.2rem;
  padding: 0.2rem;
  background: #263238;
  border: 1px solid #546E7A;
  border-radius: 4px;
  cursor: pointer;
}

.profile-color-preview {
  height: 2.4rem;
  border-radius: 6px;
  border: 2px solid #546E7A;
  margin-bottom: 0.6rem;
}

.profile-hsv-sliders {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.profile-slider-label {
  font-size: 0.7rem;
  color: #78909C;
}

.profile-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1.4rem;
  border-radius: 4px;
  outline: none;
  margin-bottom: 0.3rem;
}

.profile-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #263238;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.profile-slider-hue {
  background: linear-gradient(to right,
    hsl(0,100%,50%), hsl(60,100%,50%), hsl(120,100%,50%),
    hsl(180,100%,50%), hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%));
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.player-icon {
  font-size: 1rem;
  line-height: 1;
}

.player-icon-img {
  width: 1.2em;
  height: 1.2em;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
}

.player-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Provider buttons */

.provider-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 1rem;
  margin-bottom: 0.5rem;
  border: 1px solid #546E7A;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  color: #ECEFF1;
  transition: background 0.15s;
}

.provider-btn:hover {
  filter: brightness(1.15);
}

.provider-btn.google {
  background: #4285F4;
  border-color: #4285F4;
}

.provider-btn .provider-icon {
  font-size: 1.1rem;
  width: 1.4rem;
  text-align: center;
}

/* Linked provider display */

.btn-danger {
  background: #B71C1C;
  border-color: #C62828;
}

.btn-danger:hover {
  background: #C62828;
}

.profile-logout-section {
  border-top: 1px solid #37474F;
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.provider-linked {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.5rem;
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.3);
  border-radius: 6px;
  font-size: 0.8rem;
  color: #A5D6A7;
}

/* ---- Active grid badges ---- */

.active-badge {
  font-size: 0.75rem;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
}

.active-badge.cleared {
  background: color-mix(in srgb, var(--badge-color, #66BB6A) 20%, transparent);
  color: var(--badge-color, #81C784);
}

.active-badge.working {
  background: color-mix(in srgb, var(--badge-color, #42A5F5) 20%, transparent);
  color: var(--badge-color, #90CAF9);
}

.active-badge.mistake {
  background: color-mix(in srgb, var(--badge-color, #EF5350) 20%, transparent);
  color: var(--badge-color, #FFCDD2);
}

.active-penalty {
  font-size: 0.7rem;
  color: #EF9A9A;
  white-space: nowrap;
}

/* ---- Version update banner ---- */

.version-update-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
  left: 50%;
  transform: translateX(-50%) translateY(-150%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: calc(100% - 2rem);
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  background: #1565C0;
  color: #fff;
  font-size: 0.9rem;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 3000;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: auto;
}

.version-update-banner--show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.version-update-banner__msg {
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.version-update-banner__reload {
  flex: 0 0 auto;
  background: #fff;
  color: #1565C0;
  border: none;
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  font-weight: bold;
  cursor: pointer;
}

.version-update-banner__reload:hover {
  filter: brightness(0.95);
}

.version-update-banner__close {
  flex: 0 0 auto;
  background: transparent;
  color: #fff;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
}

/* ---- News toast (clickable) ---- */

.toast-news {
  pointer-events: auto;
  cursor: pointer;
}

.toast-news:hover {
  filter: brightness(1.1);
}

/* ---- History tab ---- */

.tab-bar {
  display: flex;
  border-bottom: 2px solid #37474F;
  margin-bottom: 0.8rem;
}

.tab-bar button {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #78909C;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: -2px;
}

.tab-bar button.active {
  color: #ECEFF1;
  border-bottom-color: #1976D2;
}

.tab-content {
  display: none;
}

.tab-content.visible {
  display: block;
}

/* ---- Tutorial ---- */

.tutorial-modal {
  max-width: 520px;
}

.tutorial-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.tutorial-title {
  font-size: 1rem;
  color: #ECEFF1;
  margin-bottom: 0.5rem;
}

.tutorial-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #B0BEC5;
  margin-bottom: 0.9rem;
}

.tutorial-board {
  display: grid;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.8rem;
}

.tutorial-cell {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 1px solid #546E7A;
  background: #37474F;
  color: #ECEFF1;
  font-size: 1.25rem;
  font-weight: bold;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.tutorial-cell.revealed {
  background: #ECEFF1;
  color: #263238;
}

.tutorial-cell.flagged {
  background: #FFF3E0;
  color: #EF6C00;
}

.tutorial-cell.exploded {
  background: #B71C1C;
  color: #fff;
}

.tutorial-cell.highlight {
  box-shadow: 0 0 0 3px rgba(255, 213, 79, 0.55);
}

.tutorial-hint {
  font-size: 0.85rem;
  color: #FFD54F;
  margin-bottom: 0.8rem;
  min-height: 1.4em;
}

/* ---- Admin ---- */

.admin-page {
  min-height: 100dvh;
  overflow: auto;
}

.admin-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: grid;
  gap: 1rem;
}

.admin-panel {
  background: var(--site-panel-strong, #fffaf0);
  border: 1px solid var(--site-line, rgba(16, 36, 50, 0.12));
  border-radius: 10px;
  padding: 1.25rem;
  color: var(--site-ink, #102432);
}

.admin-panel h1,
.admin-panel h2 {
  color: var(--site-ink, #102432);
}

.login-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.login-benefits li {
  font-size: 0.9rem;
  color: var(--site-muted, #536271);
  padding: 0.45rem 0.75rem;
  background: var(--site-line, rgba(16,36,50,0.07));
  border-radius: 8px;
}

.admin-subtitle,
.admin-user,
.admin-message {
  color: var(--site-muted, #536271);
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
}

.admin-message[data-type="error"] {
  color: #b94040;
}

.admin-message[data-type="success"] {
  color: #2d7a3a;
}

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

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

.drop-zone {
  min-height: 140px;
  border: 2px dashed var(--site-line, rgba(16, 36, 50, 0.25));
  border-radius: 10px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  background: rgba(16, 36, 50, 0.04);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.drop-zone.drag-over {
  border-color: var(--site-secondary, #0f596c);
  background: rgba(15, 89, 108, 0.08);
}

.drop-zone strong {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--site-ink, #102432);
}

.drop-zone span {
  color: var(--site-muted, #536271);
  font-size: 0.85rem;
}

.image-preview {
  margin-top: 0.75rem;
  min-height: 140px;
  border: 1px solid var(--site-line, rgba(16, 36, 50, 0.12));
  border-radius: 10px;
  padding: 0.75rem;
  display: grid;
  gap: 0.35rem;
  align-content: start;
  background: rgba(16, 36, 50, 0.04);
}

.image-preview.empty {
  place-items: center;
  color: var(--site-muted, #536271);
}

.image-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  background: #111;
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.upload-progress-bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: #263238;
  overflow: hidden;
}

#upload-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #26A69A, #42A5F5);
}

.admin-map-list {
  list-style: none;
  display: grid;
  gap: 0.6rem;
}

.admin-map-list li {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--site-line, rgba(16, 36, 50, 0.12));
}

.admin-map-list a {
  color: var(--site-secondary, #0f596c);
}

#user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--site-muted, #536271);
  font-size: 0.9rem;
}

/* admin-page でのみ profile-* をライトテーマに上書き */
.admin-page .profile-label {
  color: var(--site-muted, #536271);
}

.admin-page .profile-input {
  background: #fff;
  border-color: rgba(16, 36, 50, 0.2);
  color: var(--site-ink, #102432);
}

.admin-page .profile-input:focus {
  border-color: var(--site-secondary, #0f596c);
  outline: none;
}

.admin-page .profile-input::placeholder {
  color: rgba(16, 36, 50, 0.35);
}

.admin-page select.profile-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23536271'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  appearance: none;
  padding-right: 1.8rem;
}

.admin-page .btn-secondary {
  background: #eef8fb;
  border-color: rgba(15, 89, 108, 0.28);
  color: var(--site-secondary, #0f596c);
}

.admin-page .btn-secondary:hover {
  background: #dff2f7;
}

.admin-page .btn-primary {
  background: #d86f2e;
  border-color: #c8632a;
  color: #fffaf0;
}

.admin-page .btn-primary:hover {
  background: #c8632a;
}

.admin-page .btn:disabled,
.admin-page .btn[disabled] {
  background: #dce3e6;
  border-color: rgba(83, 98, 113, 0.20);
  color: #7b8a96;
}

/* ---- Loading overlay ---- */

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(26, 37, 48, 0.94);
  transition: opacity 0.4s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #37474F;
  border-top-color: #42A5F5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 1rem;
  font-size: 1rem;
  color: #90A4AE;
}

/* ---- My Map Item (Issue #120) ---- */

.admin-map-list li.my-map-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.my-map-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.my-map-edit-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.my-map-action-row {
  display: flex;
  gap: 0.5rem;
}

.my-map-url-row {
  align-items: center;
}

.my-map-url-prefix {
  color: var(--site-muted, #536271);
  font-size: 0.86rem;
  font-weight: 700;
}

.my-map-url-input {
  min-width: 12rem;
}

.profile-input-sm {
  flex: none;
  width: auto;
}

.admin-page .map-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.25;
}

.admin-page .badge-public {
  background: #e7f8f0;
  color: #0f6b49;
  border: 1px solid rgba(15, 107, 73, 0.32);
}

.admin-page .badge-private {
  background: #fff0e8;
  color: #b94712;
  border: 1px solid rgba(185, 71, 18, 0.34);
}

.admin-page .badge-mode {
  border: 1px solid transparent;
}

.admin-page .badge-mode-mine {
  background: #fff3cf;
  color: #8c4b00;
  border-color: rgba(140, 75, 0, 0.28);
}

.admin-page .badge-mode-color {
  background: #e4f7ff;
  color: #006c9c;
  border-color: rgba(0, 108, 156, 0.30);
}

.admin-page .badge-unknown {
  background: #eef2f5;
  color: #536271;
  border: 1px solid rgba(83, 98, 113, 0.28);
}

.radio-group {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--site-muted, #536271);
  cursor: pointer;
}
