:root {
  --bg:      #f0f2f5;
  --white:   #ffffff;
  --primary: #4a90e2;
  --accent:  #50e3c2;
  --text:    #333333;
  --gray:    #bbbbbb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.container {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 500px;
  padding: 2.5rem 3rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 1.75rem;
  color: var(--text);
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

.mode-selector {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.mode-selector label {
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.mode-selector input {
  margin-right: 0.3rem;
  accent-color: var(--primary);
}

.mode {
  margin-bottom: 1.5rem;
}

.mode label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-weight: 500;
}

.mode input,
.mode textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.mode input:focus,
.mode textarea:focus {
  border-color: var(--primary);
}

.hidden {
  display: none;
}

.buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.btn-primary,
.btn-secondary {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
  transition: box-shadow 0.2s, transform 0.1s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--white);
}

.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(74, 144, 226, 0.3);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--white);
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  box-shadow: 0 6px 16px rgba(74, 144, 226, 0.1);
  transform: translateY(-2px);
}

.clock-button {
  padding: 0.5rem 1rem;
  border: 2px solid var(--primary);
  border-radius: 4px;
  text-decoration: none;
  color: var(--primary);
  transition: background-color 0.3s;
}

.clock-button:hover {
  background-color: var(--accent);
}
.toggle-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

/* スライドトグル */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--gray);
  border-radius: 34px;
  transition: background-color 0.3s;
}

.slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.3s;
}

.switch input:checked + .slider {
  background-color: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(24px);
}

.toggle-label {
  font-size: 0.95rem;
  color: var(--text);
  user-select: none;
}

.result {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
  min-height: 2.5rem;
  margin-bottom: 2rem;
}

.history-container {
  border-top: 1px solid #e0e0e0;
  padding-top: 1.5rem;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.history-header h3 {
  font-size: 1.1rem;
  color: var(--text);
}

.btn-reset {
  background: #e81123;
  color: #fff;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-reset:hover {
  background: #c50f1f;
}

#historyList {
  list-style: disc inside;
  max-height: 120px;
  overflow-y: auto;
  padding-left: 1rem;
  color: var(--text);
  line-height: 1.6;
}

/* モーダル */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--white);
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 380px;
  position: relative;
  text-align: left;
}

.modal-content h2 {
  margin-bottom: 1rem;
  color: var(--text);
}

.modal-content h3 {
  margin: 1rem 0 0.5rem;
  color: var(--text);
}

.modal-content ol {
  padding-left: 1.2rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray);
}