@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;800&display=swap");

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

:root {
  --bg: #0f1115;
  --card: #1c1f26;
  --text: #ffffff;
  --muted: #a0a0a0;
  --accent: linear-gradient(90deg, #4facfe, #00f2fe);
  --accent-solid: #4facfe;
  --progress-bg: rgba(255, 255, 255, 0.1);
}

body {
  font-family: "Manrope", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 20px;
  transition: background 0.4s ease, color 0.4s ease;
}

body.sunset {
  --bg: #3b160b;
  --card: #4a2212;
  --text: #ffe6d1;
  --muted: #efc29b;
  --accent: linear-gradient(90deg, #ff9a4a, #ff5a2a);
  --accent-solid: #ff9a4a;
  --progress-bg: rgba(255, 255, 255, 0.08);
}

body.green {
  --bg: #102218;
  --card: #1a2e22;
  --text: #e7fff0;
  --muted: #b2d3be;
  --accent: linear-gradient(90deg, #63c243, #b0ea78);
  --accent-solid: #63c243;
}

body.beige {
  --bg: #d8c3a5;
  --card: #c8ad8d;
  --text: #3e2f23;
  --muted: #4b3a2e;
  --accent: linear-gradient(90deg, #d4a373, #b08968);
  --accent-solid: #b08968;
  --progress-bg: rgba(0,  0, 0, 0.08);
}

.app-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  justify-content: center;
}

.tool-note {
  max-width: 420px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

.container {
  width: 100%;
  max-width: 420px;
}

.card {
  background: var(--card);
  padding: 30px;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transition: background 0.4s ease;
}

.tool-title {
  text-align: center;
  margin-bottom: 25px;
  font-size: 22px;
  font-weight: 600;
}

.field {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}

input:focus {
  outline: 2px solid rgba(255, 255, 255, 0.2);
  outline-offset: 1px;
}

input:hover {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.duration {
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}

.duration.error {
  color: #d9534f;
  font-weight: 600;
}

#percent {
  text-align: center;
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -2px;
  margin-top: 20px;
}

.remaining {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
}

.progress-container {
  width: 100%;
  height: 8px;
  background: var(--progress-bg);
  border-radius: 20px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.5s ease;
}

.theme-switcher {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.theme-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.25s ease;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-btn[data-theme="dark"] {
  background: linear-gradient(135deg, #2b2f3a, #1c1f26);
}

.theme-btn[data-theme="sunset"] {
  background: linear-gradient(135deg, #ff9a3c, #ff5e13);
}

.theme-btn[data-theme="green"] {
  background: linear-gradient(135deg, #56ab2f, #a8e063);
}

.theme-btn[data-theme="beige"] {
  background: linear-gradient(135deg, #d4a373, #b08968);
}

.theme-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.theme-btn.active {
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.25);
}

.install-button {
  position: fixed;
  top: 20px;
  right: 20px;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
  z-index: 1001;
}

.install-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.install-button:active {
  transform: scale(0.96);
}

body:not(.sunset):not(.green):not(.beige) .install-button {
  background: linear-gradient(135deg, #2563eb, #1e3a8a);
}

.install-logo {
  width: 20px;
  height: 20px;
}

.install-help {
  position: fixed;
  top: 15px;
  left: 15px;
  max-width: 240px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.4;
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  text-align: left;
}

.install-help-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.install-help-body b {
  color: var(--accent-solid);
}

.sound-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--card);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  z-index: 1002;
}

.sound-toggle:hover,
.sound-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12), 0 10px 24px rgba(0, 0, 0, 0.25);
}

.sound-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-toggle.muted .sound-wave {
  opacity: 0.2;
}

.sound-tooltip {
  position: absolute;
  right: 52px;
  bottom: 50%;
  transform: translateY(50%);
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.sound-toggle.show-tooltip .sound-tooltip,
.sound-toggle:hover .sound-tooltip,
.sound-toggle:focus-visible .sound-tooltip {
  opacity: 1;
}

.seo-content {
  width: 100%;
  max-width: 900px;
  margin: 160px auto 80px;
  padding: 0 20px;
  color: var(--text);
  align-self: stretch;
}

.seo-content h1 {
  font-size: 28px;
  margin-bottom: 12px;
  text-align: left;
}

.seo-content h2 {
  font-size: 20px;
  margin-top: 26px;
  margin-bottom: 8px;
}

.seo-content h3 {
  font-size: 16px;
  margin-top: 16px;
  margin-bottom: 6px;
}

.seo-content p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 10px;
}

.seo-intro {
  font-size: 16px;
  color: var(--text);
  opacity: 0.9;
}

.faq {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: none;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  padding: 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.faq-item.open .faq-answer {
  max-height: 260px;
  padding: 0 14px 12px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.success-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 42px 36px;
  border-radius: 22px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
  transform: scale(0.95);
  opacity: 0;
  animation: fadeScale 0.25s ease forwards;
}

.checkmark {
  font-size: 42px;
  margin-bottom: 18px;
  color: var(--accent-solid);
}

.success-card h2 {
  font-weight: 600;
  margin-bottom: 8px;
}

.success-card p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 26px;
}

.success-card button {
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.success-card button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.time-highlight {
  font-weight: 700;
  color: var(--accent-solid);
  letter-spacing: 0.3px;
}

.countdown-big {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--accent-solid);
}

@keyframes fadeScale {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 600px) {
  body {
    padding: 15px;
    flex-direction: column;
    justify-content: center;
  }

  .container {
    max-width: 100%;
  }

  .card {
    padding: 22px;
    border-radius: 20px;
  }

  #percent {
    font-size: 44px;
  }

  .theme-switcher {
    position: static;
    transform: none;
    flex-direction: row;
    justify-content: center;
    margin-top: 25px;
    gap: 12px;
  }

  .theme-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .seo-content {
    margin: 140px auto 60px;
    padding: 0 16px;
  }
}

@media (orientation: landscape) and (max-width: 900px) {
  body {
    padding: 10px;
  }

  .card {
    padding: 18px;
  }

  #percent {
    font-size: 34px;
  }

  .theme-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .container {
    max-width: min(360px, 92vw);
  }

  .card {
    padding: 16px;
  }

  h1 {
    font-size: 18px;
    margin-bottom: 14px;
  }

  .field {
    margin-bottom: 12px;
  }

  #percent {
    font-size: 30px;
    margin-top: 10px;
  }
}

@media (display-mode: standalone) {
  .seo-content {
    display: none;
  }
  .tool-note {
    display: none;
  }
}

@media (orientation: landscape) and (max-width: 900px) {
  body.guide-visible {
    padding-left: clamp(180px, 30vw, 240px);
  }

  body.guide-visible .install-help {
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    max-width: 200px;
    font-size: 13px;
    padding: 10px 12px;
  }
}
