:root {
  --bg-main: #0b0c10;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --accent: #ff9f43;
  --accent-light: #ffd2a6;
  --text-main: rgba(255,255,255,0.95);
  --text-dim: rgba(255,255,255,0.6);
}

* {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

html {
  background: var(--bg-main);
  background-color: var(--bg-main);
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg-main);
  background-color: var(--bg-main);
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  color: var(--text-main);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 600px at 70% 15%, #1b1f2a 0%, var(--bg-main) 60%);
  background-color: var(--bg-main);
  transform: translateZ(0);
}

.app {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.glass {
  width: 340px;
  background: var(--glass-bg);
  backdrop-filter: blur(22px);
  border-radius: 28px;
  padding: 24px;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.55),
    inset 0 0 0 1px rgba(255,255,255,0.08);
}

h1 {
  text-align: center;
  font-weight: 500;
  font-size: 20px;
  margin-bottom: 18px;
}

/* Визуальная индикация фаз */
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== CIRCLE ===== */

.circle-wrapper {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto 26px;
}

svg {
  width: 220px;
  height: 220px;
  transform: rotate(-90deg);
}

circle {
  fill: none;
}

circle.bg {
  stroke: rgba(255,255,255,0.12);
  stroke-width: 10;
}

circle.progress {
  stroke: url(#grad);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 628;
  stroke-dashoffset: 628;
  transition: stroke-dashoffset 0.25s linear;
}

.circle-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#phase {
  font-size: 16px;
  opacity: 0.85;
}

#seconds {
  font-size: 44px;
  font-weight: 600;
  margin-top: 2px;
}

#cycle {
  font-size: 13px;
  opacity: 0.55;
  margin-top: 2px;
}

/* ===== CONTROLS ===== */

.controls {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.row label {
  font-size: 14px;
  color: var(--text-dim);
}

.row input[type="number"] {
  width: 86px;
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  font-size: 16px;
  text-align: center;
  transition: all 0.3s ease;
}

.row .number-input {
  width: 86px;
  background: rgba(255,255,255,0.12);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  font-size: 16px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: text;
  outline: none;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.row .number-input:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
}

.row .number-input:focus {
  background: rgba(255,255,255,0.2);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
}

.row .number-input::before {
  content: "✏️";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.row .number-input:hover::before,
.row .number-input:focus::before {
  opacity: 0.5;
}

/* ===== БОРЬБА С CHROME AUTOCOMPLETE ===== */

/* Скрываем Chrome autocomplete bar */
.number-input::-webkit-credentials-auto-fill-button,
.number-input::-webkit-contacts-auto-fill-button,
.number-input::-webkit-strong-password-auto-fill-button,
.number-input::-webkit-auto-fill-button {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  position: absolute !important;
  right: 0 !important;
  top: 0 !important;
  height: 0 !important;
  width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Скрываем autocomplete suggestions */
.number-input:-webkit-autofill,
.number-input:-webkit-autofill:hover,
.number-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px rgba(255,255,255,0.12) inset !important;
  -webkit-text-fill-color: white !important;
  background-color: rgba(255,255,255,0.12) !important;
}

/* Скрываем autocomplete dropdown */
input::-webkit-contacts-auto-fill-button,
input::-webkit-credentials-auto-fill-button {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ===== SOUND TOGGLE ===== */

.sound-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 14px;
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.switch input:checked + .slider {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* ===== BUTTONS ===== */

.buttons {
  display: flex;
  gap: 10px;
}

button {
  flex: 1;
  padding: 12px;
  border-radius: 16px;
  border: none;
  font-size: 15px;
  cursor: pointer;
}

#start {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #000;
  font-weight: 500;
}

button#stop {
  background: rgba(200, 60, 60, 0.25);
  color: rgba(255, 220, 220, 0.95);
  border: 1px solid rgba(200, 60, 60, 0.35);
  backdrop-filter: blur(6px);
}

button#stop:hover {
  background: rgba(200, 60, 60, 0.35);
}


/* ===== TOTAL TIME ===== */

.total-time {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  opacity: 0.6;
}

/* ===== BACK LINK ===== */

.back-link {
  display: block;
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--accent-light);
  text-decoration: none;
  opacity: 0.8;
}

.back-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.donate-link {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 14px;
  color: #111;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  font-weight: 600;
}

.donate-link:hover {
  filter: brightness(1.04);
}

.donate-link--outside {
  width: 100%;
  margin-top: 0;
}

.donate-link-wrap {
  width: min(340px, calc(100vw - 40px));
  padding: 0 24px;
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.instruction-link {
  display: block;
  text-align: center;
  font-size: 14px;
  color: var(--accent-light);
  text-decoration: none;
  opacity: 0.82;
}

.instruction-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.completion-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.completion-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.completion-modal__card {
  width: min(320px, 100%);
  background: rgba(23, 24, 30, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.55);
  padding: 18px;
  text-align: center;
}

.completion-modal__card h2 {
  margin: 0 0 14px 0;
  font-size: 18px;
  font-weight: 600;
}

#completionContinue {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: #111;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  cursor: pointer;
}

/* ===== MOBILE ===== */

@media (max-width: 380px) {
  .glass {
    width: 100%;
    border-radius: 24px;
  }
}
