* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(circle at 50% 18%, rgba(116, 78, 130, 0.28), transparent 58%),
    radial-gradient(circle at 50% 100%, rgba(214, 141, 62, 0.14), transparent 55%),
    #120d14;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#stage {
  position: relative;
  width: min(100vw, 48.9vh, 460px);
  aspect-ratio: 440 / 900;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 22px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 220, 150, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  touch-action: none;
  cursor: grab;
}

canvas:active {
  cursor: grabbing;
}

.rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  background: rgba(14, 9, 16, 0.94);
  color: #fff2d4;
  text-align: center;
  padding: 24px;
}

.rotate-hint .phone {
  width: 44px;
  height: 74px;
  border: 3px solid #ffd45e;
  border-radius: 9px;
  box-shadow: 0 0 24px rgba(255, 212, 94, 0.35);
}

.rotate-hint strong {
  font-size: 19px;
  letter-spacing: 0.2px;
}

.rotate-hint span {
  font-size: 13px;
  color: rgba(255, 242, 212, 0.7);
}

@media (orientation: landscape) and (max-height: 520px) {
  .rotate-hint {
    display: flex;
  }
}

/* Ayarlar paneli (dişli butonu) */
#settings {
  position: absolute;
  top: 9%;
  right: 2.3%;
  z-index: 10;
  width: min(260px, calc(100% - 24px));
  padding: 10px 12px 12px;
  border-radius: 14px;
  background: rgba(30, 21, 32, 0.97);
  border: 1px solid rgba(255, 212, 94, 0.25);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  color: #fff6e6;
  font-size: 13px;
}

#settings[hidden] {
  display: none;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.settings-head strong {
  font-size: 14px;
  letter-spacing: 0.3px;
}

.settings-close {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff6e6;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

#settings .setting {
  display: grid;
  gap: 6px;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
}

#settings .setting.active {
  border-color: rgba(255, 212, 94, 0.4);
  background: rgba(255, 212, 94, 0.08);
}

.setting-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  cursor: pointer;
}

.setting-check input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #ffd45e;
}

.setting-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-left: 25px;
  color: rgba(255, 246, 230, 0.75);
}

.setting-count input {
  width: 64px;
  padding: 5px 7px;
  border-radius: 7px;
  border: 1px solid rgba(255, 246, 230, 0.25);
  background: rgba(0, 0, 0, 0.3);
  color: #fff6e6;
  font: inherit;
  font-weight: 800;
  text-align: center;
  user-select: text;
}

.setting-count input:disabled {
  opacity: 0.35;
}

#settings .setting:not(.active) .setting-count {
  opacity: 0.5;
}

#settings small {
  padding-left: 25px;
  color: rgba(255, 246, 230, 0.5);
  font-size: 11px;
  line-height: 1.35;
}

.settings-note {
  min-height: 14px;
  margin: 8px 0 0;
  color: #ffe29a;
  font-size: 11px;
}

.settings-editor {
  width: 100%;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 212, 94, 0.35);
  border-radius: 10px;
  background: rgba(255, 212, 94, 0.12);
  color: #ffe29a;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

#settings .setting-count-flush {
  padding-left: 0;
}

.settings-publish {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 246, 230, 0.18);
}

.settings-deploy {
  border-color: rgba(120, 200, 255, 0.4);
  background: rgba(90, 160, 230, 0.16);
  color: #cfe9ff;
}

.settings-deploy:disabled {
  opacity: 0.6;
  cursor: progress;
}

.settings-publish .settings-note a {
  color: #9fd8ff;
  word-break: break-all;
}

#settings .settings-publish small {
  padding-left: 0;
}

/* Harita editörü: oyun alanının tamamını kaplar */
#map-editor {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 22px;
  background: #1a141c;
  color: #fff6e6;
  font-size: 13px;
}

#map-editor[hidden] {
  display: none;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-head strong {
  font-size: 16px;
}

#map-editor button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff6e6;
  font: inherit;
  font-weight: 700;
  padding: 8px 6px;
  cursor: pointer;
}

#map-editor .editor-x {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 18px;
}

.editor-tools,
.editor-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.editor-actions.main {
  grid-template-columns: 1fr 1.6fr;
}

#map-editor .editor-tools button.on {
  border-color: #ffd45e;
  background: rgba(255, 212, 94, 0.2);
  color: #ffe29a;
}

#map-editor button.primary {
  border-color: #e89c2e;
  background: linear-gradient(#ffd45e, #e89c2e);
  color: #2a1c00;
  font-weight: 900;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: -1px;
}

.dot.blue { background: #48a7ff; }
.dot.red { background: #ff6170; }

.editor-canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.editor-canvas {
  display: block;
  border-radius: 0;
  box-shadow: none;
  touch-action: none;
  cursor: crosshair;
}

.editor-status {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 9px;
  font-size: 11.5px;
  line-height: 1.35;
}

.editor-status.ok {
  background: rgba(111, 224, 111, 0.12);
  color: #b6f5a8;
}

.editor-status.warn {
  background: rgba(255, 122, 98, 0.12);
  color: #ffc2b4;
}

.editor-status ul {
  margin: 3px 0 0;
  padding-left: 16px;
}

.editor-size {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-size span {
  color: rgba(255, 246, 230, 0.7);
  font-weight: 700;
}

.editor-size input {
  width: 54px;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 246, 230, 0.25);
  background: rgba(0, 0, 0, 0.3);
  color: #fff6e6;
  font: inherit;
  font-weight: 800;
  text-align: center;
  user-select: text;
}

#map-editor .editor-size button {
  margin-left: auto;
  padding: 6px 14px;
}

.editor-hint {
  margin-top: -2px;
  color: rgba(255, 246, 230, 0.55);
  font-size: 11px;
}

#map-editor .editor-actions button.on {
  border-color: #ffd45e;
  background: rgba(255, 212, 94, 0.2);
  color: #ffe29a;
}

.editor-drawer {
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 212, 94, 0.25);
}

.editor-drawer[hidden] {
  display: none;
}

.drawer-fields {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.drawer-fields label {
  display: grid;
  gap: 3px;
  flex: 1;
  color: rgba(255, 246, 230, 0.7);
  font-size: 11px;
  font-weight: 700;
}

.drawer-fields input {
  width: 100%;
  min-width: 0;
  padding: 7px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 246, 230, 0.25);
  background: rgba(0, 0, 0, 0.3);
  color: #fff6e6;
  font: inherit;
  font-weight: 800;
  user-select: text;
}

.drawer-fields input[type="number"] {
  text-align: center;
}

.drawer-fields > input {
  flex: 1;
}

#map-editor .drawer-fields button {
  flex: none;
  padding: 8px 12px;
}

.editor-drawer small {
  color: rgba(255, 246, 230, 0.6);
  font-size: 11px;
  line-height: 1.35;
}

.library-list {
  display: grid;
  gap: 4px;
  max-height: 128px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.library-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}

.library-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.library-name small {
  margin-left: 6px;
  color: rgba(255, 246, 230, 0.5);
  font-size: 10px;
}

#map-editor .library-list button {
  padding: 4px 10px;
  font-size: 12px;
}

#map-editor .library-list button.danger {
  color: #ffb4a6;
}

.library-empty {
  color: rgba(255, 246, 230, 0.5);
  font-size: 12px;
}

.setting select { background:#302330; color:#fff6e6; border:1px solid #796047; border-radius:8px; padding:8px 12px; font:inherit; }
#settings { max-height:85vh; overflow-y:auto; }

/* Native text and SVG portraits stay crisp independently of the game camera. */
body { font-family:'Segoe UI',Arial,sans-serif; }
#team-bar { position:absolute; left:3%; right:33%; bottom:1.8%; height:4.8%; display:flex; gap:4px; z-index:3; }
#team-bar[hidden] { display:none; }
#team-bar button { position:relative; min-width:0; flex:1; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:0; padding:1px 2px 4px; border:1px solid #52749b; border-radius:8px; background:#17283e; color:#fff; font:600 10px/1.2 'Segoe UI',Arial,sans-serif; cursor:pointer; overflow:hidden; }
#team-bar svg { width:24px; height:24px; flex-shrink:0; }
#team-bar button { font-size:11px; }
#team-bar button[aria-pressed=true] { border:2px solid #ffda75; background:#24466b; box-shadow:0 0 8px #ffda752b; }
#team-bar button:disabled { cursor:default; }
#team-bar button:disabled:not([aria-pressed=true]) { opacity:.65; }
#team-bar button i { position:absolute; bottom:0; left:0; height:3px; width:var(--health); background:#7ee29d; }
#team-bar .ammo-badge { position:absolute; top:1px; right:2px; padding:0 3px; border-radius:6px; background:#ffd45e; color:#3a2410; font:800 9px/1.3 'Segoe UI',Arial,sans-serif; }
#team-bar button:focus-visible { outline:2px solid white; outline-offset:2px; }
#settings { width:min(310px,calc(100% - 24px)); font-size:14px; }
#settings small { font-size:12px; line-height:1.5; color:#dbe5f4; }
.settings-head strong { font-size:18px; }
@media(max-width:380px) { #team-bar button { font-size:9px; } }

#map-editor .drawer-buttons button { flex: 1; }
#map-editor .drawer-buttons button:disabled { opacity: .6; cursor: progress; }
