* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  color-scheme: light;
  --bg: #0f1216;
  --panel: #ffffff;
  --border: #d7d1c4;
  --text: #eef3f8;
  --muted: rgba(255, 255, 255, 0.68);
  --accent: #2d6cdf;
  --danger: #c4312b;
  --panel-dark: rgba(19, 24, 31, 0.78);
  --border-dark: rgba(255, 255, 255, 0.14);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg) url("../img/bck-page.png") center center / 100% auto no-repeat fixed;
}

button,
input {
  font: inherit;
}

.app {
  max-width: 1600px;
  margin: 0 auto;
  padding: 18px 16px 24px;
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-dark);
  background: var(--panel-dark);
  border-radius: 14px;
  backdrop-filter: blur(10px);
}

.title {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.2px;
}

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

button,
.file-btn {
  border: 1px solid var(--border-dark);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

button:hover,
.file-btn:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

button:active,
.file-btn:active {
  transform: translateY(1px);
}

.file-btn input {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 1000px 1fr;
  gap: 18px;
  align-items: start;
}

.map-panel {
  background: transparent;
  grid-column: 2;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-dark);
  background: var(--panel-dark);
  border-radius: 14px;
  backdrop-filter: blur(10px);
}

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

.mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.map-stage {
  position: relative;
  width: 1000px;
}

.map-viewport {
  width: 1000px;
  height: 1000px;
  border: 1px solid var(--border-dark);
  border-radius: 14px;
  overflow: hidden;
  background: #d8c59a;
  position: relative;
  touch-action: none;
  box-shadow: 0 8px 24px rgba(33, 30, 22, 0.08);
}

.map-inner {
  width: 1000px;
  height: 1000px;
  position: relative;
  transform-origin: 0 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.22), transparent 42%),
    radial-gradient(circle at 78% 28%, rgba(255, 255, 255, 0.16), transparent 46%),
    radial-gradient(circle at 30% 76%, rgba(0, 0, 0, 0.06), transparent 48%),
    linear-gradient(135deg, rgba(0, 0, 0, 0.05), transparent 40%, rgba(0, 0, 0, 0.04));
}

.objects-layer {
  position: absolute;
  inset: 0;
}

.timeline {
  border: 1px solid var(--border-dark);
  background: rgba(19, 24, 31, 0.72);
  border-radius: 14px;
  padding: 12px 12px 14px;
}

.timeline-overlay {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 20;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.timeline-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.time-label {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 60;
}

.edge-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  border: 1px solid var(--border-dark);
  background: rgba(19, 24, 31, 0.85);
  backdrop-filter: blur(10px);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
}

.edge-left {
  left: 12px;
}

.edge-right {
  right: 12px;
}

.create-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 500px;
  height: 100vh;
  transform: translateX(-500px);
  transition: transform 220ms ease;
  z-index: 70;
  border-right: 1px solid var(--border-dark);
  background: var(--panel-dark);
  backdrop-filter: blur(10px);
  padding: 14px;
  overflow: auto;
}

.create-panel.open {
  transform: translateX(0);
}

.list-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 500px;
  height: 100vh;
  transform: translateX(500px);
  transition: transform 220ms ease;
  z-index: 70;
  border-left: 1px solid var(--border-dark);
  background: var(--panel-dark);
  backdrop-filter: blur(10px);
  padding: 14px;
  overflow: auto;
}

.list-panel.open {
  transform: translateX(0);
}

.create-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-title {
  margin: 6px 0 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.form .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}

label input[type="number"],
label input[type="text"],
label input[type="file"],
label select {
  border: 1px solid var(--border-dark);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.ghost {
  background: transparent;
}

.status {
  margin-top: 10px;
  color: var(--muted);
  min-height: 18px;
  font-size: 13px;
}

.marker {
  position: absolute;
  transform: translate(-50%, -100%);
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 12px;
  user-select: none;
}

.marker:hover {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(3px);
}

.marker-img {
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  border-radius: 12px;
  border: none;
  background: transparent;
  display: block;
}

.marker-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.55);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.55);
}

.marker-title {
  display: none;
}

.marker-actions {
  display: none;
  gap: 6px;
}

.marker:hover .marker-actions {
  display: flex;
}

.mini-btn {
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 10px;
  padding: 4px 6px;
  font-size: 12px;
}

.mini-btn.danger {
  border-color: rgba(196, 49, 43, 0.4);
  color: var(--danger);
}

.object-list {
  display: grid;
  gap: 8px;
}

.obj-row {
  border: 1px solid var(--border-dark);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.obj-row-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.obj-title {
  font-weight: 700;
  font-size: 13px;
}

.obj-meta {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

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

.danger {
  color: var(--danger);
}

@media (max-width: 1320px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .map-panel {
    grid-column: auto;
    justify-self: center;
  }
  .map-viewport {
    width: 100%;
    max-width: 1000px;
  }
}
