:root {
  --bg-a: #f6f2ff;
  --bg-b: #fff8f2;
  --ink: #2f3a4a;
  --muted: #6f7890;
  --accent: #7ea9d9;
  --accent-ink: #1f2a38;
  --card: rgba(255, 255, 255, 0.9);
  --field: #fcfbff;
  --line: rgba(77, 88, 114, 0.22);
}

:root[data-theme="dark"] {
  --bg-a: #171d2a;
  --bg-b: #1d1622;
  --ink: #e7eefb;
  --muted: #aeb9d1;
  --accent: #4b6689;
  --accent-ink: #eff5ff;
  --card: rgba(29, 37, 52, 0.88);
  --field: #222b3d;
  --line: rgba(189, 205, 238, 0.22);
}

:root[data-theme="rainbow"] {
  --bg-a: #ffe9f5;
  --bg-b: #e9f5ff;
  --ink: #3a2f52;
  --muted: #7a6699;
  --accent: #d29be8;
  --accent-ink: #33244a;
  --card: rgba(255, 255, 255, 0.88);
  --field: #fff9ff;
  --line: rgba(123, 96, 168, 0.25);
}

:root[data-theme="trippy"] {
  --bg-a: #0c061b;
  --bg-b: #150a2c;
  --ink: #f4e9ff;
  --muted: #d8c8ee;
  --accent: #9ef0d5;
  --accent-ink: #16072e;
  --card: rgba(20, 12, 37, 0.7);
  --field: rgba(44, 28, 74, 0.7);
  --line: rgba(219, 180, 255, 0.35);
}

:root[data-theme="eagle"] {
  --bg-a: #1c2d33;
  --bg-b: #0f171b;
  --ink: #f5f8fc;
  --muted: #d2d9e4;
  --accent: #b9d6ff;
  --accent-ink: #0a151f;
  --card: rgba(14, 24, 35, 0.62);
  --field: rgba(25, 38, 51, 0.72);
  --line: rgba(220, 236, 255, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Courier New", "Lucida Console", monospace;
  color: var(--ink);
  background: linear-gradient(135deg, var(--bg-a), var(--bg-b));
  min-height: 100vh;
  position: relative;
}

#eagle-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
  overflow: hidden;
}

#eagle-bg iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 177.78vh;
  height: 100vh;
  min-width: 100vw;
  min-height: 56.25vw;
  transform: translate(-50%, -50%);
  border: 0;
}

:root[data-theme="eagle"] #eagle-bg {
  opacity: 0.92;
}

#trippy-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

:root[data-theme="trippy"] #trippy-canvas {
  opacity: 0.95;
}

.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1rem;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 8px 20px rgba(70, 78, 105, 0.14);
  backdrop-filter: blur(4px);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0.02em;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.subtitle {
  margin-top: 0.35rem;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-top: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.95rem;
}

input,
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  font: inherit;
}

input {
  background: var(--field);
  color: var(--ink);
}

button {
  grid-column: span 2;
  border: 1px solid rgba(83, 108, 138, 0.35);
  background: linear-gradient(150deg, #cfe6ff, #b8d5f5);
  color: var(--accent-ink);
  font-weight: 700;
  cursor: pointer;
}

.theme-toggle {
  grid-column: auto;
  width: auto;
  min-width: 74px;
  padding: 0.45rem 0.65rem;
  background: linear-gradient(150deg, #ece8ff, #dcecff);
  color: var(--ink);
  border: 1px solid var(--line);
}

:root[data-theme="dark"] button {
  background: linear-gradient(150deg, #4a6388, #3d5574);
}

:root[data-theme="dark"] .theme-toggle {
  background: linear-gradient(150deg, #2a3448, #324058);
  color: #f2f6ff;
}

.hidden {
  display: none;
}

.details {
  margin-top: 1.25rem;
}

.hint {
  color: var(--muted);
}

.paintings-grid {
  display: grid;
  gap: 0.9rem;
  margin: 0.8rem 0;
}

.painting-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(3, 1fr);
  background: linear-gradient(140deg, #fff9f4, #f8fbff);
}

:root[data-theme="dark"] .painting-row {
  background: linear-gradient(140deg, #25314a, #2b253f);
}

.results {
  margin-top: 1.2rem;
  padding: 0.9rem;
  border-radius: 10px;
  background: linear-gradient(140deg, #eef6ff, #fff8e9);
  border: 1px solid rgba(126, 169, 217, 0.45);
}

:root[data-theme="dark"] .results {
  background: linear-gradient(140deg, #26364f, #332a3e);
  border-color: rgba(166, 190, 231, 0.35);
}

a {
  color: var(--ink);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.7rem;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid rgba(77, 88, 114, 0.16);
}

.error {
  color: #91424f;
  font-weight: 600;
}

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

  button {
    grid-column: auto;
  }

  .painting-row {
    grid-template-columns: 1fr;
  }
}

:root[data-theme="rainbow"] body {
  background: linear-gradient(135deg, #ffe9f5, #fff9d9, #e7fff2, #e6f1ff, #f2e9ff);
}

:root[data-theme="rainbow"] .painting-row {
  background: linear-gradient(140deg, #fff2fa, #f4f8ff, #f9fff0);
}

:root[data-theme="rainbow"] .results {
  background: linear-gradient(140deg, #f6ecff, #e9f6ff, #fff5dc);
  border-color: rgba(210, 155, 232, 0.5);
}

:root[data-theme="rainbow"] button {
  background: linear-gradient(150deg, #f8d6ff, #cfe4ff, #d7f8e5);
  color: #3a2f52;
}

:root[data-theme="rainbow"] .theme-toggle {
  background: linear-gradient(150deg, #f8d6ff, #ffe6c8);
}

:root[data-theme="trippy"] body {
  background: radial-gradient(circle at 20% 0%, #25113f 0%, #130724 60%, #0a0414 100%);
}

:root[data-theme="trippy"] button {
  background: linear-gradient(150deg, #8ff9db, #f4acff, #99d4ff);
  color: #19092e;
}

:root[data-theme="trippy"] .theme-toggle {
  background: linear-gradient(150deg, #f7adff, #9ef7dd);
  color: #19092e;
}

:root[data-theme="trippy"] .painting-row {
  background: linear-gradient(140deg, rgba(114, 72, 175, 0.35), rgba(58, 135, 186, 0.3));
}

:root[data-theme="trippy"] .results {
  background: linear-gradient(140deg, rgba(99, 58, 181, 0.35), rgba(40, 110, 179, 0.3));
  border-color: rgba(206, 169, 255, 0.5);
}

:root[data-theme="eagle"] body {
  background: radial-gradient(circle at 20% 0%, #2a3a40 0%, #182329 58%, #10171c 100%);
}

:root[data-theme="eagle"] button {
  background: linear-gradient(150deg, #d6e4ff, #cee9f4);
  color: #0d1a26;
}

:root[data-theme="eagle"] .theme-toggle {
  background: linear-gradient(150deg, #f0f7ff, #d6e3f4);
  color: #0d1a26;
}

:root[data-theme="eagle"] .painting-row {
  background: linear-gradient(140deg, rgba(74, 95, 117, 0.5), rgba(41, 63, 81, 0.42));
}

:root[data-theme="eagle"] .results {
  background: linear-gradient(140deg, rgba(88, 112, 138, 0.5), rgba(46, 71, 95, 0.42));
  border-color: rgba(206, 225, 255, 0.5);
}
