* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Jua", sans-serif;

  /* Chrome and Opera */
  user-select: none;

  /* Safari */
  -webkit-user-select: none;

  /* Konqueror HTML */
  -khtml-user-select: none;

  /* Firefox */
  -moz-user-select: none;

  /* Internet Explorer/Edge */
  -ms-user-select: none;
}

:link {
  color: #6f6;
}

:visited {
  color: #66f;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Jua', sans-serif;
  min-height: 100vh;
  transition: background-color 0.25s ease;
}

/* ===== THEME VARIABLES ===== */
[data-theme="classic"] {
  --brand: #ccffcc;
  --brand-mid: #a8f0a8;
  --brand-dark: #4caf50;
  --bg: #e8ffe8;
  --bg2: #d0ffd0;
  --text: #1a2e1a;
  --text-muted: #4a6a4a;
  --glass-bg: rgba(204, 255, 204, 0.45);
  --glass-border: rgba(76, 175, 80, 0.25);
  --glass-shadow: rgba(76, 175, 80, 0.12);
  --btn-primary: #3d9a40;
  --btn-primary-h: #2e7a31;
  --chip-bg: rgba(204, 255, 204, 0.55);
  --chip-border: rgba(76, 175, 80, 0.3);
  --result-bg: rgba(240, 255, 240, 0.7);
  --error-bg: rgba(255, 230, 230, 0.7);
  --error-color: #c0392b;
  --toast-bg: #2e7a31;
}

[data-theme="notgreen1"] {
  --brand: #ffcccc;
  --brand-mid: #f0a8a8;
  --brand-dark: #e05555;
  --bg: #ffe8e8;
  --bg2: #ffd0d0;
  --text: #2e1a1a;
  --text-muted: #6a4a4a;
  --glass-bg: rgba(255, 204, 204, 0.45);
  --glass-border: rgba(224, 85, 85, 0.25);
  --glass-shadow: rgba(224, 85, 85, 0.12);
  --btn-primary: #c0392b;
  --btn-primary-h: #a93226;
  --chip-bg: rgba(255, 204, 204, 0.55);
  --chip-border: rgba(224, 85, 85, 0.3);
  --result-bg: rgba(255, 240, 240, 0.7);
  --error-bg: rgba(255, 220, 220, 0.8);
  --error-color: #922b21;
  --toast-bg: #c0392b;
}

[data-theme="notgreen2"] {
  --brand: #ccccff;
  --brand-mid: #a8a8f0;
  --brand-dark: #5555e0;
  --bg: #e8e8ff;
  --bg2: #d0d0ff;
  --text: #1a1a2e;
  --text-muted: #4a4a6a;
  --glass-bg: rgba(204, 204, 255, 0.45);
  --glass-border: rgba(85, 85, 224, 0.25);
  --glass-shadow: rgba(85, 85, 224, 0.12);
  --btn-primary: #5c35d4;
  --btn-primary-h: #4a2ab0;
  --chip-bg: rgba(204, 204, 255, 0.55);
  --chip-border: rgba(85, 85, 224, 0.3);
  --result-bg: rgba(240, 240, 255, 0.7);
  --error-bg: rgba(255, 230, 230, 0.7);
  --error-color: #c0392b;
  --toast-bg: #5c35d4;
}

[data-theme="notgreen3"] {
  --brand: #ffffcc;
  --brand-mid: #f0f0a8;
  --brand-dark: #b5a000;
  --bg: #ffffe8;
  --bg2: #ffffd0;
  --text: #2e2a1a;
  --text-muted: #6a5a4a;
  --glass-bg: rgba(255, 255, 204, 0.45);
  --glass-border: rgba(181, 160, 0, 0.25);
  --glass-shadow: rgba(181, 160, 0, 0.12);
  --btn-primary: #9a8000;
  --btn-primary-h: #7a6500;
  --chip-bg: rgba(255, 255, 204, 0.55);
  --chip-border: rgba(181, 160, 0, 0.3);
  --result-bg: rgba(255, 255, 240, 0.7);
  --error-bg: rgba(255, 230, 230, 0.7);
  --error-color: #c0392b;
  --toast-bg: #9a8000;
}

[data-theme="notgreen4"] {
  --brand: #ffccff;
  --brand-mid: #f0a8f0;
  --brand-dark: #c055c0;
  --bg: #ffe8ff;
  --bg2: #ffd0ff;
  --text: #2e1a2e;
  --text-muted: #6a4a6a;
  --glass-bg: rgba(255, 204, 255, 0.45);
  --glass-border: rgba(192, 85, 192, 0.25);
  --glass-shadow: rgba(192, 85, 192, 0.12);
  --btn-primary: #9b2295;
  --btn-primary-h: #7d1a77;
  --chip-bg: rgba(255, 204, 255, 0.55);
  --chip-border: rgba(192, 85, 192, 0.3);
  --result-bg: rgba(255, 240, 255, 0.7);
  --error-bg: rgba(255, 230, 230, 0.7);
  --error-color: #c0392b;
  --toast-bg: #9b2295;
}

[data-theme="notgreen5"] {
  --brand: #ccffff;
  --brand-mid: #a8f0f0;
  --brand-dark: #0097a7;
  --bg: #e8ffff;
  --bg2: #d0ffff;
  --text: #1a2e2e;
  --text-muted: #4a6a6a;
  --glass-bg: rgba(204, 255, 255, 0.45);
  --glass-border: rgba(0, 151, 167, 0.25);
  --glass-shadow: rgba(0, 151, 167, 0.12);
  --btn-primary: #0087a0;
  --btn-primary-h: #006a80;
  --chip-bg: rgba(204, 255, 255, 0.55);
  --chip-border: rgba(0, 151, 167, 0.3);
  --result-bg: rgba(240, 255, 255, 0.7);
  --error-bg: rgba(255, 230, 230, 0.7);
  --error-color: #c0392b;
  --toast-bg: #0087a0;
}

[data-theme="white"] {
  --brand: #f0fff0;
  --brand-mid: #e0f0e0;
  --brand-dark: #6a9a6a;
  --bg: #f7fff7;
  --bg2: #eef9ee;
  --text: #1a2e1a;
  --text-muted: #4a6a4a;
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(106, 154, 106, 0.2);
  --glass-shadow: rgba(106, 154, 106, 0.1);
  --btn-primary: #5a8a5a;
  --btn-primary-h: #496a49;
  --chip-bg: rgba(240, 255, 240, 0.7);
  --chip-border: rgba(106, 154, 106, 0.25);
  --result-bg: rgba(248, 255, 248, 0.8);
  --error-bg: rgba(255, 230, 230, 0.7);
  --error-color: #c0392b;
  --toast-bg: #5a8a5a;
}

/* ===== BODY BG ===== */
body {
  background-color: var(--bg);
  color: var(--text);
}

/* ===== GLASSMORPHISM ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 24px var(--glass-shadow), 0 1px 4px rgba(0, 0, 0, 0.06);
  border-radius: 20px;
}

/* ===== APP LAYOUT ===== */
.app {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px 32px;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  margin: 16px 0;
  border-radius: 20px;
  position: sticky;
  top: 12px;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== BUTTONS ===== */
.btn {
  font-family: 'Jua', sans-serif;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  outline: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 12px;
  transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
  text-decoration: none;
  padding: 9px 16px;
  white-space: nowrap;
}

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

.btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn-icon {
  padding: 9px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
}

.btn-icon:hover {
  background: var(--brand-mid);
  border-color: var(--brand-dark);
}

.btn-coffee {
  padding: 9px 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 0.85rem;
}

.btn-coffee:hover {
  background: var(--brand-mid);
  border-color: var(--brand-dark);
}

.btn-label {
  display: inline;
}

.btn-primary {
  background: var(--btn-primary);
  color: #fff;
  padding: 13px 20px;
  font-size: 1rem;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  background: var(--btn-primary-h);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 11px 20px;
}

.btn-secondary:hover {
  background: var(--brand-mid);
  border-color: var(--brand-dark);
}

.btn-action {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
  flex: 1;
  justify-content: center;
  padding: 11px 10px;
  font-size: 0.9rem;
}

.btn-action:hover {
  background: var(--brand-mid);
  border-color: var(--brand-dark);
}

.btn-action svg {
  width: 16px;
  height: 16px;
}

.btn-sm {
  padding: 7px 13px;
  font-size: 0.85rem;
  border-radius: 10px;
}

.btn-danger {
  background: rgba(192, 57, 43, 0.12);
  border: 1px solid rgba(192, 57, 43, 0.25);
  color: #c0392b;
}

.btn-danger:hover {
  background: rgba(192, 57, 43, 0.2);
}

.btn-paste,
.btn-clear-input {
  flex-shrink: 0;
  padding: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: 10px;
}

.btn-paste:hover,
.btn-clear-input:hover {
  background: var(--brand-mid);
  color: var(--text);
}

/* ===== MAIN ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== HERO ===== */
.hero {
  padding: 28px 4px 8px;
  text-align: center;
}

.hero-title {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 10px;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 460px;
  margin: 0 auto;
}

/* ===== CARD ===== */
.card {
  padding: 24px;
}

.card-title {
  font-size: 1rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
  font-weight: 400;
}

.card-title svg {
  width: 18px;
  height: 18px;
}

/* ===== CLEANER CARD ===== */
.cleaner-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-label svg {
  width: 15px;
  height: 15px;
}

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

.url-input {
  flex: 1;
  font-family: 'Jua', sans-serif;
  font-size: 0.95rem;
  background: var(--result-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  outline: none;
  min-width: 0;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.url-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.url-input:focus {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 3px var(--glass-shadow);
}

/* ===== RESULT AREA ===== */
.result-area[hidden],
.error-area[hidden] {
  display: none;
}

.result-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.result-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-label svg {
  width: 15px;
  height: 15px;
  color: var(--brand-dark);
}

.result-box {
  background: var(--result-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 14px;
  word-break: break-all;
}

.result-url {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.result-actions {
  display: flex;
  gap: 8px;
}

/* ===== CHANGES SUMMARY ===== */
.changes-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.change-tag {
  font-size: 0.78rem;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 8px;
  padding: 3px 9px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.change-tag svg {
  width: 12px;
  height: 12px;
  color: var(--brand-dark);
}

/* ===== ERROR AREA ===== */
.error-area {
  background: var(--error-bg);
  border: 1px solid rgba(192, 57, 43, 0.2);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--error-color);
  font-size: 0.9rem;
}

.error-area svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ===== PLATFORMS CARD ===== */
.platforms-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.85rem;
  color: var(--text);
}

.platform-chip svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.chip-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== HISTORY FAB ROW ===== */
.history-fab-row {
  display: flex;
  justify-content: center;
}

.history-count-badge {
  background: var(--brand-dark);
  color: #fff;
  font-size: 0.72rem;
  border-radius: 10px;
  padding: 1px 7px;
  min-width: 22px;
  text-align: center;
}

/* ===== FOOTER ===== */
.footer {
  margin-top: 32px;
  padding: 20px 4px 8px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer a {
  color: var(--brand-dark);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-heart {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-wide {
  max-width: 560px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.05rem;
  color: var(--text);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background 0.15s;
  flex-shrink: 0;
}

.modal-close svg {
  width: 15px;
  height: 15px;
}

.modal-close:hover {
  background: var(--brand-mid);
  color: var(--text);
}

/* ===== THEME GRID ===== */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 18px;
  overflow-y: auto;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font-family: 'Jua', sans-serif;
  font-size: 0.88rem;
  color: var(--text);
  transition: border-color 0.18s, background 0.18s;
  text-align: left;
}

.theme-option:hover {
  background: var(--brand-mid);
  border-color: var(--brand-dark);
}

.theme-option.active {
  border-color: var(--brand-dark);
  background: var(--brand-mid);
}

.theme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.theme-label {
  font-size: 0.85rem;
}

/* ===== HISTORY LIST ===== */
.history-list {
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-empty[hidden] {
  display: none;
}

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text-muted);
  text-align: center;
}

.history-empty svg {
  width: 36px;
  height: 36px;
  opacity: 0.5;
}

.history-empty p {
  font-size: 0.9rem;
}

.history-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-item:hover {
  background: var(--brand-mid);
  border-color: var(--brand-dark);
}

.history-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item-delete {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.history-item-delete svg {
  width: 15px;
  height: 15px;
}

.history-item-delete:hover {
  background: rgba(192, 57, 43, 0.15);
  color: var(--error-color);
  border-color: rgba(192, 57, 43, 0.3);
}

.history-item-original {
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.4;
}

.history-item-original-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.65;
  margin-bottom: 1px;
}

.history-item-cleaned {
  font-size: 0.85rem;
  color: var(--text);
  word-break: break-all;
  line-height: 1.4;
}

.history-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.history-item-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.history-item-platform {
  font-size: 0.72rem;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--text-muted);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--toast-bg);
  color: #fff;
  padding: 11px 22px;
  border-radius: 12px;
  font-family: 'Jua', sans-serif;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 300;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .header {
    padding: 10px 14px;
  }

  .brand-name {
    font-size: 1.15rem;
  }

  .btn-coffee .btn-label {
    display: none;
  }

  .hero {
    padding: 20px 4px 4px;
  }

  .hero-title {
    font-size: 1.7rem;
  }

  .card {
    padding: 18px;
  }

  .result-actions {
    flex-direction: column;
  }

  .btn-action {
    flex: unset;
    width: 100%;
  }

  .theme-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    max-height: 90vh;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}