/* ===== リセット & ベース ===== */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ===== 背景画像 ===== */
img.full-screen {
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
}

/* ===== メインコンテンツ ===== */
.center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  font-family: sans-serif;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}

/* ===== ボタングループ ===== */
.button-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin: 12px 0;
}

/* ===== プライマリボタン ===== */
.primary-btn {
  padding: 10px 22px;
  font-size: 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.95);
  font-weight: bold;
  transition: 0.2s;
}

.primary-btn:hover {
  transform: scale(1.07);
  background: white;
}

/* ===== アイコンボタン ===== */
.icon-btn {
  width: 24px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.icon-btn:hover svg {
  transform: scale(1.02);
  opacity: 0.85;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

/* ===== モードボタン ===== */
.mode-btn {
  padding: 8px 22px;
  font-size: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  font-weight: normal;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.mode-btn:hover {
  color: black;
  background: rgba(255, 255, 255, 0.9);
}

.mode-btn.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  transform: scale(1.03);
}

/* ===== タイマー表示 ===== */
.timer-display {
  font-size: 6em;
  margin: 20px 0;
}

/* ===== トグルボタン ===== */
.toggle-btn {
  width: 120px;
  text-align: center;
  user-select: none;
}

.toggle-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* ===== リロードアイコン ===== */
@keyframes reload-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.reload-icon.spin {
  animation: reload-spin 1s linear;
  transform-origin: 50% 50%;
}

/* ===== モーダルオープンボタン ===== */
.open-modal-image {
  width: 24pt;
  height: 24pt;
  cursor: pointer;
  border-radius: 10px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.open-modal-image:hover {
  transform: scale(1.02);
  opacity: 0.85;
}

/* ===== モーダル ===== */
.custom-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
  z-index: 1000;
}

.custom-modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.custom-modal {
  width: min(500px, 95vw);
  height: min(350px, 85vh);
  background: #1a1a1a;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
  display: flex;
  overflow: hidden;
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}

.custom-modal-overlay.is-open .custom-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ===== モーダルサイドバー ===== */
.custom-modal-sidebar {
  width: 90px;
  background: #1a1a1a;
  color: #e5e7eb;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.custom-modal-sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.custom-modal-sidebar-nav li {
  font-size: 14px;
}

.custom-modal-sidebar-nav button {
  width: 100%;
  text-align: left;
  border-radius: 8px;
  border: none;
  padding: 8px 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.custom-modal-sidebar-nav button:hover {
  background: rgba(148, 163, 184, 0.25);
  transform: translateY(-1px);
}

.custom-modal-sidebar-nav button.is-active {
  background: transparent;
  color: #fff;
  border: 1px solid #fff;
}

/* ===== モーダルメイン ===== */
.custom-modal-main {
  width: 340px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  background: #1a1a1a;
}

.custom-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
  z-index: 10;
}

.custom-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.custom-modal-body {
  flex: 1;
  overflow: auto;
  font-size: 14px;
  color: #e5e7eb;
  padding: 14px 16px;
  background: #1a1a1a;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #e5e7eb;
}

.section-content {
  font-size: 14px;
  line-height: 1.6;
}

/* ===== セレクトボックス ===== */
.theme-select {
  width: 100%;
  max-width: 200px;
  padding: 12px 16px;
  padding-right: 40px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #4a4a4a;
  border-radius: 6px;
  background: #2a2a2a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e5e7eb' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  color: #e5e7eb;
  cursor: pointer;
  appearance: none;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.theme-select:hover {
  border-color: #6a6a6a;
  background-color: #333333;
}

.theme-select:focus {
  outline: none;
  border-color: #6a6a6a;
  background-color: #2a2a2a;
}

/* セレクトボックスのオプションスタイル */
.theme-select option {
  background: #2a2a2a;
  color: #e5e7eb;
  padding: 8px;
}

.theme-select option:checked,
.theme-select option:hover {
  background: #ffb3a7;
  color: #1a1a1a;
}

/* ===== タイマー入力 ===== */
.timers-container {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.timer-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.timer-label {
  font-size: 14px;
  font-weight: 500;
  color: #e5e7eb;
}

.timer-spinner {
  width: 50%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  background: #2a2a2a;
  color: #e5e7eb;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.timer-spinner:hover {
  border-color: #6a6a6a;
}

.timer-spinner:focus {
  outline: none;
  border-color: #6a6a6a;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.timer-spinner::-webkit-inner-spin-button,
.timer-spinner::-webkit-outer-spin-button {
  opacity: 1;
  height: 20px;
}

/* ===== モーダルフッター ===== */
.custom-modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.btn-reset,
.btn-secondary,
.btn-primary {
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  border: none;
}

.btn-reset {
  background: transparent;
  color: #ef4444;
  border: 1px solid #ef4444;
}

.btn-reset:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn-secondary {
  background: #4a4a4a;
  color: #e5e7eb;
}

.btn-secondary:hover {
  background: #5a5a5a;
}

.btn-primary {
  background: #ffffff;
  color: #1a1a1a;
}

.btn-primary:hover {
  background: #f5f5f5;
}

/* ===== Buy Me a Coffee リンク ===== */
.buymeacoffee-link {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 10;
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.buymeacoffee-link:hover {
  opacity: 1;
}

.buymeacoffee-img {
  width: 40px;
  height: 40px;
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.buymeacoffee-link:hover .buymeacoffee-img {
  transform: scale(1.1);
}

/* ===== フルスクリーンボタン ===== */
.fullscreen-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.fullscreen-btn:hover {
  opacity: 1;
}

.fullscreen-btn img {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
  transition: transform 0.2s ease;
}

.fullscreen-btn:hover img {
  transform: scale(1.15);
}

/* ===== トースト通知 ===== */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-message {
  max-width: min(360px, 90vw);
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.94);
  color: #e5e7eb;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}

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

.toast-message.is-leaving {
  opacity: 0;
  transform: translateY(8px);
}

/* ===== レスポンシブ ===== */
@media (max-width: 640px) {
  .custom-modal {
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

  .custom-modal-sidebar {
    width: 100%;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
  }

  .custom-modal-sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .page-footer {
    bottom: 15px;
  }

  .page-footer a {
    font-size: 12px;
  }
}
