/* Map editor styles, shared by /mapeditor/ (public map ideas) and /admin/maps.php (official maps). */
  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; margin: 0; background: #f8fafc; color: #0f172a; font-size: 13px; }
  h1 { font-size: 20px; margin: 0 0 2px; }
  .sub { color: #64748b; font-size: 13px; }
  .topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid #e2e8f0; background: #fff; }
  .topbar a { font-size: 13px; color: #0f172a; text-decoration: underline; margin-left: 14px; }
  .login-wrap { max-width: 360px; margin: 80px auto; text-align: center; }
  .card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 22px; }
  button { cursor: pointer; padding: 6px 11px; border-radius: 7px; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; font-size: 12.5px; font-family: inherit; }
  button:hover { border-color: #94a3b8; }
  button.primary { background: #0f172a; color: #fff; border-color: #0f172a; }
  button.danger { color: #b91c1c; }
  button:disabled { opacity: 0.45; cursor: default; }
  button.tool.on { background: #0f172a; color: #fff; border-color: #0f172a; }
  label { display: block; font-size: 11.5px; font-weight: 600; color: #475569; margin: 10px 0 3px; }
  input[type=text], input[type=number], select { display: block; width: 100%; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; font-family: inherit; background: #fff; color: #0f172a; }
  .inline { display: flex; align-items: center; gap: 6px; font-weight: 400; color: #0f172a; font-size: 12.5px; margin: 10px 0 0; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }

  .editor { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; height: calc(100vh - 67px); min-height: 560px; }
  .panel { overflow-y: auto; padding: 14px; background: #fff; }
  .panel.left { border-right: 1px solid #e2e8f0; }
  .panel.right { border-left: 1px solid #e2e8f0; }
  .panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; margin: 18px 0 8px; }
  .panel h2:first-child { margin-top: 0; }

  .maplist { display: flex; flex-direction: column; gap: 6px; }
  .mapitem { border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
  .mapitem:hover { border-color: #94a3b8; }
  .mapitem.on { border-color: #0f172a; box-shadow: 0 0 0 1px #0f172a inset; }
  .mapitem .nm { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mapitem .meta { color: #64748b; font-size: 11.5px; grid-column: 1; }
  .mapitem .rot { grid-row: 1 / span 2; grid-column: 2; font-size: 11px; color: #64748b; display: flex; align-items: center; gap: 4px; }
  .listbtns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

  .center { display: flex; flex-direction: column; min-width: 0; background: #1b1f27; position: relative; }
  .toolbar { display: flex; align-items: center; gap: 5px; padding: 8px 10px; background: #fff; border-bottom: 1px solid #e2e8f0; flex-wrap: wrap; }
  .toolbar .sep { width: 1px; height: 22px; background: #e2e8f0; margin: 0 2px; }
  .toolbar select, .toolbar input[type=number] { display: inline-block; width: auto; max-width: 128px; padding: 4px 5px; font-size: 12px; }
  .toolbar button { padding: 5px 9px; font-size: 12px; }
  .toolbar .lbl { color: #64748b; font-size: 12px; }
  .toolbar .grow { flex: 1; }
  .dirty { color: #b45309; font-size: 12px; font-weight: 600; visibility: hidden; white-space: nowrap; }
  .dirty.on { visibility: visible; } /* visibility, not display: the toolbar must not reflow mid-edit */
  .canvaswrap { flex: 1; position: relative; min-height: 0; }
  #plan { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
  #plan.select { cursor: default; }
  .statusbar { display: flex; gap: 14px; padding: 5px 10px; color: #cbd5e1; font-size: 11.5px; background: #151920; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; flex-wrap: wrap; }
  .toast { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); padding: 8px 14px; border-radius: 8px; font-size: 13px; z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
  .toast.ok { background: #dcfce7; color: #14532d; }
  .toast.err { background: #fee2e2; color: #7f1d1d; }

  .props .empty { color: #64748b; font-size: 12.5px; line-height: 1.5; }
  .props .btnrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
  .warnings { margin: 0; padding: 0; list-style: none; }
  .warnings li { font-size: 12px; padding: 6px 8px; border-radius: 6px; margin-bottom: 5px; background: #fef3c7; color: #78350f; cursor: default; }
  .warnings li.ok { background: #dcfce7; color: #14532d; }
  .warnings li.bad { background: #fee2e2; color: #7f1d1d; }
  .warnings li[data-sel] { cursor: pointer; }

  .preview { position: relative; background: #0b0d12; border-radius: 8px; overflow: hidden; height: 210px; }
  .preview canvas { display: block; width: 100%; height: 100%; cursor: grab; }
  .preview .pvbtns { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; }
  .preview .pvbtns button { padding: 3px 7px; font-size: 11px; background: rgba(255,255,255,0.85); }
  .preview .pvmsg { position: absolute; inset: 0; display: grid; place-items: center; color: #94a3b8; font-size: 12px; text-align: center; padding: 10px; }
  .preview.big { position: fixed; left: 250px; right: 300px; top: 67px; bottom: 0; height: auto; border-radius: 0; z-index: 10; }
  .keys { color: #475569; font-size: 11.5px; line-height: 1.7; }
  .keys kbd { background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 4px; padding: 0 4px; font-size: 11px; font-family: ui-monospace, monospace; }
  .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
  @media (max-width: 1100px) {
    .editor { grid-template-columns: 210px minmax(0, 1fr) 250px; }
    .preview.big { left: 210px; right: 250px; }
  }
  /* status badges, read-only notice, notes field (shared by the public + admin editors) */
  .badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #e2e8f0; color: #334155; margin-right: 3px; }
  .badge.pending { background: #fef3c7; color: #92400e; }
  .badge.accepted { background: #dcfce7; color: #166534; }
  .badge.rejected { background: #fee2e2; color: #991b1b; }
  .badge.rotation { background: #dbeafe; color: #1e40af; }
  .robar { background: #fef3c7; color: #78350f; font-size: 12.5px; padding: 7px 12px; border-bottom: 1px solid #fcd34d; }
  textarea { display: block; width: 100%; padding: 7px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font: 13px/1.4 inherit; font-family: inherit; resize: vertical; background: #fff; color: #0f172a; }
  input:disabled, select:disabled, textarea:disabled { background: #f1f5f9; color: #64748b; }

  /* view switch (2D plan / 3D) + walk test button */
  .seg { display: inline-flex; }
  .seg button { border-radius: 0; }
  .seg button:first-child { border-radius: 7px 0 0 7px; }
  .seg button:last-child { border-radius: 0 7px 7px 0; margin-left: -1px; }
  .seg button.on { background: #0f172a; color: #fff; border-color: #0f172a; position: relative; }
  button.walk { background: #15803d; color: #fff; border-color: #15803d; }
  button.walk:hover { background: #166534; border-color: #166534; }

  /* 3D editing view (main area) */
  .view3d { position: absolute; inset: 0; user-select: none; -webkit-user-select: none; }
  .view3d canvas { display: block; width: 100%; height: 100%; }
  .v3help { position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); pointer-events: none; color: #e2e8f0; background: rgba(15, 23, 42, 0.62); font-size: 11.5px; padding: 5px 9px; border-radius: 6px; }
  .v3help kbd, .v3play kbd { background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 4px; padding: 0 4px; font-size: 11px; font-family: ui-monospace, monospace; color: inherit; }

  /* walk test (full window) */
  .v3play { position: fixed; inset: 0; z-index: 1000; background: #000; }
  .v3play canvas { display: block; width: 100%; height: 100%; }
  .v3hud { position: absolute; inset: 0; pointer-events: none; color: #fff; font-size: 13px; }
  .v3cross { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.55); }
  .v3top { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(15, 23, 42, 0.66); padding: 6px 12px; border-radius: 8px; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
  .v3top b { margin-right: 8px; }
  .v3top span { color: #cbd5e1; font-size: 12px; }
  .v3info { position: absolute; left: 14px; bottom: 46px; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: rgba(15, 23, 42, 0.62); padding: 5px 9px; border-radius: 6px; }
  .v3sta { position: absolute; left: 14px; bottom: 36px; width: 180px; height: 4px; background: rgba(255, 255, 255, 0.2); border-radius: 2px; overflow: hidden; }
  .v3sta i { display: block; height: 100%; width: 100%; background: #fbbf24; }
  .v3keys { position: absolute; left: 12px; right: 12px; bottom: 10px; text-align: center; font-size: 12px; color: #e2e8f0; text-shadow: 0 1px 2px #000; line-height: 1.8; }
  .v3card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100% - 32px)); background: #fff; color: #0f172a; border-radius: 12px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
  .v3card h3 { margin: 0 0 8px; font-size: 18px; }
  .v3card p { margin: 0; font-size: 13px; line-height: 1.55; color: #334155; }
  .v3card kbd { background: #f1f5f9; border: 1px solid #cbd5e1; color: #0f172a; }
  .v3btns { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
  .v3btns button { padding: 8px 14px; font-size: 13px; }
  .v3card p + p { margin-top: 8px; color: #64748b; font-size: 12.5px; }
