:root {
  --bg: #f4f4f4;
  --card-red-top: #ff5555;
  --card-red-mid: #ee2020;
  --card-red-bottom: #bd0707;
  --card-red-edge: #8f0303;
  --panel-white: #ffffff;
  --text: #111111;
  --shadow-deep: rgba(83, 0, 0, 0.42);
  --shadow-soft: rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: radial-gradient(circle at 50% 0%, #ffffff 0%, #f3f3f3 52%, #e7e7e7 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 30px 18px 42px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-card {
  position: relative;
  isolation: isolate;
  width: min(94vw, 640px);
  min-height: 610px;
  padding: clamp(24px, 4.2vw, 34px) clamp(22px, 4.4vw, 36px) 20px;
  border-radius: 52px;
  border: 2px solid rgba(120, 0, 0, 0.65);
  background:
    radial-gradient(120% 72% at 50% -8%, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0.12) 32%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, var(--card-red-top) 0%, var(--card-red-mid) 32%, #d91313 66%, var(--card-red-bottom) 100%);
  box-shadow:
    0 12px 0 var(--card-red-edge),
    0 26px 34px rgba(0, 0, 0, 0.25),
    inset 0 3px 2px rgba(255, 255, 255, 0.58),
    inset 0 -12px 20px rgba(85, 0, 0, 0.35),
    inset 8px 0 14px rgba(255, 255, 255, 0.08),
    inset -8px 0 14px rgba(80, 0, 0, 0.18);
  overflow: hidden;
}

.timer-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 3px 12px auto;
  height: 38%;
  border-radius: 44px 44px 48% 48%;
  background: linear-gradient(180deg, rgba(255,255,255,0.19), rgba(255,255,255,0));
  pointer-events: none;
}

.timer-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 8%;
  right: 8%;
  bottom: 14px;
  height: 24px;
  border-radius: 50%;
  background: rgba(80, 0, 0, 0.2);
  filter: blur(12px);
  pointer-events: none;
}

.display-panel {
  position: relative;
  background: linear-gradient(180deg, #ffffff 0%, #fdfdfd 58%, #eeeeee 100%);
  border-radius: 32px;
  padding: clamp(26px, 5vw, 36px) 14px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 7px 0 rgba(117, 0, 0, 0.32),
    0 13px 20px rgba(70, 0, 0, 0.26),
    inset 0 3px 3px rgba(255, 255, 255, 1),
    inset 0 -5px 9px rgba(0, 0, 0, 0.12),
    inset 0 0 0 1px rgba(0,0,0,0.06);
}

.display-panel::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 8%;
  right: 8%;
  height: 24%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0));
  pointer-events: none;
}

.time-text {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: clamp(4.2rem, 11vw, 7.7rem);
  font-weight: 520;
  color: #000000;
  letter-spacing: 0.018em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}

.status-text {
  margin: 19px 0 19px;
  text-align: center;
  color: #ffffff;
  font-size: clamp(1rem, 2.8vw, 1.18rem);
  font-weight: 800;
  min-height: 1.6em;
  text-shadow: 0 2px 3px rgba(90, 0, 0, 0.55);
}

.main-button,
.round-button,
.reset-button {
  border: 1px solid rgba(0, 0, 0, 0.14);
  cursor: pointer;
  color: #000000;
  background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 38%, #e8e8e8 100%);
  box-shadow:
    0 7px 0 #bdbdbd,
    0 12px 16px rgba(70, 0, 0, 0.3),
    inset 0 2px 2px rgba(255,255,255,1),
    inset 0 -3px 5px rgba(0,0,0,0.12);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.main-button:hover,
.round-button:hover,
.reset-button:hover {
  filter: brightness(1.02);
}

.main-button:active,
.round-button:active,
.reset-button:active {
  transform: translateY(5px);
  box-shadow:
    0 2px 0 #b6b6b6,
    0 5px 8px rgba(70, 0, 0, 0.26),
    inset 0 2px 2px rgba(255,255,255,0.85),
    inset 0 -2px 4px rgba(0,0,0,0.13);
}

.main-button:disabled,
.round-button:disabled,
.reset-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow:
    0 4px 0 #bdbdbd,
    0 8px 10px rgba(70, 0, 0, 0.18),
    inset 0 2px 2px rgba(255,255,255,0.9);
}

.main-button {
  width: min(100%, 448px);
  min-height: 92px;
  padding: 0 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  font-size: clamp(1.52rem, 3.5vw, 2.05rem);
  font-weight: 850;
}


#buttonLabel {
  display: inline-block;
  font-size: 0.92em;
  line-height: 1.12;
  white-space: nowrap;
}

.play-icon {
  font-size: 1.08em;
  line-height: 1;
  display: inline-block;
  width: 1.1em;
  text-align: center;
}

.sub-controls {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(84px, 112px) minmax(170px, 240px) minmax(84px, 112px);
  gap: 17px;
  justify-content: center;
  align-items: center;
}

.round-button {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 50%;
  font-size: clamp(2.1rem, 6vw, 3.25rem);
  font-weight: 850;
}

.reset-button {
  min-height: 90px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  font-weight: 850;
}

.timer-footer {
  margin-top: 30px;
  padding: 11px 12px 8px;
  text-align: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.timer-footer a {
  color: #ffffff;
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: none;
  filter: none;
}

.timer-footer a:hover,
.timer-footer a:focus-visible {
  color: #ffffff;
  opacity: 0.86;
  text-decoration: underline;
  outline: none;
}

.ad-wrap {
  width: min(94vw, 640px);
  margin: -18px auto 24px;
  padding: 0 18px;
}

.ad-panel {
  width: 100%;
  margin: 0 auto;
  padding: 0;
  border: 1px solid #d7e6f8;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.ad-panel[hidden] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.ad-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: #f4f8ff;
  border-bottom: 1px solid #d7e6f8;
}

.ad-label,
.ad-wait {
  font-size: 0.74rem;
  color: #4f6f91;
  line-height: 1.3;
}

.ad-close-btn {
  margin: 0 !important;
  padding: 4px 9px !important;
  min-height: 0;
  line-height: 1.2;
  border: none;
  border-radius: 999px;
  background: #1565c0;
  color: #ffffff;
  font-size: 0.74rem !important;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.ad-close-btn:hover {
  background: #0d47a1;
}

.ad-body {
  padding: 8px;
  background: #ffffff;
}

.ad-body .adsbygoogle {
  display: block;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px 12px 34px;
  }

  .timer-card {
    width: min(96vw, 560px);
    min-height: 0;
    border-radius: 40px;
    padding: 20px 18px 17px;
    box-shadow:
      0 9px 0 var(--card-red-edge),
      0 20px 26px rgba(0, 0, 0, 0.22),
      inset 0 3px 2px rgba(255, 255, 255, 0.54),
      inset 0 -10px 18px rgba(85, 0, 0, 0.32);
  }

  .display-panel {
    border-radius: 26px;
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .main-button {
    min-height: 82px;
    font-size: 1.42rem;
    gap: 8px;
    padding: 0 14px;
  }

  .sub-controls {
    grid-template-columns: 88px minmax(140px, 1fr) 88px;
    gap: 12px;
  }

  .reset-button {
    min-height: 84px;
  }

  .timer-footer {
    margin-top: 25px;
    padding-top: 14px;
  }

  .ad-wrap {
    width: min(96vw, 560px);
    padding: 0 12px;
  }
}

@media (max-width: 440px) {
  .timer-card {
    border-radius: 34px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .sub-controls {
    grid-template-columns: 76px minmax(126px, 1fr) 76px;
    gap: 10px;
  }

  .main-button {
    gap: 6px;
    min-height: 74px;
    font-size: 1.22rem;
    padding: 0 12px;
  }

  #buttonLabel {
    font-size: 0.88em;
  }

  .reset-button {
    font-size: 1.52rem;
    min-height: 74px;
  }

  .round-button {
    font-size: 2.35rem;
  }

  .timer-footer a {
    font-size: 0.9rem;
  }
}
