@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;900&family=Cormorant+Garamond:wght@400;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg-night: #f3f8ff;
  --bg-deep: #eef8ff;
  --bg-ink: #fdf7ff;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-2: rgba(245, 253, 255, 0.86);
  --text-main: #2b1f2b;
  --text-dim: #5a4861;
  --line: rgba(143, 124, 206, 0.36);
  --line-soft: rgba(83, 181, 214, 0.28);
  --gold-1: #d5a44a;
  --gold-2: #f2d088;
  --red-1: #9d2e28;
  --red-2: #d2552f;
  --aqua: #6fdee0;
  --violet: #8f6bff;
  --magenta: #ff6fae;
  --lime: #b4ff7a;
  --cyan: #4efcff;
  --orange: #ff9b42;
  --rose: #ff4f8b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  background:
    radial-gradient(900px 500px at 15% -10%, #f7bbff 0%, rgba(247, 187, 255, 0) 65%),
    radial-gradient(1000px 640px at 110% -20%, #b7f8ff 0%, rgba(183, 248, 255, 0) 60%),
    linear-gradient(115deg, #f8fbff, #fff3ff, #eef7ff, #f6ffef, #fff7ea, #ffeef7);
  background-size: 100% 100%, 100% 100%, 440% 440%;
  font-family: 'Cormorant Garamond', Georgia, serif;
  padding: 2.4rem 1.1rem;
  animation: bg-shift 18s ease-in-out infinite alternate;
}

.sky-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(8px 8px at 22% 28%, rgba(242, 208, 136, 0.55) 0, rgba(242, 208, 136, 0) 100%),
    radial-gradient(7px 7px at 78% 40%, rgba(111, 222, 224, 0.35) 0, rgba(111, 222, 224, 0) 100%),
    radial-gradient(6px 6px at 66% 72%, rgba(255, 255, 255, 0.3) 0, rgba(255, 255, 255, 0) 100%),
    radial-gradient(12px 12px at 42% 64%, rgba(255, 111, 174, 0.24) 0, rgba(255, 111, 174, 0) 100%),
    radial-gradient(10px 10px at 56% 24%, rgba(180, 255, 122, 0.2) 0, rgba(180, 255, 122, 0) 100%);
  animation: shimmer 8s ease-in-out infinite alternate, drift 14s linear infinite;
}

body::before,
body::after {
  content: '';
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(2px);
  z-index: 0;
}

body::before {
  width: 42vmax;
  height: 42vmax;
  top: -14vmax;
  left: -12vmax;
  background: radial-gradient(circle, rgba(255, 131, 186, 0.3) 0%, rgba(255, 131, 186, 0) 70%);
  animation: orb-float-a 20s ease-in-out infinite alternate;
}

body::after {
  width: 36vmax;
  height: 36vmax;
  bottom: -14vmax;
  right: -8vmax;
  background: radial-gradient(circle, rgba(114, 238, 255, 0.3) 0%, rgba(114, 238, 255, 0) 70%);
  animation: orb-float-b 22s ease-in-out infinite alternate;
}

.container {
  width: min(1080px, 100%);
  margin: 0 auto;
  position: relative;
  z-index: 1;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--panel) 0%, var(--panel-2) 100%);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow:
    0 12px 30px rgba(3, 8, 14, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  animation: float-panel 8s ease-in-out infinite;
  overflow: hidden;
}

.container::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  background: conic-gradient(
    from 0deg,
    rgba(255, 79, 139, 0.5),
    rgba(255, 155, 66, 0.5),
    rgba(180, 255, 122, 0.5),
    rgba(78, 252, 255, 0.5),
    rgba(143, 107, 255, 0.5),
    rgba(255, 79, 139, 0.5)
  );
  z-index: -1;
  animation: spin-ring 14s linear infinite;
}

.hero {
  padding: 1rem 1rem 1.2rem;
  margin-bottom: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(140deg, rgba(255, 248, 255, 0.84) 0%, rgba(240, 252, 255, 0.88) 100%),
    repeating-linear-gradient(45deg, rgba(181, 133, 255, 0.08) 0 8px, rgba(0, 0, 0, 0) 8px 16px);
  animation: rise-in 500ms ease-out, glow-cycle 9s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0) 80%);
  transform: translateX(-120%);
  animation: sheen 5s ease-in-out infinite;
}

.kicker {
  margin: 0;
  font-family: 'JetBrains Mono', Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.12rem;
  color: #2b82b8;
  font-size: 0.78rem;
}

h1 {
  margin: 0.25rem 0 0.35rem;
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(1.7rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.03rem;
  color: var(--gold-2);
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  animation: title-flicker 7s ease-in-out infinite;
  background: linear-gradient(90deg, #ffd57e, #ff7ec6, #7ef2ff, #cbff92, #ffd57e);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: title-flicker 7s ease-in-out infinite, text-shift 6s linear infinite;
}

.subtitle {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text-dim);
}

.panel {
  padding: 1rem;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.78), rgba(242, 252, 255, 0.8));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, rgba(255, 79, 139, 0.07), rgba(78, 252, 255, 0.08), rgba(180, 255, 122, 0.06));
  background-size: 220% 220%;
  animation: panel-wash 9s ease-in-out infinite;
  pointer-events: none;
}

.input-panel {
  animation: rise-in 600ms ease-out;
}

label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--gold-2);
}

textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
  color: #2b2233;
  background:
    linear-gradient(180deg, rgba(255, 253, 255, 0.96) 0%, rgba(243, 251, 255, 0.96) 100%);
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.94rem;
  line-height: 1.55;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  animation: breathe 5s ease-in-out infinite;
}

textarea:focus {
  outline: 0;
  border-color: var(--aqua);
  box-shadow: 0 0 0 3px rgba(111, 222, 224, 0.18);
}

button {
  margin-top: 1rem;
  border: 0;
  border-radius: 999px;
  padding: 0.68rem 1.4rem;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.03rem;
  color: #1b1105;
  background: linear-gradient(120deg, #ffd26a, #ff8f57, #ff5ea8, #7e74ff, #6ef4ff);
  background-size: 280% 280%;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.35),
    inset 0 -2px 0 rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 120ms ease, filter 160ms ease;
  animation: pulse-gold 2.6s ease-in-out infinite, btn-rainbow 3.6s linear infinite;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.result-panel {
  margin-top: 1rem;
  animation: rise-in 700ms ease-out, glow-cycle 11s ease-in-out infinite;
}

h2 {
  margin: 0;
  font-family: 'Cinzel', Georgia, serif;
  color: var(--gold-2);
}

h3 {
  margin: 0 0 0.55rem;
  font-family: 'Cinzel', Georgia, serif;
  color: var(--text-main);
  font-size: 1.08rem;
}

#summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.45rem 0.75rem;
  margin: 0.85rem 0 1rem;
}

#summary p {
  margin: 0;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(143, 194, 220, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

#summary strong {
  color: var(--gold-2);
}

#summary a {
  color: var(--aqua);
}

.table-panel {
  margin-top: 0.9rem;
  padding: 0.8rem;
  border: 1px solid rgba(143, 194, 220, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 220ms ease;
}

.table-panel:hover {
  transform: translateY(-2px);
  border-color: rgba(111, 222, 224, 0.38);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
}

thead tr {
  background: linear-gradient(100deg, rgba(157, 46, 40, 0.9), rgba(210, 85, 47, 0.9), rgba(255, 79, 139, 0.86), rgba(111, 222, 224, 0.86), rgba(143, 107, 255, 0.88));
  background-size: 320% 320%;
  animation: table-head-shift 6s ease-in-out infinite;
}

th,
td {
  border: 1px solid rgba(217, 189, 133, 0.2);
  padding: 0.48rem 0.5rem;
  text-align: left;
}

th {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
}

tbody tr:nth-child(odd) {
  background: linear-gradient(90deg, rgba(255, 250, 255, 0.9), rgba(244, 250, 255, 0.9));
  animation: row-in 420ms ease both;
}

tbody tr:nth-child(even) {
  background: linear-gradient(90deg, rgba(248, 255, 253, 0.9), rgba(244, 247, 255, 0.9));
  animation: row-in 480ms ease both;
}

tbody tr:hover {
  background: linear-gradient(90deg, rgba(255, 228, 244, 0.94), rgba(225, 247, 255, 0.94));
  transform: translateX(2px);
}

.error {
  margin-top: 0.95rem;
  color: #8a2034;
  font-weight: 700;
  background: rgba(255, 229, 234, 0.82);
  border: 1px solid rgba(255, 157, 181, 0.7);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.hidden {
  display: none;
}

@keyframes shimmer {
  0% {
    opacity: 0.55;
    transform: translateY(0);
  }
  100% {
    opacity: 0.95;
    transform: translateY(-4px);
  }
}

@keyframes drift {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(10px);
  }
}

@keyframes bg-shift {
  0% {
    background-position: 0 0, 0 0, 0% 50%;
  }
  100% {
    background-position: 0 0, 0 0, 100% 50%;
  }
}

@keyframes orb-float-a {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(10vmax, 8vmax) scale(1.15); }
}

@keyframes orb-float-b {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-10vmax, -8vmax) scale(1.12); }
}

@keyframes spin-ring {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes float-panel {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes glow-cycle {
  0% {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 0 0 rgba(0, 0, 0, 0);
  }
  50% {
    box-shadow: inset 0 0 0 1px rgba(111, 222, 224, 0.2), 0 0 26px rgba(111, 222, 224, 0.14);
  }
  100% {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 0 0 rgba(0, 0, 0, 0);
  }
}

@keyframes sheen {
  0% { transform: translateX(-120%); }
  40%, 100% { transform: translateX(120%); }
}

@keyframes pulse-gold {
  0% {
    box-shadow:
      0 8px 22px rgba(0, 0, 0, 0.35),
      inset 0 -2px 0 rgba(0, 0, 0, 0.25),
      0 0 0 rgba(213, 164, 74, 0);
  }
  50% {
    box-shadow:
      0 8px 22px rgba(0, 0, 0, 0.35),
      inset 0 -2px 0 rgba(0, 0, 0, 0.25),
      0 0 26px rgba(213, 164, 74, 0.35);
  }
  100% {
    box-shadow:
      0 8px 22px rgba(0, 0, 0, 0.35),
      inset 0 -2px 0 rgba(0, 0, 0, 0.25),
      0 0 0 rgba(213, 164, 74, 0);
  }
}

@keyframes btn-rainbow {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

@keyframes title-flicker {
  0%, 90%, 100% {
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  }
  92% {
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), 0 0 16px rgba(242, 208, 136, 0.45);
  }
}

@keyframes text-shift {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

@keyframes breathe {
  0%, 100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.12);
  }
}

@keyframes panel-wash {
  0% { background-position: 0% 30%; }
  50% { background-position: 100% 70%; }
  100% { background-position: 0% 30%; }
}

@keyframes table-head-shift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@keyframes row-in {
  0% {
    opacity: 0;
    transform: translateX(-8px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes rise-in {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  body {
    padding: 1rem 0.65rem;
  }

  .container {
    padding: 0.85rem;
  }

  .panel {
    padding: 0.8rem;
  }

  textarea {
    min-height: 180px;
  }

  th,
  td {
    padding: 0.42rem 0.4rem;
    font-size: 0.92rem;
  }

  #summary {
    grid-template-columns: 1fr;
  }
}
