:root {
  --df1: #2a0808;
  --df2: #4a0a0a;
  --df3: #6a0000;
  --df4: #8a0000;
  --df5: #aa1010;
  --df6: #cc2020;
  --df7: #ee3030;
  --df8: #ff4040;
  --df9: #ff6060;
  --d-bg: #0a0a0a;
  --d-tx: #808080;
  --d-tx2: #b0b0b0;
}

.home-duat-gate {
  position: relative;
  margin: 0 0 32px;
  padding: 48px 24px 40px;
  background: linear-gradient(180deg, #1a0505 0%, var(--d-bg) 100%);
  overflow: visible;
}

.duat-frame {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 12px 1fr 12px;
  grid-template-rows: 12px 1fr 12px;
  pointer-events: none;
}

.duat-frame-top, .duat-frame-bottom, .duat-frame-left, .duat-frame-right {
  display: grid;
  gap: 0;
}

.duat-frame-top {
  grid-column: 1 / 4;
  grid-row: 1;
  grid-template-columns: repeat(auto-fill, 3px);
}

.duat-frame-bottom {
  grid-column: 1 / 4;
  grid-row: 3;
  grid-template-columns: repeat(auto-fill, 3px);
}

.duat-frame-left {
  grid-column: 1;
  grid-row: 2;
  grid-template-rows: repeat(auto-fill, 3px);
}

.duat-frame-right {
  grid-column: 3;
  grid-row: 2;
  grid-template-rows: repeat(auto-fill, 3px);
}

.df-pixel {
  width: 3px;
  height: 3px;
  position: relative;
  background: transparent;
}

.df-pixel::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--df4);
  animation: pixel-flame 1.8s ease-out infinite;
  animation-delay: var(--delay, 0s);
}

.duat-frame-inner {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  bottom: 16px;
  border: 2px solid var(--df3);
}

.duat-frame-inner::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 1px solid var(--df4);
  box-shadow: inset 0 0 20px rgba(100, 0, 0, 0.3);
}

.duat-flames-container {
  position: absolute;
  inset: -20px;
  pointer-events: none;
}

.df-col {
  position: absolute;
  display: flex;
  flex-direction: column;
}

.df-col-left {
  left: -18px;
  top: 20px;
  bottom: 20px;
  width: 18px;
}

.df-col-right {
  right: -18px;
  top: 20px;
  bottom: 20px;
  width: 18px;
}

.df-row {
  position: absolute;
  display: flex;
}

.df-row-top {
  top: -18px;
  left: 20px;
  right: 20px;
  height: 18px;
}

.df-row-bottom {
  bottom: -18px;
  left: 20px;
  right: 20px;
  height: 18px;
}

.df-flame {
  width: 4px;
  height: 4px;
  position: relative;
}

.df-flame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--df4);
  border-radius: 1px 1px 0 0;
  animation: flame-rise 1.2s ease-out infinite;
}

.df-flame:nth-child(1)::before { height: 100%; background: var(--df4); animation-delay: 0s; }
.df-flame:nth-child(2)::before { height: 90%; background: var(--df5); animation-delay: 0.1s; }
.df-flame:nth-child(3)::before { height: 80%; background: var(--df6); animation-delay: 0.2s; }
.df-flame:nth-child(4)::before { height: 70%; background: var(--df7); animation-delay: 0.3s; }
.df-flame:nth-child(5)::before { height: 60%; background: var(--df8); animation-delay: 0.4s; }
.df-flame:nth-child(6)::before { height: 50%; background: var(--df9); animation-delay: 0.5s; }
.df-flame:nth-child(7)::before { height: 40%; background: var(--df7); animation-delay: 0.6s; }
.df-flame:nth-child(8)::before { height: 30%; background: var(--df6); animation-delay: 0.7s; }
.df-flame:nth-child(n+9)::before { height: 20%; background: var(--df5); animation-delay: 0.8s; }

.df-col-left .df-flame {
  writing-mode: vertical-rl;
  flex-direction: column;
}

.df-col-left .df-flame::before {
  border-radius: 1px 0 0 1px;
  animation-name: flame-rise-left;
}

.df-col-right .df-flame {
  writing-mode: vertical-lr;
}

.df-col-right .df-flame::before {
  border-radius: 0 1px 1px 0;
  animation-name: flame-rise-right;
}

.df-row-top {
  flex-direction: row;
}

.df-row-top .df-flame::before {
  border-radius: 1px 1px 0 0;
}

.df-row-bottom {
  flex-direction: row;
}

.df-row-bottom .df-flame::before {
  border-radius: 0 0 1px 1px;
}

.df-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  display: grid;
  grid-template-columns: repeat(4, 4px);
  grid-template-rows: repeat(4, 4px);
  gap: 1px;
}

.df-corner-tl {
  top: -16px;
  left: -16px;
}

.df-corner-tr {
  top: -16px;
  right: -16px;
}

.df-corner-bl {
  bottom: -16px;
  left: -16px;
}

.df-corner-br {
  bottom: -16px;
  right: -16px;
}

.df-c-flame {
  width: 4px;
  height: 4px;
  position: relative;
}

.df-c-flame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--df4);
  border-radius: 0;
  animation: corner-flame 0.8s ease-out infinite;
}

.df-corner-tl .df-c-flame:nth-child(1) { grid-column: 4; grid-row: 1; }
.df-corner-tl .df-c-flame:nth-child(2) { grid-column: 3; grid-row: 1; }
.df-corner-tl .df-c-flame:nth-child(3) { grid-column: 4; grid-row: 2; }
.df-corner-tl .df-c-flame:nth-child(4) { grid-column: 2; grid-row: 2; }
.df-corner-tl .df-c-flame:nth-child(5) { grid-column: 4; grid-row: 3; }
.df-corner-tl .df-c-flame:nth-child(6) { grid-column: 3; grid-row: 3; }
.df-corner-tl .df-c-flame:nth-child(7) { grid-column: 4; grid-row: 4; }
.df-corner-tl .df-c-flame:nth-child(8) { grid-column: 3; grid-row: 4; }
.df-corner-tl .df-c-flame:nth-child(9) { grid-column: 2; grid-row: 4; }

.df-corner-tl .df-c-flame:nth-child(1)::before { background: var(--df5); animation-delay: 0s; }
.df-corner-tl .df-c-flame:nth-child(2)::before { background: var(--df4); animation-delay: 0.1s; }
.df-corner-tl .df-c-flame:nth-child(3)::before { background: var(--df6); animation-delay: 0.05s; }
.df-corner-tl .df-c-flame:nth-child(4)::before { background: var(--df3); animation-delay: 0.15s; }
.df-corner-tl .df-c-flame:nth-child(5)::before { background: var(--df7); animation-delay: 0.1s; }
.df-corner-tl .df-c-flame:nth-child(6)::before { background: var(--df5); animation-delay: 0.2s; }
.df-corner-tl .df-c-flame:nth-child(7)::before { background: var(--df8); animation-delay: 0.15s; }
.df-corner-tl .df-c-flame:nth-child(8)::before { background: var(--df6); animation-delay: 0.25s; }
.df-corner-tl .df-c-flame:nth-child(9)::before { background: var(--df4); animation-delay: 0.3s; }

.df-corner-tr .df-c-flame { transform: scaleX(-1); }

.df-corner-bl .df-c-flame { transform: scaleY(-1); }

.df-corner-br .df-c-flame { transform: scale(-1); }

.glow-line {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--df5), var(--df6), var(--df5), transparent);
  opacity: 0.4;
}

.glow-line-bottom {
  top: auto;
  bottom: 24px;
}

.duat-gate-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.duat-gate-label {
  display: inline-block;
  margin-bottom: 6px;
  padding: 3px 8px;
  background: var(--df2);
  border: 1px solid var(--df4);
  color: var(--df6);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 8px;
  font-family: monospace;
}

.duat-gate-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--d-tx2);
  text-shadow: 
    0 0 8px var(--df6),
    0 0 16px var(--df5);
  animation: duat-title-glow 1.8s ease-in-out infinite;
}

.duat-gate-verse {
  margin: 0;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--df3);
  border-left: 3px solid var(--df5);
  color: var(--d-tx);
  font-size: 12px;
  line-height: 1.6;
}

.duat-gate-verse p {
  margin: 0;
}

.duat-gate-verse p::first-letter {
  color: var(--df6);
  font-size: 1.4em;
}

.duat-gate-verse footer {
  display: block;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--df3);
  color: var(--df5);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 7px;
}

.duat-gate-warning {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 6px;
  background: var(--df3);
  border: 1px solid var(--df7);
  color: var(--d-tx2);
  font-size: 6px;
  font-family: monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: duat-warning-blink 0.5s steps(2) infinite;
}

@keyframes flame-rise {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateY(-2px);
    opacity: 0.7;
  }
  100% {
    transform: translateY(-4px);
    opacity: 0;
  }
}

@keyframes flame-rise-left {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  50% {
    transform: translateX(-2px);
    opacity: 0.7;
  }
  100% {
    transform: translateX(-4px);
    opacity: 0;
  }
}

@keyframes flame-rise-right {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  50% {
    transform: translateX(2px);
    opacity: 0.7;
  }
  100% {
    transform: translateX(4px);
    opacity: 0;
  }
}

@keyframes corner-flame {
  0%, 70% {
    opacity: 1;
    transform: scale(1);
  }
  35% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

@keyframes duat-title-glow {
  0%, 100% { 
    text-shadow: 
      0 0 8px var(--df6),
      0 0 16px var(--df5);
  }
  50% { 
    text-shadow: 
      0 0 12px var(--df7),
      0 0 24px var(--df6),
      0 0 32px var(--df5);
  }
}

@keyframes duat-warning-blink {
  0%, 60%, 100% { opacity: 1; }
  30% { opacity: 0.4; }
}

@keyframes pixel-flame {
  0% {
    height: 20%;
    opacity: 0;
    background: var(--df4);
  }
  20% {
    height: 40%;
    opacity: 0.2;
    background: var(--df5);
  }
  40% {
    height: 60%;
    opacity: 0.4;
    background: var(--df6);
  }
  60% {
    height: 80%;
    opacity: 0.6;
    background: var(--df7);
  }
  80% {
    height: 100%;
    opacity: 0.8;
    background: var(--df8);
  }
  100% {
    height: 20%;
    opacity: 0;
    background: var(--df9);
  }
}

@media (max-width: 767px) {
  .home-duat-gate {
    margin: 0 0 20px;
    padding: 40px 16px 32px;
  }

  .duat-frame {
    grid-template-columns: 8px 1fr 8px;
    grid-template-rows: 8px 1fr 8px;
  }

  .df-pixel { width: 2px; height: 2px; }

  .duat-flames-container { display: none; }

  .duat-gate-title {
    font-size: 12px;
  }

  .duat-gate-verse {
    padding: 6px 10px;
    font-size: 11px;
  }
}