/* Numex Little Planet — aydınlık, pastel arayüz */
:root {
  --ink: #24405c;
  --ink-soft: #5d7d99;
  --ink-faint: #86a2bb;
  --accent: #2f9de0;
  --accent-soft: #e4f4ff;
  --pink: #ff7fb2;
  --card: rgba(255, 255, 255, 0.86);
  --card-solid: #ffffff;
  --line: rgba(47, 157, 224, 0.16);
  --shadow: 0 18px 40px -18px rgba(35, 78, 120, 0.35), 0 2px 6px rgba(35, 78, 120, 0.06);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", "Trebuchet MS", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #bfe6ff 0%, #dcf3ff 38%, #f0fbff 66%, #fdf8ef 100%);
  transition: background 900ms ease;
  -webkit-font-smoothing: antialiased;
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
  opacity: 0.75;
  transition: opacity 900ms ease;
}

body::before {
  width: 420px; height: 150px;
  left: -80px; top: 120px;
  background: radial-gradient(closest-side, rgba(255,255,255,0.95), rgba(255,255,255,0));
}

body::after {
  width: 520px; height: 190px;
  right: -120px; top: 320px;
  background: radial-gradient(closest-side, rgba(255,255,255,0.9), rgba(255,255,255,0));
}

body.night {
  background: linear-gradient(180deg, #16233f 0%, #22355c 42%, #2f4574 74%, #40527e 100%);
  color: #eef4ff;
}

body.night::before,
body.night::after { opacity: 0.12; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

#scene.grabbing { cursor: grabbing; }

/* ---------- üst çubuk ---------- */
#topbar {
  position: fixed;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 10px; }

.logo { font-size: 26px; line-height: 1; filter: drop-shadow(0 3px 6px rgba(47,157,224,.25)); }

.brand-text h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.2px;
  font-weight: 700;
}

.brand-text p {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--ink-soft);
}

body.night .brand-text p { color: #b9c9e6; }

.namefield {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.namefield span { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .5px; }

.namefield input {
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  width: 168px;
}

.topactions { display: flex; gap: 7px; margin-left: auto; flex-wrap: wrap; }

.chip {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 11px;
  cursor: pointer;
  transition: transform .12s ease, background .16s ease, box-shadow .16s ease;
  white-space: nowrap;
}

.chip:hover { background: var(--accent-soft); transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(47,157,224,.8); }
.chip:active { transform: translateY(0); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-soft { background: #f6fbff; }

/* ---------- paneller ---------- */
#palette, #side {
  position: fixed;
  z-index: 15;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 12px;
}

#palette {
  left: 16px;
  top: 100px;
  width: 246px;
  max-height: calc(100vh - 190px);
  display: flex;
  flex-direction: column;
}

#side {
  right: 16px;
  top: 100px;
  width: 268px;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#palette h2, #side h2 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--ink-soft);
  font-weight: 700;
}

#side .card {
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

#side .card:last-child { border-bottom: 0; padding-bottom: 0; }

.palette-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.switch { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-soft); cursor: pointer; }
.switch input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

.hint { margin: 6px 0 9px; font-size: 11.5px; color: var(--ink-faint); line-height: 1.35; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  overflow-y: auto;
  padding-right: 3px;
}

.tool {
  display: flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 7px 8px;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}

.tool .ic { font-size: 15px; line-height: 1; }
.tool:hover { background: #f2faff; transform: translateY(-1px); }
.tool.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 16px -10px rgba(47,157,224,.9); }

.palette-foot {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
}

.palette-foot.full { color: #d9534f; font-weight: 700; }

/* ---------- hazır dünyalar ---------- */
.worlds { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

.world {
  display: flex;
  align-items: center;
  gap: 9px;
  font: inherit;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}

.world:hover { background: #f4fbff; transform: translateX(2px); }
.world.active { background: var(--accent-soft); border-color: rgba(47,157,224,.45); }
.world .wic { font-size: 18px; }
.world .wtxt { display: flex; flex-direction: column; }
.world .wname { font-size: 12.5px; font-weight: 700; }
.world .wdesc { font-size: 10.5px; color: var(--ink-faint); }

/* ---------- renk seçenekleri ---------- */
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.row-label { font-size: 12px; color: var(--ink-soft); }

.swatches { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

.swatch {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(47,157,224,.22);
  cursor: pointer;
  transition: transform .12s ease;
  padding: 0;
}

.swatch:hover { transform: scale(1.12); }
.swatch.active { box-shadow: 0 0 0 2px var(--accent); transform: scale(1.1); }

/* ---------- seçili nesne ---------- */
.selrow { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.selname { font-size: 14px; font-weight: 700; }

danger {
  font: inherit;
}

button.danger {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #ff6b81;
  border: 0;
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background .15s ease;
}

button.danger:hover { background: #f2546c; }

.sliderrow input[type="range"] { flex: 1; accent-color: var(--accent); min-width: 70px; }
.out { font-size: 11px; color: var(--ink-soft); width: 38px; text-align: right; }

.btnrow { display: flex; gap: 5px; }

button.icon {
  font: inherit;
  font-size: 15px;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button.icon:hover { background: var(--accent-soft); }

/* ---------- alt yardım ---------- */
#helpbar {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 9px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  font-size: 11.5px;
  color: var(--ink-soft);
}

#helpbar b { color: var(--ink); }

/* ---------- bildirim ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 78px;
  transform: translate(-50%, 12px);
  z-index: 40;
  padding: 10px 18px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  max-width: 80vw;
  text-align: center;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.warn { background: #fff4e5; border-color: rgba(240,160,75,.4); color: #a35c12; }
#toast.ok { background: #eafaf0; border-color: rgba(82,190,128,.4); color: #1f7a4d; }

/* ---------- WebGL kapısı ---------- */
#gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(233, 246, 255, 0.94);
  backdrop-filter: blur(6px);
  padding: 24px;
}

#gate[hidden] { display: none; }

.gate-box {
  max-width: 460px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 26px 26px 22px;
  text-align: center;
}

.gate-icon { font-size: 38px; }
.gate-box h2 { margin: 8px 0 8px; font-size: 18px; }
.gate-box p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink-soft); }

/* ---------- yükleniyor ---------- */
#loading {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(circle at 50% 45%, #eaf8ff, #cfeeff);
  color: var(--ink-soft);
  font-size: 13px;
  transition: opacity .5s ease;
}

#loading.hide { opacity: 0; pointer-events: none; }

.loading-planet {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #b8f0c6, #74c9a8 58%, #4aa9c9 100%);
  box-shadow: inset -10px -8px 18px rgba(30, 90, 120, .25), 0 10px 24px -12px rgba(46, 130, 160, .8);
  animation: spin 3.4s linear infinite;
}

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

/* ---------- küçük ekran ---------- */
@media (max-width: 1100px) {
  #palette { width: 210px; }
  #side { width: 232px; }
}

@media (max-width: 860px) {
  #topbar { gap: 8px; padding: 8px 10px; top: 8px; left: 8px; right: 8px; }
  .brand-text p { display: none; }
  .namefield input { width: 110px; }
  .chip { padding: 6px 8px; font-size: 11.5px; }
  #palette {
    left: 8px; right: 8px; bottom: 56px; top: auto;
    width: auto; max-height: 148px;
  }
  #palette .grid { grid-template-columns: repeat(4, 1fr); }
  #side { display: none; }
  #helpbar { font-size: 10.5px; gap: 9px; padding: 7px 10px; bottom: 8px; }
}
