/**
 * SPDX-License-Identifier: Apache-2.0
 */

:root {
  color-scheme: dark light;
}

html {
  box-sizing: border-box;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  background: linear-gradient(180deg, #111827 0%, #1f2937 45%, #4338ca 100%);
  background-attachment: fixed;
  color: #e9e9ee;
  display: grid;
  place-items: start center;
  padding: 24px;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle animated sheen overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 30%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0) 70%
  );
  background-size: 200% 100%;
  animation: sheen 12s ease-in-out infinite;
}

@keyframes sheen {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}
/* Subtle animated sheen overlay */

output,
form,
.rewrite-form fieldset {
  width: min(100%, 900px);
  margin: 12px 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
}

label {
  font-weight: bold;
}

output {
  white-space: pre;
  text-wrap: wrap;
  padding: 16px 16px 48px;
  line-height: 1.85;
}

.copy-button {
  position: relative;
  top: -44px;
  left: 12px;
}

.rewrite-form fieldset {
  padding: 16px;
}

button {
  cursor: pointer;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, #7c5cff 0%, #5a3dff 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: transform 120ms ease, box-shadow 160ms ease, opacity 160ms ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  min-width: 10rem;
}
button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28); }
button:active { transform: translateY(0); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.write-form .wrapper {
  padding: 16px;
}

.rewrite-form .wrapper {
  padding: 16px;
}

textarea#prompt {
  min-height: 7rem;
}

.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

input, textarea, select {
  width: 100%;
  color: #e9e9ee;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
input::placeholder, textarea::placeholder { color: #b9bbd3; }
input:focus, textarea:focus, select:focus {
  border-color: rgba(67, 56, 202, 0.85);
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.28);
}

.not-supported-message {
  border: 1px solid #ff6b6b;
  background: rgba(255, 107, 107, 0.12);
  padding: 10px 12px;
  border-radius: 12px;
}

footer {
  margin-block: 20px 8px;
  color: #b9bbd3;
  text-align: center;
}

/* Improve link visibility and accessibility on dark background */
a {
  color: #8ecbff;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  font-weight: 600;
}
a:visited {
  color: #c2b6ff;
}
a:hover {
  color: #ffffff;
}
a:focus-visible {
  outline: 2px solid rgba(124, 92, 255, 0.75);
  outline-offset: 2px;
  border-radius: 4px;
}
