:root {
  --bg: #9ad7ff;
  --panel: rgba(20, 28, 22, 0.72);
  --panel-border: rgba(255, 255, 255, 0.18);
  --text: #f4f7f2;
  --text-dim: #c9d6c2;
  --wood: #6b4a2b;
  --wood-dark: #4f3620;
  --wood-light: #8a623c;
  --sign-text: #f7efdc;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}

body {
  background: var(--bg);
  color: var(--text);
}

#scene-root {
  position: fixed;
  inset: 0;
}

#pasture {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  pointer-events: none;
}

.brand {
  pointer-events: auto;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.brand-owner {
  color: #ffe08a;
}

.brand-sep {
  opacity: 0.7;
}

.brand-name {
  color: var(--text);
}

.controls {
  pointer-events: auto;
  display: flex;
  gap: 10px;
}

.controls button {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.controls button:hover {
  transform: translateY(-1px);
  border-color: #ffe08a;
}

.hint {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 7px 14px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.tooltip {
  position: fixed;
  z-index: 30;
  display: none;
  max-width: 280px;
  background: rgba(12, 18, 14, 0.92);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transform: translate(-50%, -100%);
}

.tooltip.show {
  display: block;
}

.tooltip .tt-label {
  font-weight: 700;
  color: #ffe08a;
}

.tooltip .tt-url {
  color: var(--text-dim);
  word-break: break-all;
}

.fallback {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: auto;
  background:
    radial-gradient(circle at 50% 0%, #bfe6ff 0%, #8ec9f2 45%, #6fb3e6 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 16px 60px;
}

.fallback[hidden] {
  display: none;
}

.fallback-inner {
  width: 100%;
  max-width: 640px;
}

.fallback h1 {
  font-family: 'Press Start 2P', 'JetBrains Mono', monospace;
  font-size: 18px;
  color: #2f5d23;
  text-align: center;
  margin: 8px 0 4px;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.4);
}

.fallback-sub {
  text-align: center;
  color: #2f4a3a;
  font-size: 13px;
  margin: 0 0 22px;
}

.fallback-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.fallback-list li {
  display: flex;
  justify-content: center;
}

.sign {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  width: 100%;
  max-width: 420px;
  padding: 14px 18px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, var(--wood-light) 0 14px, var(--wood) 14px 28px);
  border: 3px solid var(--wood-dark);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  color: var(--sign-text);
  position: relative;
  transition: transform 0.12s ease;
}

.sign::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -16px;
  width: 10px;
  height: 16px;
  transform: translateX(-50%);
  background: var(--wood-dark);
  border-radius: 3px;
}

.sign:hover,
.sign:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.sign .sign-label {
  font-weight: 700;
  font-size: 15px;
}

.sign .sign-url {
  font-size: 11px;
  opacity: 0.85;
  word-break: break-all;
}

.sign .sign-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.3);
}

@media (max-width: 640px) {
  .brand {
    font-size: 16px;
  }

  .hint {
    font-size: 11px;
    padding: 6px 12px;
  }

  .fallback h1 {
    font-size: 14px;
  }
}
