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

:root {
  --primary-color: #00ADD8;
  --secondary-color: #5DC9E2;
  --dark-bg: #1a1a2e;
  --light-bg: #16213e;
  --lighter-bg: #2a2f4c;
  --text-primary: #ffffff;
  --text-secondary: #b4b4b4;
  --success-color: #00C851;
  --error-color: #ff4444;
  --border-radius: 8px;
  --transition: all 0.3s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--dark-bg) 0%, var(--light-bg) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 10px;
  overflow-x: hidden;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  overflow-x: hidden;
}

header {
  text-align: center;
  margin-bottom: 20px;
  padding: 20px 10px;
}

h1 {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  word-break: break-word;
}

.subtitle {
  color: var(--text-secondary);
  /* font-size: clamp(0.9rem, 3vw, 1.1rem); */
}

main {
  background: var(--light-bg);
  border-radius: var(--border-radius);
  padding: clamp(15px, 4vw, 30px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  overflow-x: hidden;
  width: 100%;
}

.converter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(15px, 3vw, 30px);
  margin-bottom: clamp(15px, 3vw, 30px);
  width: 100%;
  overflow: hidden;
}

.input-section,
.output-section {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
  flex-wrap: wrap;
}

.section-header h2 {
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: var(--primary-color);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

textarea {
  width: 100%;
  height: clamp(250px, 50vh, 500px);
  min-height: 200px;
  padding: clamp(10px, 2vw, 15px);
  background: var(--dark-bg);
  border: 2px solid var(--lighter-bg);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: clamp(12px, 2vw, 14px);
  resize: vertical;
  transition: var(--transition);
  touch-action: manipulation;
}

textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 173, 216, 0.1);
}

pre {
  width: 100%;
  height: clamp(250px, 50vh, 500px);
  min-height: 200px;
  margin: 0;
  background: var(--dark-bg);
  border: 2px solid var(--lighter-bg);
  border-radius: var(--border-radius);
  overflow: auto;
  padding: clamp(10px, 2vw, 15px);
  -webkit-overflow-scrolling: touch;
}

#outputCode {
  display: block;
  color: var(--text-primary);
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: clamp(12px, 2vw, 14px);
  line-height: 1.6;
  white-space: pre;
  word-wrap: break-word;
}

.btn {
  padding: clamp(8px, 2vw, 10px) clamp(12px, 2vw, 20px);
  border: none;
  border-radius: var(--border-radius);
  font-size: clamp(11px, 2vw, 14px);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  min-height: 40px;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 173, 216, 0.3);
  }

  .btn-secondary:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
  }
}

.btn-primary:active {
  background: var(--secondary-color);
  transform: scale(0.98);
}

.btn-primary.success {
  background: var(--success-color);
}

.btn-secondary {
  background: var(--lighter-bg);
  color: var(--text-primary);
}

.btn-secondary:active {
  background: var(--primary-color);
  transform: scale(0.98);
}

.options-panel {
  background: var(--lighter-bg);
  padding: clamp(15px, 3vw, 20px);
  border-radius: var(--border-radius);
  margin-bottom: clamp(15px, 3vw, 20px);
}

.options-panel h3 {
  color: var(--primary-color);
  margin-bottom: 12px;
  font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: clamp(10px, 2vw, 15px);
}

.options-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-height: 44px;
  padding: 5px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.options-grid input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  cursor: pointer;
  accent-color: var(--primary-color);
  touch-action: manipulation;
}

.options-grid input[type="text"] {
  padding: clamp(8px, 2vw, 10px) clamp(10px, 2vw, 12px);
  background: var(--dark-bg);
  border: 2px solid var(--light-bg);
  border-radius: 5px;
  color: var(--text-primary);
  font-size: clamp(13px, 2vw, 14px);
  transition: var(--transition);
  min-height: 40px;
  width: 100%;
  touch-action: manipulation;
}

.options-grid input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
}

.error-message {
  display: none;
  background: var(--error-color);
  color: white;
  padding: 15px;
  border-radius: var(--border-radius);
  margin-top: 15px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

footer {
  text-align: center;
  margin-top: 30px;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

/* Responsive design */
@media (max-width: 1024px) {
  .converter-grid {
    grid-template-columns: 1fr;
  }

  textarea,
  pre {
    height: clamp(300px, 40vh, 400px);
  }

  .options-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  }
}

@media (max-width: 768px) {
  body {
    padding: 8px;
  }

  header {
    margin-bottom: 15px;
    padding: 15px 8px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  main {
    padding: 15px;
    border-radius: 5px;
  }

  .converter-grid {
    gap: 20px;
  }

  textarea,
  pre {
    height: clamp(250px, 35vh, 300px);
    font-size: 13px;
  }

  .section-header {
    margin-bottom: 8px;
  }

  .section-header h2 {
    font-size: 1.1rem;
  }

  .btn {
    padding: 10px 15px;
    font-size: 12px;
  }

  .options-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .options-grid label {
    padding: 8px;
  }

  .options-panel {
    padding: 15px;
  }

  footer {
    font-size: 0.85rem;
    padding: 15px 5px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 5px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  main {
    padding: 10px;
  }

  textarea,
  pre {
    height: clamp(200px, 30vh, 250px);
    font-size: 12px;
    padding: 10px;
  }

  .btn {
    font-size: 11px;
    padding: 8px 12px;
  }

  .section-header h2 {
    font-size: 1rem;
  }

  .options-panel h3 {
    font-size: 0.95rem;
  }
}

/* Loading animation for better UX */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.btn:active {
  transform: scale(0.98);
}

/* Top-left home icon */
.home-icon {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  color: var(--primary-color);
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: var(--transition);
  z-index: 9999;
}

.home-icon svg {
  display: block;
  width: 22px;
  height: 22px;
  color: var(--primary-color);
}

.home-icon:hover {
  background: var(--primary-color);
  color: white;
}

.home-icon:hover svg {
  color: white;
}

@media (max-width: 480px) {
  .home-icon {
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
  }
}

/* Weber brand in header */
.weber-brand {
  color: var(--primary-color);
  font-weight: 800;
  text-decoration: none;
  margin-right: 8px;
}

/* Smaller variant for headings */
.weber-brand--small {
  font-weight: 700;
  margin-bottom: 1rem;
  margin-right: 0;
  vertical-align: middle;
}

@media (max-width: 480px) {
  .weber-brand--small {
    font-size: 0.9rem;
  }
}