:root {
  --bg-main: #060c14;
  --bg-card: rgba(16, 24, 36, 0.82);
  --bg-card-soft: rgba(21, 31, 46, 0.7);
  --text-main: #edf2f7;
  --text-soft: #a8b4c6;
  --accent: #39d0ff;
  --accent-2: #ff9f5a;
  --line: rgba(148, 163, 184, 0.25);
  --danger: #ff6b6b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Sora', sans-serif;
  background:
    radial-gradient(circle at 18% 18%, rgba(57, 208, 255, 0.2), transparent 38%),
    radial-gradient(circle at 82% 6%, rgba(255, 159, 90, 0.18), transparent 34%),
    radial-gradient(circle at 50% 92%, rgba(80, 125, 255, 0.18), transparent 42%),
    var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-x: hidden;
}

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 90%);
}

.container {
  width: 100%;
  max-width: 920px;
  position: relative;
  z-index: 2;
  margin: 0 auto;
}

.watermark {
  position: fixed;
  right: 18px;
  bottom: 12px;
  color: rgba(255, 255, 255, 0.92);
  font-family: 'Space Grotesk', sans-serif;
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  pointer-events: none;
  z-index: 1;
  text-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.watermark-brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1;
}

.watermark-tag {
  font-size: clamp(13px, 2vw, 18px);
  color: rgba(255, 255, 255, 0.85);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flag-galicia {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  background:
    linear-gradient(136deg, transparent 34%, #4a86ff 34%, #4a86ff 48%, transparent 48%),
    #ffffff;
}

.page-header {
  text-align: center;
  margin-bottom: 24px;
}

.lang-switch {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 12px;
}

.lang-btn {
  width: 42px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: transparent;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.lang-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.75);
}

.lang-btn.is-active {
  box-shadow: 0 0 0 2px rgba(57, 208, 255, 0.5);
  border-color: rgba(57, 208, 255, 0.8);
}

#lang-es {
  background:
    linear-gradient(180deg, #c60b1e 0 32%, #ffc400 32% 68%, #c60b1e 68% 100%);
}

#lang-en {
  background:
    linear-gradient(
      180deg,
      #b22234 0 10%,
      #ffffff 10% 20%,
      #b22234 20% 30%,
      #ffffff 30% 40%,
      #b22234 40% 50%,
      #ffffff 50% 60%,
      #b22234 60% 70%,
      #ffffff 70% 80%,
      #b22234 80% 90%,
      #ffffff 90% 100%
    );
  position: relative;
}

#lang-en::before,
#lang-en::after {
  content: '';
  position: absolute;
  pointer-events: none;
}

#lang-en::before {
  left: 0;
  top: 0;
  width: 45%;
  height: 58%;
  background: #3c3b6e;
  border-top-left-radius: 7px;
}

#lang-en::after {
  left: 5%;
  top: 9%;
  width: 30%;
  height: 34%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 1.2px, transparent 1.3px);
  background-size: 5px 5px;
  opacity: 0.75;
}

#lang-fr {
  background: linear-gradient(90deg, #0055a4 0 33%, #ffffff 33% 66%, #ef4135 66% 100%);
}

.eyebrow {
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  margin-bottom: 8px;
}

h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.subtitle {
  max-width: 680px;
  margin: 0 auto;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}

.main-content {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
  backdrop-filter: blur(14px);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
  animation: riseIn 0.45s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.event-title {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(8, 15, 26, 0.6);
  color: var(--text-main);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 18px;
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.1rem, 3.5vw, 1.7rem);
}

.event-title:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(57, 208, 255, 0.2);
}

#pie-svg {
  width: 100%;
  height: auto;
  max-width: 700px;
  aspect-ratio: 1 / 1;
  display: block;
  margin-inline: auto;
  overflow: visible;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(10, 20, 33, 0.5), rgba(9, 15, 25, 0.1));
}

.pie-slice {
  cursor: pointer;
  transition: filter 0.2s ease;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.action-btn {
  border: 1px solid var(--line);
  background: var(--bg-card-soft);
  color: var(--text-main);
  padding: 11px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.action-btn:hover {
  transform: translateY(-1px);
  background: rgba(28, 41, 61, 0.8);
  border-color: rgba(57, 208, 255, 0.4);
}

.action-primary {
  background: linear-gradient(120deg, rgba(57, 208, 255, 0.28), rgba(78, 151, 255, 0.2));
  border-color: rgba(57, 208, 255, 0.5);
}

.editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 15, 0.55);
  z-index: 999;
}

.editor-overlay.hidden {
  display: none;
}

.editor-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  height: 100dvh;
  background: #0b131f;
  border-left: 1px solid var(--line);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: -18px 0 45px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease;
}

.editor-panel.hidden {
  display: none;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #0b131f;
  z-index: 2;
}

.editor-header h2 {
  flex: 1;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
}

.add-btn,
.close-btn {
  border: 1px solid var(--line);
  background: rgba(27, 38, 54, 0.9);
  color: var(--text-main);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.reset-btn {
  border: 1px solid rgba(255, 159, 90, 0.4);
  background: rgba(255, 159, 90, 0.14);
  color: #ffd9c2;
  border-radius: 10px;
  height: 34px;
  padding: 0 10px;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 600;
}

.reset-btn:hover {
  background: rgba(255, 159, 90, 0.24);
}

.editor-list {
  list-style: none;
  padding: 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-item {
  background: rgba(19, 29, 44, 0.9);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  width: 100%;
}

.top-row {
  display: grid;
  grid-template-columns: 1fr 86px 42px;
  gap: 8px;
}

.category-select,
.editor-list input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(6, 11, 18, 0.8);
  color: var(--text-main);
  border-radius: 8px;
  padding: 8px 9px;
  font-size: 12px;
}

.category-select:focus,
.editor-list input:focus {
  outline: none;
  border-color: var(--accent);
}

.remove-btn {
  border: 1px solid rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.15);
  color: #ffdada;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}

.checkbox-row .label-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-soft);
}

.item-sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.item-sliders label {
  font-size: 11px;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-sliders input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  body {
    align-items: flex-start;
    padding: 12px;
  }

  .container {
    max-width: 100%;
  }

  .page-header {
    margin-bottom: 16px;
  }

  .lang-switch {
    margin-bottom: 10px;
  }

  .lang-btn {
    width: 38px;
    height: 24px;
  }

  h1 {
    font-size: clamp(1.6rem, 8vw, 2.4rem);
  }

  .subtitle {
    font-size: 0.88rem;
  }

  .main-content {
    padding: 12px;
    border-radius: 16px;
  }

  .event-title {
    margin-bottom: 12px;
    padding: 10px 12px;
    font-size: 1.05rem;
  }

  #pie-svg {
    max-width: min(100vw - 48px, 520px);
  }

  .watermark {
    right: 12px;
    bottom: 10px;
    gap: 8px;
    opacity: 0.9;
  }

  .watermark-brand {
    font-size: clamp(18px, 7vw, 28px);
  }

  .watermark-tag {
    font-size: 11px;
    gap: 6px;
  }

  .flag-galicia {
    width: 16px;
    height: 11px;
  }

  .actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .action-btn {
    padding: 12px;
  }

  .editor-panel {
    width: 100vw;
    border-left: none;
  }

  .editor-header {
    gap: 6px;
    padding: 10px;
  }

  .editor-header h2 {
    font-size: 0.96rem;
  }

  .add-btn,
  .close-btn {
    width: 30px;
    height: 30px;
  }

  .reset-btn {
    height: 30px;
    padding: 0 8px;
    font-size: 11px;
  }

  .top-row {
    grid-template-columns: 1fr 66px 36px;
    gap: 6px;
  }

  .item-sliders {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .watermark {
    right: 8px;
    bottom: 8px;
    gap: 5px;
  }

  .watermark-brand {
    font-size: clamp(14px, 6vw, 20px);
  }

  .watermark-tag {
    font-size: 10px;
  }

  .flag-galicia {
    width: 14px;
    height: 9px;
  }

  .editor-list {
    padding: 8px;
  }
}
