@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;700&display=swap');

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* --- Design Tokens --- */
:root {
  /* Background */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  --bg-primary: #0f172a;
  --bg-secondary: #764ba2;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-edit: #141e2e;
  --bg-focus: rgba(99, 102, 241, 0.1);
  --bg-byte: #0d1321;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.2);
  --border-highlight: #3b4f74;
  --border-thumb: #94a3b8;

  /* Text */
  --text-primary: #e8ecf4;
  --text-secondary: #8895ad;
  --text-muted: #94a3b8;
  --accent-blue: #3b82f6;

  /* Accents */
  --accent: #667eea;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-orange: #f59e0b;
  --accent-green: #22c55e;

  /* Channels */
  --channel-r: #ef4444;
  --channel-g: #22c55e;
  --channel-b: #3b82f6;
  --channel-a: #a78bfa;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Header Controls */
  --control-height: 2.4rem;
  --control-height-sm: 1.78rem;
  --control-height-xs: 1.64rem;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.08);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

  /* Transitions */
  --transition: 0.2s ease;
}

/* ===== Light Theme Overrides ===== */
.light-theme {
  --bg-primary: #f1f5f9;
  --bg-secondary: #c7d2fe;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-byte: #e5e7eb;
  --bg-edit: white;
  --border-subtle: rgba(148, 163, 184, 0.5);
  --border-highlight: #9ca3af;
  --border-thumb: #f1f5f9;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #60738f;

  --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.1);

  background-image:
    radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(168, 85, 247, 0.1) 0%, transparent 50%);
}

body {
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(168, 85, 247, 0.15) 0%, transparent 50%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  overflow-x: hidden;
}

body::selection {
  background: var(--bg-secondary);
  color: white;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  width: 100%;
  max-width: 960px;
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  text-align: center;
  margin: 0 1rem 0.5rem;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.subtitle {
  font-size: 0.9rem;
  text-align: center;
  color: var(--text-muted);
  margin: 0 1rem 1rem;
}

.title-icon {
  height: 2rem;
  width: auto;
  vertical-align: middle;
  margin-right: 1rem;
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
  transition: transform 0.3s ease;
  animation: float 3s ease-in-out infinite;
}

.title:hover .title-icon {
  transform: scale(1.1) rotate(15deg);
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

/* ============================================
   THEME AND LANGUAGE SWITCHER
   ============================================ */
.theme-lang-switcher {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  display: flex;
  gap: 0.5rem;
  z-index: 100;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle-group {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.theme-toggle-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: 1px solid var(--border-subtle);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transform: translateY(0) scale(0.94);
  opacity: 0.5;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.theme-toggle-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.theme-toggle-btn:hover {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  opacity: 0.95;
}

.theme-toggle-btn:hover svg {
  transform: translateY(-1px);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

.theme-toggle-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.theme-toggle-btn.is-active {
  opacity: 1;
  transform: translateY(-1px) scale(1);
}

.light-theme .theme-toggle-btn {
  box-shadow: 0 8px 22px rgba(59, 130, 246, 0.24);
}

.version-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 2px 10px;
  border-radius: 100px;
}

/* ===== LANGUAGE SELECTOR ===== */
.lang-select {
  box-sizing: border-box;
  background: transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  height: var(--control-height);
  padding: 0 2.5rem 0 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.3s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 14px 14px;
  outline: none;
}

.lang-select:hover {
  border-color: var(--border-highlight);
  color: var(--text-primary);
  transform_: translateY(-2px);
}

.lang-select:focus {
  box-shadow: 0 0 0 2px var(--shadow-glow);
}

.lang-select option {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  padding: 10px;
}

.light-theme .lang-select {
  box-shadow: 0 1px 1px rgba(59, 130, 246, 0.06);
}

/* ============================================
   MAIN
   ============================================ */
#app-main {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 2rem;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  gap: 1rem;
}

.is-loading .glass-card {
  animation: fadeIn 0.8s ease-out forwards;
}

.glass-card:hover {
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

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

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

/* ===== Color Picker Section ===== */
.color-picker-card {
  display: flex;
  align-items: stretch;
}

/* Color Preview */
.color-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-width: 190px;
}

.color-preview__swatch {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-lg);

  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: background-color 0.15s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.color-preview__swatch.has-transparency {
  /* checker pattern for alpha */
  background: repeating-conic-gradient(#CCCCCC 0 25%, #FFFFFF 0 50%) 50% / 20px 20px;
  background-size: 10px 10px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.color-preview__swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--swatch-color, #FF6B35);
  transition: background-color 0.15s ease;
}

.color-preview__info {
  text-align: center;
}

.color-preview__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 4px;
}

.color-preview__hex {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.color-preview__rgb {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Color Controls */
.color-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 70px;
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}

.channel-r {
  background: var(--channel-r);
}

.channel-g {
  background: var(--channel-g);
}

.channel-b {
  background: var(--channel-b);
}

.channel-a {
  background: var(--channel-a);
}

.slider-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 28px;
  text-align: right;
}

/* Range slider styling */
.slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-byte);
  outline: none;
  transition: opacity var(--transition);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-thumb);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider--red::-webkit-slider-thumb {
  background: var(--channel-r);
}

.slider--green::-webkit-slider-thumb {
  background: var(--channel-g);
}

.slider--blue::-webkit-slider-thumb {
  background: var(--channel-b);
}

.slider--alpha::-webkit-slider-thumb {
  background: var(--channel-a);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slider--red::-moz-range-thumb {
  background: var(--channel-r);
}

.slider--green::-moz-range-thumb {
  background: var(--channel-g);
}

.slider--blue::-moz-range-thumb {
  background: var(--channel-b);
}

.slider--alpha::-moz-range-thumb {
  background: var(--channel-a);
}

/* Hex input */
.hex-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.hex-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  min-width: 36px;
}

.hex-input {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--bg-byte);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 12px;
  width: 120px;
  outline: none;
  transition: border-color var(--transition);
}

.hex-input:focus {
  border-color: var(--accent-blue);
}

/* Inline alpha slider next to color picker */
.native-picker {
  -webkit-appearance: none;
  appearance: none;
  width: 36px;
  height: 36px;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  padding: 2px;
  transition: border-color var(--transition);
}

.native-picker:hover {
  border-color: var(--accent-blue);
}

.native-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.native-picker::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

/* Toggle Switch */
.toggle-group {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-text {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  transition: color var(--transition);
}

.switch input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--bg-byte);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.switch input:checked+.toggle-slider {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent-blue);
}

.switch input:checked+.toggle-slider::before {
  transform: translateX(16px);
  background: var(--accent-blue);
}

.switch:hover .toggle-text {
  color: var(--text-secondary);
}

.switch input:checked~.toggle-text {
  color: var(--text-primary);
}


/* ===== Format Cards ===== */


.formats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.format-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 1.5rem;
}

.format-card__info-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.format-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.format-card__name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.format-card__description {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 2;
}

.format-card__meta-group {
  display: flex;
  align-items: center;
  min-width: max-content;
}

.format-card__badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.format-card__badge--uint8 {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.format-card__badge--uint16 {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.format-card__badge--uint32 {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.format-card__badge--float32 {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.format-card__badge--float16 {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

/* API Info Popup */
.api-info {
  position: relative;
  display: flex;
  align-items: center;
}

.api-info__trigger {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-byte);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: help;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.api-info__trigger:hover {
  border-color: var(--accent-blue);
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.1);
}

.api-popup {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: max-content;
  min-width: 280px;
  max-width: 420px;
  background: rgba(26, 34, 53, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.api-info:hover .api-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.api-popup__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.api-popup__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.api-popup__row:last-child {
  margin-bottom: 0;
}

.api-popup__label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 45px;
}

.api-popup__value {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-primary);
  text-align: right;
  white-space: nowrap;
}

.format-card__size {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Memory Layout */
.memory-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.memory-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.memory-channel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.memory-channel+.memory-channel {
  border-left: 1px dashed var(--border-subtle);
}

.memory-channel__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  padding: 2px 10px;
  border-radius: 4px;
}

.memory-channel__label--r {
  color: var(--channel-r);
  background: rgba(239, 68, 68, 0.1);
}

.memory-channel__label--g {
  color: var(--channel-g);
  background: rgba(34, 197, 94, 0.1);
}

.memory-channel__label--b {
  color: var(--channel-b);
  background: rgba(59, 130, 246, 0.1);
}

.memory-channel__label--a {
  color: var(--channel-a);
  background: rgba(167, 139, 250, 0.1);
}

/* Byte grid */
.byte-grid {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 20px;
}

.byte-cell {
  width: 44px;
  height: 52px;
  background: var(--bg-byte);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}

.byte-cell:hover {
  border-color: var(--border-highlight);
  background: rgba(255, 255, 255, 0.03);
}

.byte-cell__hex-input {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  width: 32px;
  text-align: center;
  padding: 1px 2px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  cursor: text;
  caret-color: var(--accent-cyan);
}

.byte-cell__hex-input:hover {
  border-color: var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
}

.byte-cell__hex-input:focus {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.byte-cell__dec {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
}

.byte-cell__index {
  position: absolute;
  top: -16px;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-muted);
}

/* Address bar */
.address-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 8px 14px;
  background: var(--bg-byte);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.address-bar__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.address-bar__hex-input {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 3px 8px;
  outline: none;
  flex: 1;
  text-align: right;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  cursor: text;
}

.address-bar__hex-input:hover {
  border-color: var(--border-highlight);
  color: var(--text-primary);
}

.address-bar__hex-input:focus {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.06);
  color: var(--text-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

/* Binary visualization */
.binary-row {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--bg-byte);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.binary-row__title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.binary-row__content {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.binary-byte {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.binary-byte__label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-muted);
}

.binary-byte__input {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  width: 80px;
  text-align: center;
  padding: 2px 4px;
  outline: none;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  cursor: text;
}

.binary-byte__input:hover {
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.binary-byte__input:focus {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.06);
  color: var(--text-primary);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.12);
}

/* Channel value decorations */
.byte-cell--r {
  border-bottom: 2px solid var(--channel-r);
}

.byte-cell--g {
  border-bottom: 2px solid var(--channel-g);
}

.byte-cell--b {
  border-bottom: 2px solid var(--channel-b);
}

.byte-cell--a {
  border-bottom: 2px solid var(--channel-a);
}

/* Raw Channel Values Section */
.raw-values-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.raw-values-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.raw-values-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.raw-value-chip {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--transition);
}

.raw-value-chip:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-highlight);
}

.raw-value-chip__label {
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  background: var(--bg-byte);
  border-right: 1px solid var(--border-subtle);
}

.raw-value-chip__label--r {
  background: rgba(239, 68, 68, 0.3);
  color: var(--channel-r);
}

.raw-value-chip__label--g {
  background: rgba(16, 185, 129, 0.3);
  color: var(--channel-g);
}

.raw-value-chip__label--b {
  background: rgba(59, 130, 246, 0.3);
  color: var(--channel-b);
}

.raw-value-chip__label--a {
  background: rgba(168, 85, 247, 0.3);
  color: var(--channel-a);
}

.raw-value-chip__input {
  width: 60px;
  background: transparent;
  border: none;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  text-align: center;
  outline: none;
}

.raw-value-chip__input:focus {
  background: rgba(59, 130, 246, 0.1);
}

/* Float display as input */
.float-input {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 500;
  text-align: center;
  margin-bottom: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  width: 90px;
  padding: 2px 4px;
  outline: none;
  transition: all var(--transition);
  cursor: text;
}

.float-input:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-subtle);
}

.float-input:focus {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--accent-blue);
  color: var(--text-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
  width: 100%;
  max-width: 1100px;
  margin: auto auto 0;
  padding: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
  position: relative;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 0 1rem;
  color: var(--text-muted);
}

.footer-title {
  font-weight: 500;
  font-size: 0.85rem;
}

.footer-separator {
  color: var(--border-subtle);
  user-select: none;
}

.footer-content a {
  color: #a78bfa;
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.footer-content a:hover {
  color: #764ba2;
  filter: brightness(1.2);
}

/* ============================================
   SCROLL-TO-TOP BUTTON
   ============================================ */
.scroll-top-btn {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: 1px solid var(--border-subtle);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.scroll-top-btn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn svg {
  transition: transform 0.3s ease;
}

.scroll-top-btn:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.scroll-top-btn:hover svg {
  transform: translateY(-2px);
}

.scroll-top-btn:active {
  transform: scale(0.95);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
  .theme-lang-switcher {
    top: 0.55rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    gap: 0.4rem;
  }

  .header {
    padding-top: 3.1rem;
  }

  .title {
    font-size: 1.8rem;
    line-height: 1.2;
  }
}

@media (max-width: 800px) {
  .theme-lang-switcher {
    top: 0.5rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    gap: 0.35rem;
  }

  .theme-toggle-group {
    height: var(--control-height-sm);
    padding: 0 0.16rem;
    gap: 0.22rem;
  }

  .theme-toggle-btn {
    width: 1.72rem;
    height: 1.72rem;
  }

  .theme-toggle-btn svg {
    width: 13px;
    height: 13px;
  }

  .lang-select {
    height: var(--control-height-sm);
    font-size: 0.82rem;
    padding: 0 2.2rem 0 0.7rem;
    background-position: right 0.6rem center;
  }
}

@media (max-width: 600px) {
  .footer-content {
    gap: 0.75rem;
  }

  .scroll-top-btn {
    right: 1.5rem;
    bottom: 1.5rem;
  }
}

@media (max-width: 768px) {
  .app {
    padding: 24px 16px 40px;
  }

  .color-picker-card {
    flex-direction: column;
    gap: 24px;
    padding: 20px;
  }

  .color-preview {
    flex-direction: row;
    min-width: auto;
  }

  .color-preview__swatch {
    width: 80px;
    height: 80px;
  }

  .color-preview__info {
    text-align: left;
  }

  .byte-cell {
    width: 36px;
    height: 44px;
  }

  .byte-cell__hex {
    font-size: 0.7rem;
  }
}

@media (max-width: 380px) {
  .theme-lang-switcher {
    top: 0.45rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .theme-toggle-btn {
    width: 1.58rem;
    height: 1.58rem;
  }

  .lang-select {
    height: var(--control-height-xs);
    max-width: 7.9rem;
    font-size: 0.78rem;
  }

  .theme-toggle-group {
    height: var(--control-height-xs);
  }
}

