:root {
  --pink: #ff9cbc;
  --white: #ffffff;
  --split-top: 70%;
  --split-bottom: 30%;
  --ui-radius: 28px;
}

.liquid-glass-theme {
  --glass-bg: rgba(255, 255, 255, 0.22);
  --glass-blur: 1px;
  --glass-border-color: rgba(255, 255, 255, 0.26);
  --glass-shadow: 0 6px 22px rgba(31, 38, 135, 0.22);
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--white);
  overflow: hidden;
}

.app {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

.bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.bg-pink {
  background: var(--pink);
  clip-path: polygon(0% 0%, var(--split-top) 0%, var(--split-bottom) 100%, 0% 100%);
  will-change: clip-path;
}

.title {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  font-size: 16vmin;
  user-select: none;
}

.title-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  white-space: nowrap;
  pointer-events: none;
}

.title-left {
  color: var(--white);
  clip-path: polygon(0% 0%, var(--split-top) 0%, var(--split-bottom) 100%, 0% 100%);
  will-change: clip-path;
}

.title-right {
  color: var(--pink);
  clip-path: polygon(var(--split-top) 0%, 100% 0%, 100% 100%, var(--split-bottom) 100%);
  will-change: clip-path;
}

.settings-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--ui-radius);
  cursor: pointer;
  z-index: 3;
}

.liquid-glass-theme .settings-btn {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(120%) contrast(105%);
  border: 1px solid var(--glass-border-color);
  box-shadow: var(--glass-shadow);
}

.settings-btn img {
  width: 24px;
  height: 24px;
}

.settings-panel {
  position: fixed;
  top: 24px;
  right: 24px;
  width: min(300px, 70vw);
  height: auto;
  max-height: 86vh;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(6px);
  box-shadow: -12px 0 24px rgba(0,0,0,0.08);
  transform: translateX(110%);
  transition: transform 200ms ease;
  z-index: 2;
  padding-top: 12px;
  border-radius: var(--ui-radius);
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid transparent;
}

.settings-panel::-webkit-scrollbar {
  display: none;
}

.liquid-glass-theme .settings-panel {
  position: fixed;
  top: 24px;
  right: 24px;
  overflow-y: auto;
  overflow-x: visible;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(120%) contrast(105%);
  border: 1px solid var(--glass-border-color);
  box-shadow: var(--glass-shadow);
}

.liquid-glass-theme .settings-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(135deg, rgba(255, 0, 0, 0.05) 0%, rgba(255, 0, 0, 0) 50%),
    linear-gradient(225deg, rgba(0, 255, 0, 0.05) 0%, rgba(0, 255, 0, 0) 50%),
    linear-gradient(315deg, rgba(0, 0, 255, 0.05) 0%, rgba(0, 0, 255, 0) 50%);
  pointer-events: none;
  z-index: -1;
  border-radius: inherit;
  opacity: 0.35;
  filter: url(#edge-distort-soft);
  will-change: filter, transform;
}

.liquid-glass-theme .settings-panel.edge-hot::before {
  filter: url(#edge-distort-strong);
  opacity: 0.45;
}

.glass-lens {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  border-radius: var(--ui-radius);
  pointer-events: none;
  z-index: 1;
  filter: url(#displacement-filter);
}
.glass-lens.edge-hot {
  filter: url(#displacement-filter);
}
.glass-lens__stage {
  position: absolute;
  width: 100vw;
  height: 100vh;
  filter: url(#displacement-filter);
}
.glass-lens__pink, .glass-lens__white {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.glass-lens__pink {
  background: var(--pink);
  clip-path: polygon(0% 0%, 70% 0%, 30% 100%, 0% 100%);
}
.glass-lens__white {
  background: var(--white);
  clip-path: polygon(70% 0%, 100% 0%, 100% 100%, 30% 100%);
}

.settings-panel.open {
  transform: translateX(0%);
}

.settings-inner {
  display: grid;
  gap: 14px;
  padding: 18px;
  position: relative;
  z-index: 1;
}

.settings-title {
  font-size: 18px;
  font-weight: 700;
}

.settings-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}
.settings-row > span { white-space: nowrap; }
.settings-row.row-range { grid-template-columns: 1fr auto; grid-template-rows: auto auto; }
.settings-row.row-range .slider-container {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  justify-self: stretch;
  margin-left: 0;
}
.settings-row.row-range output { grid-row: 1; justify-self: end; }
.angle-row span { grid-row: 1; grid-column: 1; }
.angle-row output { grid-row: 1; grid-column: 2; }
.settings-row .toggle { justify-self: end; }

.custom-select-wrapper { position: relative; display: inline-block; user-select: none; }
.custom-select-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 300;
  color: var(--text-color);
  height: 36px;
  line-height: 36px;
  background: #ffffff;
  cursor: pointer;
  border-radius: 18px;
  border: 1px solid #E0E0E0;
}
.custom-options {
  position: absolute;
  display: block;
  top: 100%;
  left: 0;
  right: 0;
  min-width: 100%;
  margin-top: 5px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #E0E0E0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transform: scaleY(0);
  transform-origin: top;
  transition: all 0.5s ease;
}
.custom-select.open .custom-options {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scaleY(1);
}
.custom-option {
  position: relative;
  display: block;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 300;
  color: var(--text-color);
  line-height: 36px;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: top;
}
.custom-select.open .custom-option { opacity: 1; transform: scaleY(1); }
.custom-select.open .custom-option:nth-child(1) { transition-delay: 0.05s; }
.custom-select.open .custom-option:nth-child(2) { transition-delay: 0.1s; }
.custom-select.open .custom-option:nth-child(3) { transition-delay: 0.15s; }
.custom-select.open .custom-option:nth-child(4) { transition-delay: 0.2s; }
.custom-select.open .custom-option:nth-child(5) { transition-delay: 0.25s; }
.custom-select.closing .custom-options {
  opacity: 0;
  transform: scaleY(0);
  visibility: hidden;
  pointer-events: none;
  transition-duration: 0.4s;
}
.custom-select.closing .custom-option { opacity: 0; transform: scaleY(0); transition: all 0.2s ease; }
.custom-option:hover { background-color: rgba(255, 255, 255, 0.1); }
.liquid-glass-theme .custom-select-trigger,
.liquid-glass-theme .custom-options {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-color);
  box-shadow: var(--glass-shadow);
}
.liquid-glass-theme .settings-panel select,
.liquid-glass-theme .settings-panel input[type="range"] {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border-color);
  box-shadow: var(--glass-shadow);
}
.settings-panel select:hover { transform: translateY(-1px); }
.settings-panel select:focus { box-shadow: 0 0 0 3px rgba(255,145,180,0.25); border-color: rgba(255,145,180,0.60); }
.settings-panel select option { color: #333; background: #fff; }
.settings-panel output { min-width: 44px; text-align: right; color: #3b3b48; }
.settings-panel input[type="range"] { width: 100%; }

.angle-row {
  transition: max-height 240ms cubic-bezier(0.22, 1, 0.36, 1), opacity 240ms cubic-bezier(0.22, 1, 0.36, 1), transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: max-height, opacity, transform;
  max-height: 64px;
  opacity: 1;
  transform: translateY(0);
}
.angle-row.collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  overflow: hidden;
  pointer-events: none;
}
.angle-row:not(.collapsed) { animation: angleRowPop 320ms cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes angleRowPop {
  0% { transform: translateY(-6px); opacity: 0.0; }
  60% { transform: translateY(2px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

.settings-close {
  justify-self: end;
  padding: 8px 12px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.9);
  cursor: pointer;
}

@supports not (clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%)) {
  .bg-pink { clip-path: none; width: 50%; }
  .title-left, .title-right { clip-path: none; }
}

.settings-panel {
  background: linear-gradient(160deg, rgba(255,255,255,0.88), rgba(255,255,255,0.68));
  backdrop-filter: blur(7px) saturate(1.08) contrast(1.04);
  box-shadow: -14px 0 28px rgba(0,0,0,0.12);
  border-left: none;
  transition: transform 260ms ease;
}
.settings-inner { gap: 12px; padding: 18px; }
.settings-title {
  background: linear-gradient(90deg, #ff8bbd, #ffa4d0 45%, #ffdde9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.settings-group { border: none; padding: 12px 12px; margin: 12px 0; }
.settings-group > legend.settings-title { padding: 0 4px; color: var(--pink); font-weight: 700; }
.settings-group .settings-row { margin: 4px 0; }

.glass-select { position: relative; display: inline-block; min-width: 120px; width: fit-content; }
.settings-row .glass-select { justify-self: center; }
.glass-select__btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 18px;
  border: 1px solid rgba(255,145,180,0.40);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 1px 2px rgba(50,50,80,0.07);
  color: #333;
  min-width: 160px;
  justify-content: center;
  white-space: nowrap;
}
.glass-select.open .glass-select__btn { box-shadow: 0 0 0 3px rgba(255,145,180,0.25); }
.glass-select__list {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  width: max-content;
  min-width: 180px;
  max-width: 260px;
  border-radius: 18px;
  border: 1px solid rgba(200,200,220,0.45);
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.78));
  backdrop-filter: blur(5px) saturate(1.04);
  box-shadow: 0 10px 18px rgba(0,0,0,0.10);
  padding: 6px;
  list-style: none;
  margin: 0;
  opacity: 1;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%);
  clip-path: inset(0 0 100% 0 round 18px);
  transition: clip-path 280ms cubic-bezier(0.22, 1, 0.36, 1), visibility 280ms;
  z-index: 100;
  background-clip: padding-box;
  text-align: center;
}
.glass-select.open .glass-select__list { visibility: visible; pointer-events: auto; clip-path: inset(0 0 0 0 round 18px); }
.glass-select__item { opacity: 1; transform: none; transition: none; }
.glass-select.open .glass-select__item { opacity: 1; transform: translateY(0); transition-delay: calc(var(--i) * 0.05s); }
.glass-select.closing .glass-select__item { opacity: 0; transform: translateY(-10px); transition-delay: calc((var(--options-count) - var(--i) - 1) * 0.05s); }
.glass-select.closing .glass-select__item:nth-child(1) { transition-delay: 160ms; }
.glass-select.closing .glass-select__item:nth-child(2) { transition-delay: 120ms; }
.glass-select.closing .glass-select__item:nth-child(3) { transition-delay: 80ms; }
.glass-select.closing .glass-select__item:nth-child(4) { transition-delay: 40ms; }
.glass-select__item { padding: 8px 12px; border-radius: 10px; color: #333; white-space: nowrap; }
.glass-select__item:hover { background: rgba(255,139,189,0.16); }
.glass-select__item.active { background: rgba(255,139,189,0.22); box-shadow: inset 0 0 0 1px rgba(255,139,189,0.38); }

.slider-container { position: relative; flex: 1; height: 20px; display: flex; align-items: center; margin-left: 12px; }
.slider-track, .slider-progress {
  position: absolute;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  top: 50%;
  transform: translateY(-50%);
  background-color: #E0E0E0;
}
.slider-progress { background-color: var(--accent-color); height: 100%; z-index: 1; width: 0; }
.slider-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: white;
  border: 2px solid var(--accent-color);
  border-radius: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.liquid-glass-theme .slider-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); }
.liquid-glass-theme .slider-progress { background: var(--accent-color); }
.liquid-glass-theme .slider-thumb { background: white; border: none; box-shadow: 0 2px 5px rgba(0,0,0,0.2), inset 0 0 0 1px rgba(255,255,255,0.5); }
.slider-container .input-angle { position: absolute; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 3; }
.slider-thumb { position: absolute; width: 16px; height: 16px; border-radius: 50%; z-index: 1; pointer-events: none; }
.liquid-glass-theme .slider-track { background: rgba(255, 255, 255, 0.2); backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border-color); box-shadow: var(--glass-shadow); }
.liquid-glass-theme .slider-thumb { background: rgba(255, 255, 255, 0.5); border: 1px solid var(--glass-border-color); box-shadow: 0 0 5px rgba(255, 255, 255, 0.5); }

.angle-output { justify-self: end; color: #ff5fa5; font-weight: 600; }
.input-direction { width: 100%; padding: 6px 8px; border-radius: var(--ui-radius); border: 1px solid rgba(255,145,180,0.35); background: rgba(255,255,255,0.9); }
.select-native-hidden { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.input-swap { width: 18px; height: 18px; accent-color: #ff8bbd; }
.settings-btn { background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(255,255,255,0.7)); border: 1px solid rgba(255,145,180,0.4); }

.toggle { position: relative; display: inline-block; }
.toggle input[type="checkbox"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.toggle-track {
  position: relative;
  width: 56px;
  height: 28px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  box-shadow: inset 0 0 0 1px rgba(255,145,180,0.35);
  background: linear-gradient(90deg, rgba(255,80,100,0.35), rgba(255,160,160,0.35));
  transition: background 220ms ease, box-shadow 220ms ease;
  box-sizing: border-box;
  border: 1px solid transparent;
}
.toggle-knob {
  position: absolute;
  top: 2px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 240ms cubic-bezier(.34,1.56,.64,1);
}
.toggle-text { font-size: 13px; font-weight: 800; letter-spacing: 0.02em; user-select: none; transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1); }
.toggle-text.off { color: #ff3b3b; }
.toggle-text.on { color: #22c55e; }
.toggle input[type="checkbox"]:checked + .toggle-track { background: linear-gradient(90deg, rgba(100,220,130,0.35), rgba(170,255,205,0.35)); }
.toggle input[type="checkbox"] + .toggle-track .toggle-text.off { opacity: 1; }
.toggle input[type="checkbox"] + .toggle-track .toggle-text.on { opacity: 0.55; }
.toggle input[type="checkbox"]:checked + .toggle-track .toggle-text.off { opacity: 0.55; }
.toggle input[type="checkbox"]:checked + .toggle-track .toggle-text.on { opacity: 1; }
.toggle input[type="checkbox"]:checked + .toggle-track .toggle-knob { transform: translateX(28px) scale(1.02); }

.liquid-glass-theme .toggle input[type="checkbox"]:not(:checked) + .toggle-track { background: rgba(255, 59, 59, 0.25); }
.liquid-glass-theme .toggle-track { background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border-color); box-shadow: var(--glass-shadow); }
.liquid-glass-theme .toggle-text { font-weight: 800; }
.liquid-glass-theme .toggle-knob { background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border-color); box-shadow: var(--glass-shadow); box-sizing: border-box; top: 2px; }

.contact-list li:nth-child(2) { transition-delay: .2s; }
.liquid-glass-theme .slider-thumb.long-press-effect,
.liquid-glass-theme .toggle-knob.long-press-effect {
  transform: scale(1.5, 1.2) !important;
  box-shadow: 0 0 15px 5px rgba(255, 255, 255, 0.7), inset 0 0 5px rgba(255, 255, 255, 0.5) !important;
  border-radius: 999px !important;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

