:root {
  --bg: #101018;
  --card: #1a1b29;
  --card-2: #222437;
  --text: #f7f2ff;
  --muted: #c9bfd8;
  --accent: #ffcc66;
  --danger: #ff6b8a;
  --ok: #9dffb0;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 204, 102, 0.18), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(255, 107, 138, 0.16), transparent 32rem),
    var(--bg);
}

.refresh-warning {
  margin-top: 1rem;
  font-weight: bold;
  background-color: #ff6b8a;
  border-radius: 20px;
  text-align: center;
  padding: 1%;
  color: #222437;
  font-size: 20px;
}

.app {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: linear-gradient(145deg, var(--card), var(--card-2));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.hero { text-align: center; }

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 8vw, 5rem);
  line-height: 0.95;
}

.subtitle {
  margin: 16px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 3vw, 1.25rem);
}

.settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  align-items: center;
}

label {
  font-weight: 800;
  color: var(--muted);
}

select,
input,
button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  padding: 0 16px;
  font: inherit;
}

select,
input {
  color: var(--text);
  background: #10111d;
  outline: 2px solid rgba(255, 255, 255, 0.08);
}

select:focus,
input:focus {
  outline-color: var(--accent);
}

.now-card { text-align: center; }

.now-card p { margin: 6px 0; color: var(--muted); }

.current-time {
  color: var(--accent) !important;
  font-weight: 900;
  font-size: clamp(2.4rem, 12vw, 6rem);
  line-height: 1;
}

.result { text-align: center; }

.label {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 800;
}

.remaining-time {
  font-size: clamp(3.2rem, 16vw, 8rem);
  font-weight: 950;
  line-height: 1;
  color: var(--ok);
  text-shadow: 0 0 22px rgba(157, 255, 176, 0.18);
}

.end-time { color: var(--muted); }

.message {
  margin: 18px auto 0;
  max-width: 720px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-weight: 850;
}

.hidden {
  display: none !important;
}

#message {
  white-space: pre-line;
}

.message.done {
  color: var(--danger);
  
}

.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

#secretCounter {
  width: auto;
  min-width: 54px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
}

#message {
    white-space: pre-line;
}

.back-link{
  display: block;
  margin-bottom: 15px;
  color: #fff;
  text-decoration: none;
  width: 100%;
  text-align: center;
}

.hidden { display: none; }

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(1deg); }
  75% { transform: rotate(-1deg); }
}

@media (max-width: 680px) {
  .app { padding: 14px; }
  .card { padding: 18px; border-radius: 20px; }
  .settings { grid-template-columns: 1fr; }
  label { margin-top: 4px; }
  select, input, button { min-height: 58px; font-size: 1.05rem; }
}

.mode-group {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.mode-title {
  grid-column: 1 / -1;
  margin: 0;
  font-weight: 900;
  color: var(--muted);
}

.week-result{
  text-align: center;
  white-space: pre-line;
}

.radio-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
  align-items: start;
  padding: 16px;
  border-radius: 18px;
  background: #10111d;
  outline: 2px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.radio-card:has(input:checked) {
  outline-color: var(--accent);
}

.radio-card input {
  width: auto;
  min-height: auto;
  margin-top: 4px;
}

.radio-card span {
  font-weight: 900;
  color: var(--text);
}

.radio-card small {
  grid-column: 2;
  color: var(--muted);
}

@media (max-width: 680px) {
  .mode-group { grid-template-columns: 1fr; }
}


.freedom-progress {
  max-width: 720px;
  margin: 22px auto 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 900;
}

.progress-header strong {
  color: var(--accent);
}

.progress-bar {
  height: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  outline: 2px solid rgba(255, 255, 255, 0.08);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ok), var(--accent));
  transition: width 0.4s ease;
}

.almost-free {
  margin: 14px auto 0;
  color: var(--accent);
  font-weight: 900;
  font-size: clamp(1rem, 3vw, 1.35rem);
}

.confetti-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 9999;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 4px;
  animation: confetti-fall 2.4s linear forwards;
}

.confetti-piece:nth-child(3n) { background: var(--accent); }
.confetti-piece:nth-child(3n+1) { background: var(--ok); }
.confetti-piece:nth-child(3n+2) { background: var(--danger); }

@keyframes confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
