
* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --background: #100b12;
  --panel: #1b141e;
  --panel-dark: #100d13;
  --red: #a52c46;
  --red-dark: #260d16;
  --purple: #593040;
  --text: #e8e0e5;
  --muted: #a99aaa;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at center, #24101c, var(--background) 65%);
  color: var(--text);
  font-family: Georgia, serif;
}

button, select {
  padding: 11px 16px;
  background: var(--red-dark);
  color: #e5c4cb;
  border: 1px solid var(--red);
  border-radius: 3px;
  font: inherit;
  cursor: pointer;
}

button:hover {
  background: #5b1527;
  box-shadow: 0 0 14px #8d1a34;
}

button:disabled {
  opacity: .5;
  cursor: wait;
}

input, textarea {
  width: 100%;
  padding: 12px;
  margin: 7px 0;
  background: #1a141d;
  color: #eee;
  border: 1px solid #634050;
  border-radius: 3px;
  font: inherit;
}

input:focus, textarea:focus, select:focus {
  outline: 1px solid #a52c46;
  border-color: #a52c46;
}

.hidden {
  display: none !important;
}

#vault {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* GRIMOIRE */

.grimoire {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: min(100%, 650px);
  min-height: 85vh;
  padding: 55px 25px;
  background: linear-gradient(145deg, #24151d, #090709);
  border: 3px solid #63303d;
  box-shadow: 0 0 60px #000, inset 0 0 45px #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.grimoire::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid #58313b;
  pointer-events: none;
}

.sigil-frame {
  position: relative;
  width: min(80%, 350px);
  margin-bottom: 25px;
}

.sigil {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 12px #791529);
  animation: sigil-pulse 5s infinite alternate;
}

.blood-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent, #9d061d);
  mix-blend-mode: multiply;
  opacity: 0;
  animation: blood-fill 6s ease-in forwards;
  pointer-events: none;
}

.blood-drip {
  position: absolute;
  top: -15px;
  width: 9px;
  height: 110px;
  border-radius: 0 0 50% 50%;
  background: linear-gradient(#50000b, #c00b29);
  animation: dripping 5s ease-in-out infinite alternate;
}

.drip-one { left: 23%; }
.drip-two { left: 57%; height: 150px; animation-delay: 1.5s; }
.drip-three { left: 78%; height: 80px; animation-delay: 3s; }

h1 {
  color: #c13a50;
  letter-spacing: 5px;
  font-size: clamp(1.8rem, 5vw, 3rem);
}

h2 {
  color: #b3a6b9;
  letter-spacing: 7px;
  font-weight: normal;
}

h3 {
  color: #c58b9b;
  letter-spacing: 2px;
}

.inscription {
  color: #827782;
  font-style: italic;
  margin: 25px 0;
}

/* LOGIN AND LIBRARY */

.login-panel, .library {
  width: min(100%, 1250px);
  padding: 30px;
  background: linear-gradient(145deg, #211923, #0b080c);
  border: 2px solid #593040;
  box-shadow: 0 0 50px #000;
}

.login-panel {
  max-width: 550px;
  text-align: center;
}

.eyebrow {
  color: #b83c58;
  letter-spacing: 4px;
}

.secondary {
  background: #151018;
  border-color: #55434f;
}

.status {
  color: #c9a6b1;
  min-height: 22px;
  overflow-wrap: anywhere;
}

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  border-bottom: 1px solid #573246;
  padding-bottom: 18px;
}

.main-nav, .board-actions, .project-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.nav-button.active {
  background: #672137;
}

.upload-panel, .recordings-panel {
  margin-top: 25px;
  padding: 25px;
  background: var(--panel-dark);
  border: 1px solid #49303f;
}

.recording {
  padding: 18px 5px;
  border-bottom: 1px solid #49303f;
}

.recording audio {
  width: 100%;
  margin-top: 12px;
}

.recording small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}

/* PROJECT BOARD */

.board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 20px;
}

.project-controls input {
  width: 190px;
}

.project-controls select {
  min-width: 180px;
}

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 15px;
  margin-top: 12px;
}

#board-viewport {
  position: relative;
  height: 650px;
  overflow: hidden;
  border: 1px solid #593040;
  background-color: #0b090e;
  background-image: radial-gradient(#573345 1px, transparent 1px);
  background-size: 25px 25px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

#board-viewport.panning {
  cursor: grabbing;
}

#board-canvas {
  position: absolute;
  width: 4000px;
  height: 3000px;
  transform-origin: 0 0;
}

#board-groups, #board-cards {
  position: absolute;
  inset: 0;
}

/* BOARD CARDS */

.board-card {
  position: absolute;
  width: 245px;
  min-height: 155px;
  padding: 15px;
  background: linear-gradient(145deg, #2a1c29, #17121b);
  border: 1px solid #824057;
  box-shadow: 0 5px 18px #0009;
  cursor: grab;
  overflow-wrap: anywhere;
  touch-action: none;
  user-select: none;
}

.board-card.dragging {
  cursor: grabbing;
  z-index: 1000;
}

.board-card h4 {
  margin: 0 0 12px;
  color: #d17b91;
}

.board-card textarea {
  min-height: 75px;
  resize: vertical;
  user-select: text;
  touch-action: auto;
}

.board-card input {
  font-size: .9rem;
  user-select: text;
  touch-action: auto;
}

.card-controls {
  display: flex;
  justify-content: space-between;
  gap: 5px;
}

.card-controls button {
  padding: 5px 8px;
  font-size: .8rem;
}

/* GROUPS */

.board-group {
  position: absolute;
  width: 650px;
  height: 480px;
  border: 2px dashed #704354;
  background: #4a20300c;
  pointer-events: none;
}

.board-group h3 {
  margin: 12px;
  color: #c78a9e;
  font-size: 16px;
}

/* DISCUSSION */

.discussion {
  min-width: 0;
  padding: 15px;
  border: 1px solid #593040;
  background: var(--panel-dark);
  display: flex;
  flex-direction: column;
}

#message-list {
  height: 400px;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.board-message {
  padding: 10px 0;
  border-bottom: 1px solid #49303f;
}

.board-message small {
  color: #a98a9a;
  display: block;
  margin-top: 5px;
}

.discussion textarea {
  min-height: 75px;
  resize: vertical;
}

/* ANIMATIONS */

@keyframes sigil-pulse {
  from { filter: drop-shadow(0 0 5px #58091a); }
  to { filter: drop-shadow(0 0 22px #a11a38); }
}

@keyframes blood-fill {
  0%, 20% { opacity: 0; }
  100% { opacity: .75; }
}

@keyframes dripping {
  from { transform: scaleY(.2); }
  to { transform: scaleY(1.2); }
}

/* TABLET */

@media (max-width: 850px) {
  .board-layout {
    grid-template-columns: 1fr;
  }

  .discussion {
    min-height: 350px;
  }

  #message-list {
    height: 220px;
  }
}

/* PHONE */

@media (max-width: 600px) {
  #vault {
    padding: 10px;
    align-items: flex-start;
  }

  .grimoire {
    min-height: 85vh;
    padding: 40px 18px;
  }

  .login-panel, .library {
    padding: 15px;
  }

  .library-header {
    align-items: flex-start;
  }

  .main-nav {
    width: 100%;
  }

  .main-nav button {
    flex: 1 1 auto;
  }

  .board-toolbar {
    align-items: stretch;
  }

  .project-controls, .board-actions {
    width: 100%;
  }

  .project-controls input, .project-controls select {
    width: 100%;
  }

  .board-actions button {
    flex: 1 1 40%;
  }

  #board-viewport {
    height: 520px;
  }

  .board-card {
    width: 220px;
  }

  h1 {
    letter-spacing: 2px;
  }
}

/* ACCESSIBILITY */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
