:root {
  --bg-gradient: radial-gradient(circle at top, #1b264f, #090b16);
  --accent: #6c5ce7;
  --accent-strong: #a463f2;
  --accent-soft: rgba(164, 99, 242, 0.25);
  --surface: rgba(13, 17, 36, 0.6);
  --surface-strong: rgba(13, 17, 36, 0.9);
  --text: #f5f7ff;
  --text-muted: rgba(245, 247, 255, 0.6);
  --success: #2ecc71;
  --warning: #f1c40f;
  font-size: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.background-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(108, 92, 231, 0.35), transparent);
  filter: blur(100px);
  z-index: 0;
  pointer-events: none;
  animation: drift 18s ease-in-out infinite alternate;
}

@keyframes drift {
  0% {
    transform: translate(-5%, -5%) scale(1);
  }
  100% {
    transform: translate(5%, 5%) scale(1.1);
  }
}

.app {
  position: relative;
  z-index: 1;
  width: min(960px, 92vw);
  display: grid;
  gap: 2rem;
  padding: 3rem;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0)
    )
    var(--surface);
  border-radius: 32px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
}

.app__header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  font-family: "Orbitron", "Inter", system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app__header p {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.control-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  grid-column: span 2;
}

.field__label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.time-inputs {
  display: contents;
}

.primary-button {
  grid-column: span 2;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(108, 92, 231, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(108, 92, 231, 0.45);
}

.primary-button:disabled {
  background: rgba(118, 122, 170, 0.4);
  cursor: not-allowed;
  box-shadow: none;
}

.reset-button {
  grid-column: span 2;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(21, 26, 46, 0.85);
  color: #eef1ff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(12px);
}

.reset-button:hover:not(:disabled) {
  background: rgba(55, 61, 94, 0.92);
  border-color: rgba(164, 99, 242, 0.35);
  box-shadow: 0 12px 24px rgba(9, 11, 22, 0.35);
  transform: translateY(-1px);
}

.reset-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.link-button {
  grid-column: span 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  border: 1px solid rgba(108, 92, 231, 0.55);
  background: rgba(108, 92, 231, 0.12);
  color: var(--accent-strong);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease,
    color 0.2s ease;
  backdrop-filter: blur(10px);
}

.link-button:hover {
  background: rgba(164, 99, 242, 0.2);
  border-color: rgba(164, 99, 242, 0.6);
  color: #ffffff;
  transform: translateY(-1px);
}

.link-button:active {
  transform: translateY(0);
}

.status-card {
  background: rgba(6, 10, 24, 0.6);
  border-radius: 24px;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 2rem;
}

.status-card__header {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-between;
}

.status-card__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.status-card__task p,
.status-card__clock p {
  margin: 0.6rem 0 0;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 600;
}

.countdown {
  display: grid;
  gap: 1rem;
  justify-items: center;
  text-align: center;
}

.countdown__time {
  font-family: "Orbitron", "Inter", system-ui, sans-serif;
  font-size: clamp(3rem, 6vw, 4.5rem);
  letter-spacing: 0.12em;
}

.countdown__message {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--accent-strong);
  min-height: 1.4em;
}

.progress {
  width: 100%;
  height: 18px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--warning));
  border-radius: 999px;
  transition: width 0.25s linear;
}

.status-card__actions {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
  gap: 1rem;
}

.secondary-button {
  padding: 0.75rem 1.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(13, 17, 36, 0.6);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(12px);
}

.secondary-button:hover {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.15);
  transform: translateY(-1px);
}

.secondary-button:active {
  transform: translateY(0);
}

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

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  display: none;
}

.confetti span {
  position: absolute;
  width: 12px;
  height: 18px;
  background: linear-gradient(135deg, var(--accent), var(--success));
  top: -20px;
  opacity: 0;
  animation: fall 2.4s ease-in forwards;
  transform: rotate(0deg);
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
  transform: translateY(120vh) rotate(360deg);
  opacity: 0;
}
}

body.immersive .app__header,
body.immersive .control-panel {
  display: none;
}

body.immersive .app {
  width: min(760px, 90vw);
  padding: clamp(2.2rem, 5vw, 3.2rem);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.immersive .status-card {
  width: 100%;
  padding: clamp(2.4rem, 6vw, 3.4rem);
  background: rgba(6, 10, 24, 0.82);
  border-radius: 32px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
}

body.immersive .countdown__time {
  font-size: clamp(4rem, 10vw, 6rem);
}

body.immersive .countdown__message {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
}

body.immersive .progress {
  height: 20px;
}

body.immersive .background-glow {
  opacity: 0.95;
  filter: blur(160px);
}

body.immersive .status-card__actions {
  margin-top: clamp(1.8rem, 4vw, 2.6rem);
}

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

  .control-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .app {
    padding: 1.6rem;
  }

  .control-panel {
    grid-template-columns: 1fr;
  }

  .field {
    grid-column: span 1;
  }

  .primary-button,
  .text-button,
  .reset-button,
  .link-button {
    grid-column: span 1;
  }
}
