:root {
  --bg: #16181d;
  --panel: rgba(28, 31, 38, 0.92);
  --border: #353a46;
  --text: #e8eaf0;
  --muted: #9aa1b2;
  --accent: #ffd34d;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#world { position: fixed; inset: 0; display: block; touch-action: none; }
.hidden { display: none !important; }

.bar {
  position: fixed; top: 0; left: 0; right: 0; height: 52px; padding: 0 12px;
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border-bottom: 1px solid var(--border); backdrop-filter: blur(6px);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.logo { width: 20px; height: 20px; border-radius: 4px; background: conic-gradient(#f44, #fd4, #4d4, #4cf, #44f, #f4f, #f44); }
.info { flex: 1; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.auth { display: flex; align-items: center; gap: 8px; }
/* Google butonu için sabit kutu: betik geç yüklense ya da stil engellense bile taşmaz */
#gsiButton { height: 32px; max-width: 220px; overflow: hidden; display: flex; align-items: center; }
#gsiButton svg { max-width: 20px; max-height: 20px; }
#gsiButton iframe { margin: 0 !important; }
.user { color: var(--accent); font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn, .tool, .brush, #devLogin input {
  background: #252933; color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font: inherit; cursor: pointer;
}
.btn:hover, .tool:hover, .brush:hover { background: #2f3440; }
.btn:disabled { opacity: .55; cursor: default; }
.langsel {
  background: #252933; color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 8px; font: inherit; font-size: 13px; cursor: pointer; max-width: 130px;
}
.langsel:focus { outline: none; border-color: var(--accent); }
#devLogin { display: flex; gap: 6px; }
#devLogin input { width: 110px; cursor: text; }

.tools {
  position: fixed; left: 12px; bottom: 12px; width: 300px; padding: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; z-index: 10;
  display: flex; flex-direction: column; gap: 8px;
}
.row { display: flex; gap: 6px; }
.tool { flex: 1; padding: 6px 0; font-size: 16px; }
.tool.active, .brush.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.brushrow { display: flex; align-items: center; gap: 8px; }
.lbl { color: var(--muted); font-size: 12px; width: 34px; }
.brushes { display: flex; gap: 4px; flex: 1; }
.brush { flex: 1; padding: 4px 0; font-size: 12px; font-variant-numeric: tabular-nums; min-width: 0; }
.tools .row { flex-wrap: nowrap; gap: 4px; }
.tools .tool { font-size: 15px; min-width: 0; }

/* Klasik renk seçici */
.picker { display: flex; flex-direction: column; gap: 8px; }
.sv { position: relative; height: 130px; border-radius: 8px; background: #f00; cursor: crosshair; touch-action: none; overflow: hidden; }
.sv-white, .sv-black { position: absolute; inset: 0; pointer-events: none; }
.sv-white { background: linear-gradient(to right, #fff, rgba(255,255,255,0)); }
.sv-black { background: linear-gradient(to top, #000, rgba(0,0,0,0)); }
.thumb {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px #000a, 0 1px 3px #0008; pointer-events: none;
}
.hue {
  position: relative; height: 14px; border-radius: 7px; cursor: pointer; touch-action: none;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}
.hthumb {
  position: absolute; top: -2px; width: 8px; height: 18px; margin-left: -4px; border-radius: 3px;
  background: #fff; box-shadow: 0 0 0 1px #000a, 0 1px 3px #0008; pointer-events: none;
}
.current { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.swatch { width: 28px; height: 28px; flex: none; border-radius: 6px; border: 2px solid #fff3; }
.ch { display: flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; }
.ch.r { color: #ff6b6b; } .ch.g { color: #5bd16b; } .ch.b { color: #6aa8ff; }
.ch input, .hexin {
  width: 38px; text-align: right; background: #252933; color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 5px; font: inherit; font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums;
}
.hexin { width: 70px; margin-left: auto; text-align: left; font-family: ui-monospace, Consolas, monospace; }
.ch input:focus, .hexin:focus { outline: none; border-color: var(--accent); }

/* Resim içe aktarma */
.importbar { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px dashed #7cc4ff; border-radius: 8px; background: #1d2633; }
.ib-title { font-size: 13px; color: #b9dcff; }
.ib-size { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.ib-size input { flex: 1; accent-color: #7cc4ff; }
.ib-size span { width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.importbar .formrow .btn:first-child { margin-right: auto; }

/* Kaydet */
.saverow { display: flex; align-items: center; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.draft { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); line-height: 1.25; }
.draft.dirty { color: #ff9f43; }
.saverow .btn { padding: 6px 9px; font-size: 13px; white-space: nowrap; }

.card {
  position: fixed; right: 12px; bottom: 12px; width: 320px; max-height: calc(100vh - 80px); overflow: auto;
  padding: 14px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; z-index: 11;
}
.card h2 { margin: 0 0 8px; margin-inline-end: 24px; font-size: 17px; overflow-wrap: anywhere; }
.card .owner { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.card .about { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.card .about:empty { display: none; }
.card .about a { color: #7cc4ff; }
.card .close { position: absolute; top: 6px; inset-inline-end: 8px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.card .close:hover { color: var(--text); }
.card form { display: flex; flex-direction: column; gap: 10px; }
.card label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.card input, .card textarea, .card select {
  background: #252933; color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 9px; font: inherit; resize: vertical;
}
.card input:focus, .card textarea:focus, .card select:focus { outline: none; border-color: var(--accent); }
.card .note { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: #3a2a1f; color: #ffcf9a; font-size: 13px; }
.cardactions { display: flex; gap: 8px; }
.btn.report { margin-left: auto; color: #ff9a9a; border-color: #5a3434; background: transparent; font-size: 13px; }
.btn.report:hover:not(:disabled) { background: #3a2226; }
.btn.danger { background: #d94a4a; border-color: #d94a4a; color: #fff; font-weight: 600; }
.formrow { display: flex; align-items: center; gap: 8px; }
.formrow .count { margin-right: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.btn.primary { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 600; }
.btn.primary:disabled { background: #3a3f4b; border-color: #3a3f4b; color: var(--muted); }

.toast {
  position: fixed; left: 50%; top: 64px; transform: translate(-50%, -10px); opacity: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px;
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .brand { font-size: 0; gap: 0; }
  .info { font-size: 12px; }
  #btnHome { display: none; }
  .langsel { max-width: 84px; padding: 6px 4px; }
  .tools { left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 55vh; overflow: auto; }
  .card { left: 8px; right: 8px; top: 60px; bottom: auto; width: auto; }
}
