* {
  box-sizing: border-box;
}

:root {
  --cream: #f8f1df;
  --paper: #fffdf6;
  --brown: #634832;
  --orange: #d88a45;
  --green: #66845b;
  --border: #e6d8bc;
  --text: #493b2d;
}

body {
  margin: 0;
  padding: 16px;
  background: var(--cream);
  color: var(--text);
  font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
}

button, input {
  font: inherit;
}

.app {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px 20px;
}

.header-mark {
  font-size: 38px;
}

.app-header h1 {
  margin: 0;
  color: var(--brown);
  font-size: 25px;
  font-weight: 800;
}

.app-header p {
  margin: 4px 0 0;
  color: #92775a;
  font-size: 13px;
}

section {
  margin-bottom: 16px;
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 3px 10px rgba(85, 59, 35, 0.05);
}

section h2 {
  margin: 0 0 16px;
  color: var(--brown);
  font-size: 17px;
}

.flight {
  order: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.gourd {
  font-size: 31px;
  transform: rotate(-25deg);
}

.flight-arrow {
  color: #bd8349;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 3px;
}

.timer {
  order: 1;
}

.phone {
  position: absolute;
  right: -5px;
  top: 4px;
  font-size: 20px;
}

.scene-note {
  margin: 10px 0 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
}

.howto-steps {
  margin: 14px 0 0;
  padding-left: 24px;
  font-size: 13px;
  line-height: 2;
}

.distance-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.distance-btn {
  padding: 12px 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffaf0;
  color: var(--brown);
  font-weight: bold;
  cursor: pointer;
}

.distance-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.distance-panel label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: bold;
}

#custom-distance {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  font-size: 18px;
}

.hint {
  margin: 7px 0 0;
  color: #99866e;
  font-size: 11px;
}

.timer-panel {
  text-align: center;
}

.timer-display {
  margin: 12px 0 20px;
  color: var(--brown);
  font-size: clamp(44px, 12vw, 64px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.timer-display span {
  margin-left: 6px;
  font-size: 17px;
}

.start-stop-btn {
  width: min(220px, 75%);
  aspect-ratio: 1;
  border: 7px solid #f0dfc2;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 30px;
  font-weight: 800;
  box-shadow: 0 7px 0 #496542;
  cursor: pointer;
  touch-action: manipulation;
}

.start-stop-btn.running {
  background: #bd6048;
  box-shadow: 0 7px 0 #914533;
}

.start-stop-btn:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 #496542;
}

.timer-message {
  min-height: 22px;
  margin: 18px 0 0;
  color: #8c755b;
  font-size: 13px;
}

.result-panel {
  text-align: center;
}

.speed-display {
  margin: 8px 0 4px;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

#speed-value {
  font-size: clamp(52px, 14vw, 72px);
  font-weight: 900;
}

.speed-unit {
  margin-left: 5px;
  font-size: 19px;
  font-weight: bold;
}

#result-detail {
  color: #917c62;
  font-size: 12px;
}

.result-actions {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.result-actions button {
  width: 100%;
  padding: 13px;
  border: 0;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
}

.secondary-btn {
  background: #eee6d8;
  color: var(--brown);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.precision-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #eaf0e3;
  border-color: #cddbc1;
}

.precision-icon {
  font-size: 38px;
}

.precision-content h2 {
  margin: 0 0 7px;
  font-size: 15px;
}

.precision-content p {
  margin: 0 0 9px;
  font-size: 12px;
  line-height: 1.7;
}

.precision-content a {
  color: #3e7042;
  font-size: 13px;
  font-weight: bold;
}

footer {
  padding: 10px 4px 24px;
  text-align: center;
  color: #9b896f;
  font-size: 11px;
  line-height: 1.8;
}

@media (max-width: 380px) {
  body {
    padding: 9px;
  }

  section {
    padding: 15px;
  }

  }
