:root {
  color-scheme: dark;
  --page-background: #1a1a1a;
  --page-background-image: linear-gradient(180deg, #1a1a1a 0%, #121212 100%);
  --surface: #262626;
  --surface-elevated: #333333;
  --text-primary: #f0f0f0;
  --text-secondary: #b0b0b0;
  --text-subtle: #888888;
  --border-color: #333333;
  --border-strong: #555555;
  --shadow-color: rgba(33, 17, 65, 0.37);
  --theme-toggle-bg: rgba(255, 255, 255, 0.96);
  --theme-toggle-border: rgba(15, 23, 42, 0.08);
  --theme-toggle-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  --theme-toggle-hover-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
  --theme-toggle-icon: #0f172a;
  --error-text: #ff4747;
  --error-border: rgba(255, 71, 71, 0.3);
  --error-background: rgba(255, 71, 71, 0.1);
  --success-text: #4caf50;
  --success-border: rgba(76, 175, 80, 0.3);
  --success-background: rgba(76, 175, 80, 0.1);
  --input-background: #333333;
}

:root.light {
  color-scheme: light;
  --page-background: #edf2f7;
  --page-background-image:
    radial-gradient(circle at top left, rgba(54, 128, 180, 0.12), transparent 26%),
    radial-gradient(circle at top right, rgba(62, 145, 87, 0.1), transparent 20%),
    linear-gradient(180deg, #f8fbfd 0%, #e7eef4 100%);
  --surface: rgba(255, 255, 255, 0.96);
  --surface-elevated: #eef3f7;
  --text-primary: #16202a;
  --text-secondary: #52606d;
  --text-subtle: #6b7280;
  --border-color: #d7e0e8;
  --border-strong: #c3ceda;
  --shadow-color: rgba(37, 58, 84, 0.18);
  --theme-toggle-bg: rgba(255, 255, 255, 0.96);
  --theme-toggle-border: rgba(15, 23, 42, 0.08);
  --theme-toggle-shadow: 0 12px 30px rgba(28, 46, 70, 0.12);
  --theme-toggle-hover-shadow: 0 16px 36px rgba(28, 46, 70, 0.18);
  --theme-toggle-icon: #0f172a;
  --error-text: #c62828;
  --error-border: rgba(198, 40, 40, 0.2);
  --error-background: rgba(198, 40, 40, 0.08);
  --success-text: #2e7d32;
  --success-border: rgba(46, 125, 50, 0.2);
  --success-background: rgba(46, 125, 50, 0.08);
  --input-background: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  font-family: "Roboto", "Segoe UI", Arial, sans-serif;
  background-color: var(--page-background);
  background-image: var(--page-background-image);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

body,
.container,
.theme-toggle,
.amount-field,
.summary-message,
.error-message,
.download-links a {
  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid var(--theme-toggle-border);
  border-radius: 50%;
  background: var(--theme-toggle-bg);
  color: var(--theme-toggle-icon);
  box-shadow: var(--theme-toggle-shadow);
  backdrop-filter: blur(18px);
  cursor: pointer;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--theme-toggle-hover-shadow);
}

.theme-toggle:focus-visible {
  outline: 3px solid rgba(109, 185, 239, 0.45);
  outline-offset: 3px;
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.theme-toggle-icon svg {
  width: 24px;
  height: 24px;
}

.container {
  width: min(100%, 500px);
  min-height: 50vh;
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 10px 64px 0 var(--shadow-color);
  padding: 54px 56px;
  text-align: center;
}

.app-kicker {
  margin: 0 0 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 28px;
  color: var(--text-primary);
  font-size: 36px;
  line-height: 1.12;
  font-weight: 700;
}

form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.file-upload-wrapper {
  position: relative;
  margin-top: 2px;
}

input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 45px;
  opacity: 0;
  cursor: pointer;
}

.file-label,
.submit-button,
.download-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  border: 0;
  border-radius: 4px;
  padding: 12px 30px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  background-image: linear-gradient(to right, #6db9ef, #7ce08a);
  transition:
    transform 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out,
    opacity 0.2s ease-in-out;
}

.file-label:hover,
.submit-button:hover,
.download-links a:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 20px 0 rgba(124, 224, 138, 0.5);
}

.file-label {
  width: 100%;
}

#file-chosen,
.field-label {
  color: var(--text-secondary);
  font-size: 15px;
}

#file-chosen {
  min-height: 20px;
  word-break: break-word;
}

.field-label {
  margin-top: 2px;
  text-align: left;
}

.amount-field {
  display: grid;
  grid-template-columns: 72px 1fr;
  min-height: 45px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background-color: var(--input-background);
}

.amount-field span {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  background-color: var(--surface-elevated);
  font-weight: 700;
  border-right: 1px solid var(--border-strong);
}

.amount-field input {
  min-width: 0;
  height: 45px;
  border: 0;
  padding: 0 14px;
  background-color: transparent;
  color: var(--text-primary);
  font-size: 16px;
}

.amount-field input:focus {
  outline: 3px solid rgba(109, 185, 239, 0.45);
  outline-offset: -3px;
}

.submit-button {
  margin-top: 4px;
}

.submit-button:disabled {
  background-color: #c5ced8;
  background-image: none;
  color: #4f5f6f;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  opacity: 0.85;
}

.loader {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 8px auto 0;
}

.processing-text {
  margin: 0;
  color: var(--text-primary);
  font-size: 15px;
  animation: pulse 2s ease-in-out infinite;
}

.summary-message,
.error-message {
  margin: 4px 0 0;
  padding: 14px;
  border-radius: 4px;
  line-height: 1.5;
}

.summary-message {
  color: var(--success-text);
  background-color: var(--success-background);
  border: 1px solid var(--success-border);
}

.error-message {
  color: var(--error-text);
  background-color: var(--error-background);
  border: 1px solid var(--error-border);
  text-align: left;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: "Courier New", monospace;
  font-size: 13px;
}

.download-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.download-links a {
  background-color: #008cba;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.6;
  }
}

@media (max-width: 640px) {
  body {
    align-items: flex-start;
    padding: 84px 14px 24px;
  }

  .theme-toggle {
    top: 12px;
    right: 12px;
    width: 52px;
    height: 52px;
  }

  .container {
    padding: 42px 20px 28px;
  }

  h1 {
    font-size: 32px;
  }
}
