:root {
  --bg: #0a0a14;
  --section-bg: #1a1a2e;
  --accent: #00ffcc;
}

body {
  margin: 0;
  background: var(--bg);
  color: #eee;
  font-family: system-ui, -apple-system, sans-serif;
}

header {
  padding: 12px 20px;
  background: #111827;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 3px solid var(--accent);
}

h1 { margin: 0; color: var(--accent); font-size: 1.8rem; }

.grid-stack { padding: 20px; min-height: 85vh; }

.grid-stack-item-content {
  background: var(--section-bg);
  border: 2px solid #334455;
  border-radius: 10px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.section-header {
  background: #16213e;
  padding: 10px 14px;
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  border-bottom: 1px solid #445;
}

.tings-grid {
  display: grid;
  gap: 14px;
  padding: 16px;
  flex: 1;
  overflow: auto;
}

.ting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  transition: all 0.25s ease;
  cursor: grab;
  user-select: none;
}

.ting:hover {
  transform: scale(1.12) translateY(-4px);
  background: rgba(0, 255, 204, 0.15);
  box-shadow: 0 0 15px rgba(0,255,204,0.3);
}

.ting img, .ting .icon-placeholder {
  width: var(--icon-size, 52px);
  height: var(--icon-size, 52px);
  object-fit: contain;
  filter: var(--ting-tint, none);
}

.ting span {
  font-size: 0.82rem;
  text-align: center;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ting .delete-ting {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 18px;
  color: #ff5555;
  display: none;
  cursor: pointer;
}

.ting:hover .delete-ting { display: block; }

/* Modals & Overlay */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #16213e;
  padding: 25px;
  border-radius: 12px;
  width: 90%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal input, .modal select, .modal textarea {
  padding: 10px;
  background: #0f172a;
  border: 1px solid #445577;
  color: #ddd;
  border-radius: 6px;
}

.target-desc {
  font-size: 0.85rem;
  background: #0a0f1f;
  padding: 12px;
  border-radius: 6px;
  color: #aaa;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.96);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-content {
  width: 92%;
  max-width: 1150px;
  background: #111827;
  border-radius: 12px;
  padding: 15px;
  position: relative;
}

#close-overlay {
  position: absolute;
  top: 12px;
  right: 20px;
  font-size: 32px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

#overlay-body iframe, #overlay-body video {
  width: 100%;
  height: 640px;
  border: none;
  border-radius: 8px;
}