:root {
  color-scheme: light;
  color: #111827;
  background: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: #f5f5f7;
  touch-action: manipulation;
}

button,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app {
  min-height: 100vh;
  overflow-x: hidden;
}

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 500px;
  height: 85vh;
  overflow: hidden;
}

.header {
  position: relative;
  z-index: 30;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 18px 72px 18px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
  color: #9ca3af;
}

.header p {
  margin: 4px 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #c0c4cc;
}

.header p span {
  color: #9ca3af;
}

.icon-button {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  transition: transform 160ms ease, background-color 160ms ease;
}

.icon-button:active {
  transform: scale(0.95);
}

.icon-button.danger {
  color: #ef4444;
  background: rgb(239 68 68 / 0.1);
}

.icon-button.neutral {
  color: #4b5563;
  background: #e5e7eb;
}

.help-button {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 0px));
  right: 16px;
  z-index: 55;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgb(229 231 235 / 0.7);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.84);
  color: #4b5563;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.08);
  backdrop-filter: blur(12px);
  font-size: 1rem;
  font-weight: 900;
}

.help-button:active {
  transform: scale(0.95);
}

.tap-area {
  position: relative;
  display: flex;
  flex: 1;
  width: 100%;
}

.tap-button {
  position: relative;
  z-index: 10;
  flex: 1;
  min-width: 0;
  overflow: visible;
  background: transparent;
  outline: none;
  touch-action: manipulation;
}

.tap-button .circle {
  position: absolute;
  top: 50%;
  width: 200vh;
  height: 200vh;
  border-radius: 9999px;
  transform: translateY(-50%);
  transition: transform 300ms ease;
}

.decrement .circle {
  right: 12vw;
  background: #fff;
  box-shadow: 0 0 40px rgb(0 0 0 / 0.04);
}

.increment .circle {
  left: 12vw;
  background: #ffd60a;
  box-shadow: 0 0 50px rgb(255 214 10 / 0.4);
}

.decrement:active .circle {
  transform: translate(-16px, -50%) scale(0.99);
}

.increment:active .circle {
  transform: translate(16px, -50%) scale(0.99);
}

.hero-icon {
  position: absolute;
  top: 50%;
  width: 120px;
  height: 120px;
  stroke-width: 2.5;
  transform: translateY(-50%);
  transition: transform 200ms ease;
}

.minus-icon {
  left: 24px;
  color: #d1d5db;
  filter: drop-shadow(1px 1px 0 rgb(255 255 255)) drop-shadow(-1px -1px 3px rgb(0 0 0 / 0.15));
}

.plus-icon {
  right: 24px;
  color: #d4b000;
  filter: drop-shadow(1px 1px 0 rgb(255 255 255 / 0.4)) drop-shadow(-1px -1px 3px rgb(0 0 0 / 0.15));
}

.decrement:active .hero-icon {
  transform: translate(-8px, -50%) scale(0.9);
}

.increment:active .hero-icon {
  transform: translate(8px, -50%) scale(1.1);
}

.counter-panel {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.time-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  margin-bottom: 24px;
  border: 1px solid rgb(243 244 246 / 0.5);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.8);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.06);
  color: #374151;
  font-size: 1rem;
  font-weight: 800;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d1d5db;
}

.status-dot.active {
  background: #facc15;
  animation: pulse 1.8s ease-in-out infinite;
}

.current-count {
  color: #111827;
  font-size: 8rem;
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.08));
}

.current-count.pop {
  animation: pop 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.history-line {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 24px;
  margin-top: 24px;
  color: #9ca3af;
  font-size: 0.875rem;
  font-weight: 600;
}

.history-line span.fade {
  animation: fade-in 400ms ease-out;
}

.history-line span {
  transition: opacity 220ms ease, transform 220ms ease;
}

.history-line span.is-fading-out {
  opacity: 0;
  transform: translateY(2px);
}

.history-line span.is-fading-in {
  opacity: 1;
  transform: translateY(0);
}

.scroll-cue {
  pointer-events: none;
  position: absolute;
  right: 0;
  bottom: 64px;
  left: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  color: #9ca3af;
  opacity: 0.5;
  animation: bounce 1.4s infinite;
}

.scroll-cue svg {
  width: 24px;
  height: 24px;
}

.details {
  position: relative;
  z-index: 20;
  min-height: 100vh;
  margin-top: -32px;
  padding: 24px 16px 128px;
  border-top: 1px solid rgb(255 255 255 / 0.6);
  border-radius: 48px 48px 0 0;
  background: rgb(255 255 255 / 0.6);
  box-shadow: 0 -10px 50px rgb(0 0 0 / 0.08);
  backdrop-filter: blur(32px);
}

.details-inner {
  max-width: 768px;
  margin: 0 auto;
}

.handle {
  width: 64px;
  height: 6px;
  margin: 0 auto 24px;
  border-radius: 999px;
  background: rgb(209 213 219 / 0.8);
}

.details-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 8px 24px;
}

.details-heading h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: 0;
}

.hour-list {
  display: grid;
  gap: 12px;
}

.slot-add-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 10px auto;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.82);
  color: #9ca3af;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.04);
  transition: opacity 150ms ease, transform 150ms ease, background-color 150ms ease;
}

.slot-add-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.8;
}

.slot-add-button:active {
  transform: scale(0.92);
}

.slot-add-button:disabled {
  cursor: default;
  opacity: 0.28;
  transform: none;
}

.hour-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgb(229 231 235 / 0.62);
  border-radius: 16px;
  background: rgb(255 255 255 / 0.48);
  box-shadow: 0 1px 2px rgb(17 24 39 / 0.03);
  transition: background-color 160ms ease, border-color 160ms ease;
}

.hour-row.current {
  border-color: #fde68a;
  background: rgb(254 252 232 / 0.5);
  box-shadow: 0 1px 4px rgb(250 204 21 / 0.12);
}

.hour-label {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 128px;
  color: #374151;
  font-size: 1.125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hour-row.current .hour-label {
  color: #854d0e;
}

.current-marker {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #facc15;
}

.empty-marker {
  width: 6px;
  height: 6px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 8px;
  border: 1px solid #f3f4f6;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.04);
  touch-action: manipulation;
}

.stepper button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  color: #4b5563;
  background: transparent;
  transition: transform 150ms ease, background-color 150ms ease;
  touch-action: manipulation;
}

.stepper button:last-child {
  color: #111827;
  background: #ffd60a;
}

.stepper button:active {
  transform: scale(0.9);
}

.row-count {
  width: 48px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.preview {
  margin: 48px 0 32px;
}

.preview h3 {
  margin: 0 8px 12px;
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.preview pre {
  min-height: 52px;
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid #f3f4f6;
  border-radius: 16px;
  background: #f9fafb;
  color: #4b5563;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
}

.copy-dock {
  pointer-events: none;
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px));
}

.copy-message {
  min-height: 36px;
  margin-bottom: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 300ms ease, transform 300ms ease;
}

.copy-message.visible {
  opacity: 1;
  transform: translateY(0);
}

.copy-button {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 384px;
  min-height: 60px;
  padding: 16px 24px;
  border: 1px solid rgb(229 231 235 / 0.5);
  border-radius: 16px;
  background: rgb(255 255 255 / 0.82);
  color: #111827;
  box-shadow: 0 12px 32px rgb(156 163 175 / 0.32);
  backdrop-filter: blur(12px);
  font-size: 1.05rem;
  font-weight: 800;
  transition: transform 160ms ease, background-color 300ms ease, color 300ms ease, box-shadow 300ms ease;
}

.copy-button svg {
  margin-right: 8px;
}

.copy-button:active {
  transform: scale(0.95);
}

.copy-button.copied {
  background: rgb(34 197 94 / 0.92);
  color: #fff;
  box-shadow: 0 12px 32px rgb(34 197 94 / 0.25);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.open {
  display: flex;
  animation: fade-in 160ms ease-out;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.4);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 384px;
  max-height: calc(100vh - 32px);
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.25);
}

.help-card {
  max-width: 560px;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-color: #f3f4f6;
  background: rgb(249 250 251 / 0.55);
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid #f3f4f6;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
}

.close-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #f3f4f6;
  border-radius: 999px;
  background: #fff;
  color: #6b7280;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.06);
}

.modal-body {
  max-height: 60vh;
  overflow-y: auto;
  padding: 24px;
}

.help-body {
  display: grid;
  gap: 18px;
  max-height: min(72vh, 720px);
}

.help-item {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 16px;
  align-items: center;
}

.help-item h4 {
  margin: 0 0 6px;
  color: #111827;
  font-size: 1rem;
}

.help-item p {
  margin: 0;
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.55;
}

.help-shot {
  min-height: 112px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #f5f5f7;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.68);
}

.counter-shot {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

.counter-shot::before,
.counter-shot::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 148px;
  height: 148px;
  border-radius: 999px;
  transform: translateY(-50%);
}

.counter-shot::before {
  right: 72px;
  background: #fff;
}

.counter-shot::after {
  left: 72px;
  background: #ffd60a;
}

.shot-minus,
.shot-plus {
  position: relative;
  z-index: 1;
  color: #9ca3af;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
}

.shot-plus {
  color: #b89400;
}

.shot-center {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
}

.shot-time {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.86);
  color: #4b5563;
  font-size: 0.75rem;
  font-weight: 800;
}

.shot-count {
  color: #111827;
  font-size: 3.25rem;
  line-height: 1;
  font-weight: 900;
}

.detail-shot {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.shot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff;
  color: #4b5563;
  font-size: 0.8rem;
}

.shot-row.active {
  border: 1px solid #fde68a;
  background: #fefce8;
  color: #854d0e;
}

.copy-shot {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 14px;
}

.shot-preview {
  padding: 10px;
  border-radius: 10px;
  background: #fff;
  color: #4b5563;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  white-space: nowrap;
}

.shot-copy {
  display: grid;
  place-items: center;
  min-height: 36px;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 800;
}

.settings-shot {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.shot-gear {
  justify-self: end;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #e5e7eb;
}

.shot-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff;
  color: #6b7280;
  font-size: 0.75rem;
}

.shot-setting b {
  color: #111827;
}

.setting-group + .setting-group {
  margin-top: 32px;
}

.setting-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid #f3f4f6;
}

.setting-title h4 {
  margin: 0;
  color: #374151;
}

.marker {
  width: 8px;
  height: 16px;
  border-radius: 999px;
}

.marker.weekday {
  background: #60a5fa;
}

.marker.weekend {
  background: #f472b6;
}

.setting-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 600;
}

.setting-group select {
  min-width: 104px;
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  outline: none;
  background: #f9fafb;
  color: #111827;
  font-weight: 600;
}

.setting-group select:focus {
  border-color: #facc15;
  box-shadow: 0 0 0 3px rgb(250 204 21 / 0.25);
}

.reset-settings-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 32px;
  border: 1px solid rgb(239 68 68 / 0.18);
  border-radius: 12px;
  background: rgb(239 68 68 / 0.08);
  color: #ef4444;
  font-weight: 800;
}

.reset-settings-button:active {
  transform: scale(0.98);
}

.modal-footer {
  gap: 12px;
  padding: 16px;
  border-top: 1px solid #f3f4f6;
}

.secondary-button,
.primary-button {
  flex: 1;
  min-height: 48px;
  border-radius: 12px;
  font-weight: 800;
}

.secondary-button {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #4b5563;
}

.primary-button {
  background: #ffd60a;
  color: #111827;
}

@media (min-width: 640px) {
  .tap-button .circle {
    width: 2500px;
    height: 2500px;
  }

  .decrement .circle {
    right: 120px;
  }

  .increment .circle {
    left: 120px;
  }

  .minus-icon {
    left: 48px;
  }

  .plus-icon {
    right: 48px;
  }

  .current-count {
    font-size: 10rem;
  }
}

@media (max-width: 420px) {
  .header {
    padding-left: 24px;
    padding-right: 64px;
  }

  .help-button {
    right: 12px;
    width: 38px;
    height: 38px;
  }

  .help-item {
    grid-template-columns: 1fr;
  }

  .hero-icon {
    width: 96px;
    height: 96px;
  }

  .current-count {
    font-size: 7rem;
  }

  .hour-row {
    padding: 14px 12px;
    gap: 8px;
  }

  .hour-label {
    width: 88px;
    font-size: 1rem;
  }

  .stepper {
    gap: 8px;
  }
}

@keyframes pop {
  0% {
    opacity: 0.8;
    transform: scale(0.85);
  }
  40% {
    opacity: 1;
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}
