:root {
  --sky: #cfe3f0;
  --panel: rgba(255, 255, 255, 0.92);
  --ink: #1f1f1f;
  --muted: #5b5b5b;
  --accent: #ff5a1f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --panel: rgba(28, 30, 34, 0.92);
    --ink: #f2f2f2;
    --muted: #b8b8b8;
  }
}

:root[data-theme="dark"] {
  --panel: rgba(28, 30, 34, 0.92);
  --ink: #f2f2f2;
  --muted: #b8b8b8;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--sky);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
}

canvas {
  display: block;
  touch-action: none;
}

#status {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  font-size: 18px;
  background: var(--sky);
  color: var(--ink);
}

#status[hidden] {
  display: none;
}

#status.error {
  color: #a0102a;
}

.hud {
  position: fixed;
  top: 12px;
  inset-inline-start: 12px;
  max-width: min(360px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
}

.hud h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.hud p {
  margin: 4px 0;
  font-size: 14px;
}

.note {
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 14px;
}

.color input {
  width: 44px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
}

[hidden] {
  display: none !important;
}

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

.toggle {
  margin-top: 0;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--muted);
}

button {
  margin-top: 8px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.info {
  position: fixed;
  bottom: 48px;
  inset-inline-end: 12px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 12px 14px 12px;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
}

.info h2 {
  margin: 0 24px 4px 0;
  font-size: 18px;
}

.info .cat {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
}

.info .osm {
  color: var(--accent);
  font-size: 14px;
}

.info .close {
  position: absolute;
  top: 6px;
  inset-inline-end: 8px;
  margin: 0;
  padding: 0 6px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.credit {
  position: fixed;
  bottom: 8px;
  inset-inline-start: 12px;
  max-width: calc(100vw - 24px);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--panel);
  font-size: 12px;
}

.credit a {
  color: var(--ink);
}

/* أزرار اللمس للهاتف */
.touch {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.joy {
  position: fixed;
  left: 16px;
  bottom: 56px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.6);
  touch-action: none;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}

.knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.touch-buttons {
  position: fixed;
  right: 16px;
  bottom: 56px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.touch-buttons button {
  margin-top: 0;
  width: 96px;
  padding: 14px 8px;
  font-size: 16px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: rgba(255, 90, 31, 0.92);
}
