/* Global Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

input, button, textarea, select {
  font: inherit;
  margin: 0;
}

p, h1, h2, h3 {
  overflow-wrap: break-word;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

#root, #__next {
  isolation: isolate;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Styles */
body {
  /* global reset */
  margin: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* styles */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background: linear-gradient(#2f53f0, #3c1b5e 100%);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.25rem;
}

main {
  background: white;
  border-radius: 1.25rem;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.3);
  max-width: 37.5rem;
  padding: 2.5rem;
}

h1 {
  text-align: center;
  color: #8ea1f6;
  margin-bottom: .625rem;
  font-size: 2.5em;
}

.subtitle {
  text-align: center;
  color: #fffefe;
  margin-bottom: 1.875rem;
  font-size: 0.9em;
}

.input-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: #333;
  font-weight: 600;
}

textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.3s;
}

textarea:focus {
  outline: none;
  border-color: #667eea;
}

.shift-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.shift-control label {
  margin: 0;
  min-width: 6.25rem;
}

input[type="range"] {
  flex: 1;
  height: 0.25rem;
  border-radius: 5px;
  background: #e0e0e0;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
}

.shift-value {
  min-width: 1.875rem;
  text-align: center;
  font-weight: bold;
  color: #667eea;
  font-size: 1.2em;
}

.button-group {
  display: flex;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

button {
  flex: 1;
  padding: 1em;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.encrypt-btn {
  background: #667eea;
  color: white;
}

.encrypt-btn:hover,
.encrypt-btn:focus-visible {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgb(102 126 234 / 0.4);
}

.decrypt-btn {
  background: #764ba2;
  color: white;
}

.decrypt-btn:hover,
.decrypt-btn:focus-visible {
  background: #633d8a;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgb(118 75 162 / 0.4);
}

.copy-btn {
  background: #48bb78;
  color: white;
  width: 100%;
  margin-top: 0.625rem;
}

.copy-btn:hover,
.copy-btn:focus-visible {
  background: #38a169;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgb(72 187 120 / 0.4);
}

.output-section {
  margin-top: 1.25rem;
}

#output {
  background: #f7fafc;
  min-height: 6.25rem;
}

.info-section {
  background: #edf2f7;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-top: 1.25rem;
  font-size: 0.9em;
  color: #4a5568;
}

.info-section h2 {
  color: #2d3748;
  font-weight: bold;
}

footer {
  margin-top: 2rem;
  color: white;
}

a {
  color: white;
  transition: all 0.3s;
}

a:hover,
a:focus-visible {
  color: greenyellow;
  transform: translate(2px);
}

@media (max-width: 480px) {
  main {
    padding: 1.25rem;
  }

  h1 {
    font-size: 2em;
  }

  .button-group {
    flex-direction: column;
  }
}