:root {
  --bg: #08101f;
  --card: rgba(255, 255, 255, 0.9);
  --card-border: rgba(255, 255, 255, 0.24);
  --text: #0f172a;
  --muted: #475569;
  --line: rgba(15, 23, 42, 0.12);
  --accent: #0f172a;
  --accent-contrast: #ffffff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  --radius: 24px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --card: rgba(10, 16, 31, 0.78);
    --card-border: rgba(255, 255, 255, 0.14);
    --text: #f8fafc;
    --muted: #cbd5e1;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #ffffff;
    --accent-contrast: #0f172a;
  }
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  transform: translateY(-200%);
  z-index: 30;
  background: #fff;
  color: #000;
  padding: 10px 14px;
  border-radius: 12px;
}
.skip-link:focus { transform: translateY(0); }

.bg-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
.bg-slide,
.bg-mask {
  position: absolute;
  inset: 0;
}
.bg-slide {
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  animation: seasonFade 32s infinite;
  transform: scale(1.04);
}
.bg-slide-1 { background-image: url('/images/seasons/spring-taiwan.ec7e13fddd20.svg'); animation-delay: 0s; }
.bg-slide-2 { background-image: url('/images/seasons/summer-taiwan.106d7fefd7b5.svg'); animation-delay: 8s; }
.bg-slide-3 { background-image: url('/images/seasons/autumn-taiwan.bfce5c98df5a.svg'); animation-delay: 16s; }
.bg-slide-4 { background-image: url('/images/seasons/winter-taiwan.48066b21ae28.svg'); animation-delay: 24s; }
.bg-mask {
  background:
    radial-gradient(circle at top, rgba(15, 23, 42, 0.12), rgba(15, 23, 42, 0.75)),
    linear-gradient(180deg, rgba(2, 6, 23, 0.28), rgba(2, 6, 23, 0.76));
}

@keyframes seasonFade {
  0%, 20% { opacity: 0; }
  3%, 17% { opacity: 1; }
  25%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-slide { animation: none; }
  .bg-slide-1 { opacity: 1; }
}

.layout {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(100%, 720px);
  backdrop-filter: blur(18px);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); line-height: 1.15; }
h2 { font-size: 1.25rem; }
.muted { color: var(--muted); margin-top: 6px; }
.small { font-size: 0.9375rem; }

.field-stack {
  display: grid;
  gap: 18px;
}
.field {
  display: grid;
  gap: 10px;
}
.label {
  font-weight: 700;
  font-size: 0.97rem;
}
.file-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}
.file-name {
  min-height: 1.5em;
  color: var(--muted);
  word-break: break-word;
}
.textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
}
@media (prefers-color-scheme: dark) {
  .textarea { background: rgba(2, 6, 23, 0.48); }
}
.textarea:focus,
.button:focus,
.icon-button:focus,
.text-button:focus,
.text-link:focus {
  outline: 3px solid rgba(59, 130, 246, 0.55);
  outline-offset: 2px;
}
.hint {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}
.cookie-meta {
  display: grid;
  gap: 8px;
}
.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.actions {
  margin-top: 22px;
}
.button,
.icon-button,
.text-button {
  border: 0;
  border-radius: 16px;
}
.button {
  min-height: 48px;
  padding: 0 18px;
  font-weight: 700;
}
.button-primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-contrast);
}
.button-secondary {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
}
@media (prefers-color-scheme: dark) {
  .button-secondary {
    background: rgba(255, 255, 255, 0.09);
  }
}
.icon-button {
  width: 40px;
  height: 40px;
  background: transparent;
  color: var(--text);
  font-size: 1.5rem;
}
.text-button,
.text-link {
  background: none;
  color: var(--muted);
  text-decoration: underline;
  padding: 0;
}
.status {
  min-height: 1.5rem;
  margin-top: 14px;
  color: var(--muted);
}

.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.68);
}
.modal-backdrop-solid {
  background: rgba(2, 6, 23, 0.8);
}
.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(18px);
}
.modal-dialog-compact {
  width: min(100%, 340px);
  text-align: center;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.turnstile-box {
  min-height: 78px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px dashed var(--line);
  padding: 12px;
  margin-top: 14px;
}
.spinner {
  width: 44px;
  height: 44px;
  margin: 4px auto 16px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: currentColor;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

.result-grid {
  display: grid;
  gap: 16px;
}
.textarea-result {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.result-copy {
  justify-self: start;
}
.details-block {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.raw-response {
  margin: 12px 0 0;
  max-height: 220px;
  overflow: auto;
  border-radius: 16px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.08);
  white-space: pre-wrap;
  word-break: break-word;
}
@media (prefers-color-scheme: dark) {
  .raw-response {
    background: rgba(255, 255, 255, 0.07);
  }
}
.noscript {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 99;
  background: #fff;
  color: #111;
  border-radius: 16px;
  padding: 12px 16px;
}

@media (max-width: 640px) {
  .layout { padding: 16px; }
  .card { padding: 18px; border-radius: 20px; }
  .card-header { align-items: flex-start; }
  .file-row { grid-template-columns: 1fr; }
  .button-primary { min-height: 50px; }
  .checkbox-row { align-items: flex-start; }
}
