:root {
  --primary: #164e63;
  --primary-foreground: #ffffff;
  --secondary: #10b981;
  --secondary-foreground: #ffffff;
  --background: #ecfeff;
  --foreground: #475569;
  --card: rgba(255, 255, 255, 0.85);
  --card-foreground: #164e63;
  --muted: #f1f5f9;
  --muted-foreground: #475569;
  --border: rgba(0, 0, 0, 0.1);
  --input: #ffffff;
  --ring: rgba(16, 185, 129, 0.5);
  --destructive: #dc2626;
  --radius: 0.75rem;
}

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

body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #ef4444 100%);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  animation: fadeIn 0.5s ease-in-out;
}


.header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 32px;
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.header-content {
  space-y: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.logo-icon {
  padding: 0.75rem;
  border-radius: var(--radius);
  background: rgba(22, 78, 99, 0.1);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  font-size: 2rem;
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1.125rem;
  color: var(--muted-foreground);
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

.badges {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
}

.badge-primary {
  background: rgba(22, 78, 99, 0.1);
  color: var(--primary);
}

.badge-secondary {
  background: rgba(255, 255, 255, 0.5);
  color: var(--foreground);
}


.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.tab-btn {
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-weight: 500;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 2px 8px rgba(22, 78, 99, 0.2);
}

.tab-btn:hover:not(.active) {
  background: rgba(22, 78, 99, 0.05);
}


.tab-content {
  display: none;
  animation: slideUp 0.3s ease-out;
}

.tab-content.active {
  display: block;
}


.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  
}

@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
  }
}


.button-card {
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin-top: 1rem;
}


.card {
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--card-foreground);
  margin-bottom: 0.5rem;
}

.card-header p {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.card-content {
  padding: 1.5rem;
}

.header-with-toggle {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}


.form-group {
  margin-bottom: 1.5rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-weight: 500;
  color: var(--card-foreground);
  margin-bottom: 0.5rem;
}

.label-with-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

input,
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--input);
  backdrop-filter: blur(16px);
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--ring);
}

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
}

.char-count {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}


.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-group input {
  flex: 1;
}


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: #0f3a47;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 78, 99, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
  background: var(--muted);
}

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
}

.btn-ghost:hover {
  background: var(--muted);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

.btn-toggle {
  padding: 0.25rem 0.5rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-toggle:hover {
  background: var(--muted);
}

.btn-group {
  display: flex;
  gap: 0.5rem;
}

.btn-group .btn {
  flex: 1;
}


.settings-card {
  
  margin: 4rem 0 3rem 0;
}

.settings-grid {
  display: grid;
  gap: 2rem;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}


.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.settings-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.settings-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}


.char-item {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.char-item:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.char-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  pointer-events: none; 
}

.char-checkbox input[type="checkbox"] {
  width: auto;
  margin-top: 0.125rem;
  cursor: pointer;
  pointer-events: auto; 
}

.char-info {
  flex: 1;
  min-width: 0;
}

.char-code {
  font-weight: 600;
  color: var(--card-foreground);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.char-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 0.5rem;
}

.char-desc {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.4;
}

.encoding-info-card {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.encoding-info-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.encoding-info-header h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--card-foreground);
}

.encoding-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

.stat-item {
  text-align: center;
  padding: 1rem;
  background: rgba(241, 245, 249, 0.5);
  border-radius: calc(var(--radius) - 2px);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.warning-card {
  background: rgba(220, 38, 38, 0.05);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: var(--radius);
  padding: 1rem;
}

.warning-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--destructive);
}

.warning-icon {
  font-size: 1rem;
}

.warning-content p {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
}

.encoding-info h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--card-foreground);
  margin-bottom: 1rem;
}

.info-grid {
  display: grid;
  gap: 0.75rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  background: rgba(241, 245, 249, 0.5);
  border-radius: calc(var(--radius) - 4px);
}


.how-it-works {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.step-card {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s ease;
}

.step-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.step-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.step h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.step p {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}


.btn-hide {
  background: rgba(255, 255, 255, 0.8);
  color: var(--foreground);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

.btn-hide:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}


#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  animation: slideIn 0.3s ease-out;
}

.toast.success {
  border-left: 4px solid var(--secondary);
}

.toast.error {
  border-left: 4px solid var(--destructive);
}

.toast-title {
  font-weight: 600;
  color: var(--card-foreground);
  margin-bottom: 0.25rem;
}

.toast-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}


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

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

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

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

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

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


@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .logo h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .badges {
    justify-content: center;
  }

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

  .how-it-works {
    grid-template-columns: 1fr;
  }

  .settings-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

#decode-text {
  min-height: 390px !important;
}

#encoded-text {
  min-height: 256px !important;
}


.footer a {
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--foreground);
  text-decoration: underline;
}
