@import url('https://fonts.googleapis.com/css2?family=Amaranth:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  color-scheme: light;
  --cycler-gradient-start: rgba(40, 186, 222, 0.85);
  --cycler-gradient-mid-a: #5ec7e6;
  --cycler-gradient-mid-b: #c989b8;
  --cycler-gradient-end: rgba(180, 100, 160, 0.7);
  --cycler-grid-bg-color: #28bade;
  --medium-paper-texture: url('../_images/blue_m.png');
  --panel-bg-image: var(--medium-paper-texture);
  --cycler-button-bg: #5ccbf3;
  --cycler-button-bg-hover: #4aaecf;
  --cycler-button-text: #000000;
  --cycler-button-glow: rgba(180, 100, 160, 0.6);
  --cycler-border: #555;
  --cycler-shadow: rgba(0, 0, 0, 0.4);
  --cycler-hover: #c72a93;
  --accent-text: #7a145a;
  --cycler-glass-bg: rgba(255, 255, 255, 0.25);
  --cycler-glass-border: rgba(255, 255, 255, 0.33);
  --cycler-header-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
  --panel-text: #171717;
  --panel-muted: #21333b;
  --strong-text: #111111;
  --heading-text: #222222;
  --heading-copy: rgba(20, 20, 20, 0.78);
  --panel-soft: rgba(255, 255, 255, 0.35);
  --panel-softer: rgba(255, 255, 255, 0.2);
  --field-bg: rgba(255, 255, 255, 0.58);
  --field-text: #111111;
  --code-text: #062f47;
  --table-head-bg: rgba(255, 255, 255, 0.55);
  --success-text: #0b4a3a;
  --table-line: rgba(30, 54, 65, 0.28);
  --danger: #a51535;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --cycler-gradient-start: rgba(6, 64, 83, 0.96);
  --cycler-gradient-mid-a: #124f63;
  --cycler-gradient-mid-b: #543452;
  --cycler-gradient-end: rgba(58, 24, 61, 0.92);
  --cycler-grid-bg-color: #0f6178;
  --panel-bg-image: linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.42)), var(--medium-paper-texture);
  --cycler-button-bg: #2b8ead;
  --cycler-button-bg-hover: #24758f;
  --cycler-button-text: #f4fbff;
  --cycler-button-glow: rgba(199, 42, 147, 0.35);
  --cycler-border: #173846;
  --cycler-glass-bg: rgba(4, 26, 35, 0.55);
  --cycler-glass-border: rgba(182, 226, 238, 0.22);
  --panel-text: #eef9fb;
  --panel-muted: #c6dce3;
  --strong-text: #ffffff;
  --heading-text: #f4fbff;
  --heading-copy: rgba(230, 246, 250, 0.82);
  --panel-soft: rgba(2, 18, 25, 0.66);
  --panel-softer: rgba(0, 0, 0, 0.22);
  --field-bg: rgba(2, 17, 24, 0.82);
  --field-text: #f4fbff;
  --code-text: #d7fbff;
  --table-head-bg: rgba(2, 17, 24, 0.88);
  --success-text: #bdf3e1;
  --accent-text: #ff9add;
  --table-line: rgba(198, 220, 227, 0.22);
  --danger: #ffb4c2;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --cycler-gradient-start: rgba(6, 64, 83, 0.96);
    --cycler-gradient-mid-a: #124f63;
    --cycler-gradient-mid-b: #543452;
    --cycler-gradient-end: rgba(58, 24, 61, 0.92);
    --cycler-grid-bg-color: #0f6178;
    --panel-bg-image: linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.42)), var(--medium-paper-texture);
    --cycler-button-bg: #2b8ead;
    --cycler-button-bg-hover: #24758f;
    --cycler-button-text: #f4fbff;
    --cycler-button-glow: rgba(199, 42, 147, 0.35);
    --cycler-border: #173846;
    --cycler-glass-bg: rgba(4, 26, 35, 0.55);
    --cycler-glass-border: rgba(182, 226, 238, 0.22);
    --panel-text: #eef9fb;
    --panel-muted: #c6dce3;
    --strong-text: #ffffff;
    --heading-text: #f4fbff;
    --heading-copy: rgba(230, 246, 250, 0.82);
    --panel-soft: rgba(2, 18, 25, 0.66);
    --panel-softer: rgba(0, 0, 0, 0.22);
    --field-bg: rgba(2, 17, 24, 0.82);
    --field-text: #f4fbff;
    --code-text: #d7fbff;
    --table-head-bg: rgba(2, 17, 24, 0.88);
    --success-text: #bdf3e1;
    --accent-text: #ff9add;
    --table-line: rgba(198, 220, 227, 0.22);
    --danger: #ffb4c2;
  }
}

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

body {
  min-height: 100vh;
  background: linear-gradient(
    -45deg,
    var(--cycler-gradient-start),
    var(--cycler-gradient-mid-a),
    var(--cycler-gradient-mid-b),
    var(--cycler-gradient-end)
  );
  background-size: 400% 400%;
  background-attachment: fixed;
  background-color: #313131;
  animation: cycler-gradient 18s ease infinite;
  color: var(--panel-text);
  font-family: 'Amaranth', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: clamp(18px, 0.4vw + 16px, 20px);
  line-height: 1.6;
  padding: 0 0 32px;
}

@keyframes cycler-gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

main {
  width: 95%;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1em;
}

header {
  width: 100%;
  margin: 0.2em auto 0;
  padding: 0.5em 0.7em 0.65em;
  text-align: center;
  background: var(--cycler-glass-bg);
  border: 1px solid var(--cycler-glass-border);
  border-radius: 20px;
  box-shadow: var(--cycler-header-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

h1 {
  color: var(--heading-text);
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-variant: small-caps;
  font-weight: 700;
  line-height: 1.12;
}

.subhead {
  max-width: 75ch;
  margin: 0.35em auto 0;
  color: var(--heading-copy);
  font-size: clamp(1rem, 1vw + 0.75rem, 1.25rem);
  line-height: 1.35;
}

.options,
.drop-zone,
.status,
.export-panel,
.metric,
.panel {
  background-color: var(--cycler-grid-bg-color);
  background-image: var(--panel-bg-image);
  border: 1px solid var(--cycler-border);
  border-radius: 20px;
  box-shadow: 1px 1px 4px 0 var(--cycler-shadow);
}

.options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75em 1em;
  padding: 0.8em 0.9em;
}

.theme-mode {
  display: flex;
  align-items: center;
  gap: 0.4em;
  color: var(--panel-muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
}

.theme-mode select {
  width: auto;
  color: var(--field-text);
  background: var(--field-bg);
  border: 1px solid var(--cycler-border);
  border-radius: 6px;
  font: inherit;
  padding: 0.45em 0.55em;
  outline: none;
}

.theme-mode select:focus,
.export-panel textarea:focus {
  border-color: var(--cycler-hover);
  box-shadow: 0 0 0 3px rgba(199, 42, 147, 0.22);
}

.drop-zone {
  position: relative;
  display: grid;
  min-height: 240px;
  place-items: center;
  overflow: hidden;
  padding: 2.2em 1.4em;
  text-align: center;
  cursor: pointer;
  transition: box-shadow 0.15s ease-out, transform 0.15s ease-out, border-color 0.15s ease-out;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.16);
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.drop-zone:hover,
.drop-zone.dragging {
  transform: translateY(2px);
  border-color: var(--cycler-hover);
  box-shadow:
    inset 2px 2px 6px rgba(0, 0, 0, 0.2),
    inset -1px -1px 4px rgba(255, 255, 255, 0.1),
    0 0 15px var(--cycler-button-glow);
}

.drop-zone:hover::before,
.drop-zone.dragging::before {
  opacity: 1;
}

.drop-zone > div {
  position: relative;
  z-index: 1;
}

.drop-icon {
  display: block;
  margin-bottom: 0.35em;
  font-size: 2.6rem;
}

.drop-zone h2 {
  margin-bottom: 0.15em;
  color: var(--strong-text);
  font-size: clamp(1.3rem, 2vw + 0.7rem, 2rem);
}

.drop-zone p,
.export-panel p {
  color: var(--panel-muted);
  font-size: 1rem;
  line-height: 1.35;
}

.file-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  margin-top: 0.85em;
}

button,
.file-label,
.export-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.35em 0.8em;
  color: var(--cycler-button-text);
  background-color: var(--cycler-button-bg);
  background-image: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(0, 0, 0, 0.05) 51%,
    rgba(0, 0, 0, 0.1) 100%
  );
  border: 1px solid var(--cycler-border);
  border-radius: 6px;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.6),
    inset -1px -1px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.2),
    0 0 12px var(--cycler-button-glow);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3);
  transition: background-color 0.15s ease-out, box-shadow 0.15s ease-out, transform 0.15s ease-out;
  user-select: none;
}

button:hover,
.file-label:hover,
.export-panel a:hover {
  background-color: var(--cycler-button-bg-hover);
  background-image: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.1) 100%
  );
  transform: translateY(2px);
  box-shadow:
    inset 2px 2px 6px rgba(0, 0, 0, 0.2),
    inset -1px -1px 4px rgba(255, 255, 255, 0.1),
    0 0 15px var(--cycler-button-glow);
}

button:focus-visible,
.file-label:focus-visible,
.export-panel a:focus-visible {
  outline: 3px solid var(--cycler-hover);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.status {
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 0.75em 0.9em;
  color: var(--success-text);
  font-weight: 700;
}

.status.error {
  color: var(--danger);
  border-color: var(--danger);
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6em;
}

.metric {
  min-width: 0;
  padding: 0.65em;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.metric:hover {
  border-color: var(--cycler-hover);
  box-shadow: 0 0 15px var(--cycler-button-glow);
}

.metric span,
.panel h2 {
  display: block;
  color: var(--panel-muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.metric span {
  margin-bottom: 0.25em;
}

.metric strong {
  display: block;
  overflow: hidden;
  color: var(--strong-text);
  font-size: clamp(1rem, 1vw + 0.75rem, 1.35rem);
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-panel {
  padding: 0.8em;
}

.export-panel p {
  margin-bottom: 0.65em;
}

.preview-label {
  display: block;
  margin-top: 0.65em;
  color: var(--panel-muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
}

.export-panel textarea {
  width: 100%;
  min-height: 160px;
  margin-top: 0.65em;
  padding: 0.9em;
  color: var(--field-text);
  background: var(--field-bg);
  border: 1px solid var(--cycler-border);
  border-radius: 10px;
  font: 0.82rem/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
  outline: none;
}

.content-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em;
  align-items: start;
}
.content-grid > :first-child {
  flex: 1 0 280px;
}
.content-grid > :last-child {
  flex: 999 1 480px;
}

.panel {
  overflow: hidden;
}

.panel h2 {
  margin: 0;
  padding: 0.7em 0.85em;
  border-bottom: 1px solid var(--cycler-border);
  background: var(--panel-softer);
}

.message-list,
.table-wrap {
  max-height: 440px;
  overflow: auto;
}

.message-type {
  display: flex;
  justify-content: space-between;
  gap: 0.6em;
  padding: 0.55em 0.85em;
  border-bottom: 1px solid var(--table-line);
  font-size: 1rem;
}

.message-type code,
td code {
  color: var(--code-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

table {
  width: 100%;
  border-collapse: collapse;
  font: 0.82rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

th,
td {
  padding: 0.55em 0.65em;
  border-bottom: 1px solid var(--table-line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--panel-muted);
  background: var(--table-head-bg);
}

.hidden {
  display: none;
}

footer {
  width: 100%;
  margin-top: 2em;
  padding: 1em;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  text-align: center;
}

@media (min-width: 48rem) {
  main {
    width: 85%;
  }
}

@media (max-width: 48rem) {
  .options,
  .button-row {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
  }
}
