/* ===== リセット & ベース ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100vw;
  height: 100vh;
  padding: 8px;
  gap: 8px;
  overflow: hidden;
}

/* ===== FF7ウィンドウ ===== */
.ff7-window {
  width: 100%;
  background: linear-gradient(180deg, #0c0c3a 0%, #0a1a3a 50%, #0c0c3a 100%);
  border: 2px solid #8e8e8e;
  box-shadow:
    inset 0 0 0 2px #ffffff,
    inset 0 0 0 3px #737373;
  border-radius: 8px;
  padding: 12px;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #fff;
}

/* ===== キャラエリア ===== */
.char-window {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

#character {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

/* キャラアニメーション */
@keyframes char-float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

@keyframes char-run {
  0%, 100% { transform: translateX(0px); }
  25% { transform: translateX(-2px) rotate(-3deg); }
  75% { transform: translateX(2px) rotate(3deg); }
}

.char-idle,
.char-running,
.char-paused {
  animation: none;
}

/* ===== タイマーウィンドウ ===== */
.timer-window {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
}

.timer-display {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.2rem;
  color: #ffffff;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.6),
    0 0 16px rgba(255, 255, 255, 0.3);
  letter-spacing: 0px;
  transition: color 0.5s ease, text-shadow 0.5s ease, opacity 0.3s ease;
  user-select: none;
}

/* 時間経過による色変化 */
.timer-display.milestone-30m {
  color: #2C6E8A;
  text-shadow:
    0 0 8px rgba(44, 110, 138, 0.8),
    0 0 20px rgba(44, 110, 138, 0.5);
}

.timer-display.milestone-1h {
  color: #FFD700;
  text-shadow:
    0 0 8px rgba(255, 215, 0, 0.8),
    0 0 20px rgba(255, 215, 0, 0.5);
}

/* タイマー停止時は暗くする */
.timer-display.timer-stopped {
  opacity: 0.55;
}

/* マイルストーンフラッシュアニメーション */
@keyframes milestone-flash {
  0%   { opacity: 1; transform: scale(1); }
  20%  { opacity: 0.2; transform: scale(1.05); }
  40%  { opacity: 1; transform: scale(1); }
  60%  { opacity: 0.2; transform: scale(1.05); }
  80%  { opacity: 1; transform: scale(1); }
  100% { opacity: 1; transform: scale(1); }
}

.timer-display.milestone-flash {
  animation: milestone-flash 0.8s ease-in-out;
}

/* タイマー起動時の微振動 */
@keyframes shake {
  0%  { transform: translateX(0); }
  15% { transform: translateX(-3px); }
  30% { transform: translateX(3px); }
  45% { transform: translateX(-2px); }
  60% { transform: translateX(2px); }
  75% { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}

.timer-display.shake {
  animation: shake 0.3s ease-in-out;
}

/* ===== ボタンエリア ===== */
.btn-window {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
}

.ff7-btn {
  flex: 1;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 1.2rem;
  color: #fff;
  background: linear-gradient(180deg, #1a1a5a 0%, #0e0e3a 100%);
  border: 1px solid #8e8e8e;
  box-shadow:
    inset 0 0 0 1px #ffffff,
    inset 0 0 0 2px #737373;
  border-radius: 4px;
  padding: 8px 4px;
  cursor: pointer;
  transition: background 0.1s ease, transform 0.1s ease, filter 0.1s ease;
  position: relative;
  line-height: 1.4;
  letter-spacing: 0.5px;
}

.ff7-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #2a2a7a 0%, #1a1a5a 100%);
  filter: brightness(1.3);
}


.ff7-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
}

/* ボタン押下フィードバック */
.btn-pressed {
  transform: scale(0.95) !important;
  filter: brightness(1.8) !important;
}

/* ===== テキスト入力エリア ===== */
.memo-window {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

#memo {
  width: 100%;
  flex: 1;
  min-height: 80px;
  background: transparent;
  color: #fff;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 1.4rem;
  line-height: 2;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 4px;
  resize: none;
  outline: none;
}

#memo::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

#memo:focus {
  border: none;
  box-shadow: none;
}
