/* ===== 共通 ===== */
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f4f4f4;
  color: #222;

  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* ===== コンテナ ===== */
.container {
  background: #ffffff;
  padding: 36px 44px;
  border-radius: 16px;
  text-align: center;
  width: 100%;
  max-width: 420px;
  position: relative;
}

/* ===== ダーク切替ボタン ===== */
#themeToggle {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 22px;
  background: none;
  border: none;
  cursor: pointer;
}

/* ===== 表示 ===== */
#mode {
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 16px;
}

#time {
  font-size: 68px;
  font-weight: 800;
  margin: 24px 0;
}

.buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
}

button {
  font-size: 18px;
  padding: 14px 22px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
}

#start { background: #4caf50; color: #fff; }
#pause { background: #ff9800; color: #fff; }
#reset { background: #f44336; color: #fff; }

/* =========================
   スマホ最適化
   ========================= */
@media (max-width: 480px) {
  body {
    align-items: stretch;
    background: #ffffff;
  }

  .container {
    width: 100%;
    height: 100svh;
    max-width: none;
    padding: 20px 18px 16px;
    border-radius: 0;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  /* 🌙☀️ を右上に大きく */
  #themeToggle {
    top: 10px;
    right: -160px;
    font-size: 32px;   /* ← 大きく */
    z-index: 10;
  }

  #mode {
    font-size: 30px;
    margin-top: 40px; /* ← トグルと被らない */
  }

  #time {
    font-size: min(34vw, 150px);
    font-weight: 800;
    line-height: 1;
    margin: 0;
  }

  .buttons {
    flex-direction: column;
    gap: 16px;
    margin-bottom: env(safe-area-inset-bottom);
  }

  button {
    width: 100%;
    font-size: 24px;
    padding: 20px 0;
    border-radius: 18px;
  }
}

/* =========================
   ダークモード
   ========================= */
body.dark {
  background: #121212;
  color: #eaeaea;
}

body.dark .container {
  background: #1c1c1c;
}

body.dark #start { background: #2e7d32; }
body.dark #pause { background: #ef6c00; }
body.dark #reset { background: #c62828; }
