/* Voice Webapp Phase 1.2 - 3-button direct genre UI / dark theme */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #0d0f12;
  color: #e6e8eb;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Yu Gothic UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* === Main / 3 genre buttons === */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  gap: 12px;
}

.genre-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.genre-btn {
  width: 100%;
  min-height: 130px;
  border-radius: 18px;
  border: none;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  padding: 12px 16px;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s, background 0.15s;
  -webkit-user-select: none;
  user-select: none;
  font-family: inherit;
}

.genre-btn:active { transform: scale(0.98); }

/* idle colors per genre */
.genre-btn[data-genre="idea"] { background: #2f9e64; box-shadow: 0 6px 22px rgba(47, 158, 100, 0.30); }
.genre-btn[data-genre="task"] { background: #2d77c4; box-shadow: 0 6px 22px rgba(45, 119, 196, 0.30); }
.genre-btn[data-genre="memo"] { background: #8a6cc8; box-shadow: 0 6px 22px rgba(138, 108, 200, 0.30); }

/* recording: 押下中ジャンルだけ赤・パルス */
.genre-btn.rec {
  background: #d93b3b !important;
  box-shadow: 0 8px 32px rgba(217, 59, 59, 0.45) !important;
  animation: pulse 1.4s infinite;
}

/* sending: グレーアウト */
.genre-btn.busy {
  background: #4a5260 !important;
  box-shadow: none !important;
  cursor: wait;
}

/* disabled: 録音中の他ジャンル */
.genre-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(217, 59, 59, 0.45); }
  50% { box-shadow: 0 8px 32px rgba(217, 59, 59, 0.75), 0 0 0 8px rgba(217, 59, 59, 0.18); }
}

.genre-icon {
  font-size: 36px;
  line-height: 1;
}

.genre-label {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.genre-state {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
  letter-spacing: 0.04em;
}

.interim {
  min-height: 60px;
  width: 100%;
  text-align: center;
  font-size: 20px;
  line-height: 1.4;
  color: #c4ccd6;
  opacity: 0.85;
  padding: 6px 8px;
  word-break: break-word;
}

.interim.final {
  color: #ffffff;
  opacity: 1;
}

.cancel-btn {
  width: 100%;
  min-height: 52px;          /* WCAG 2.5.5 (44px) / Material (48px) を超える */
  margin-top: 8px;            /* 録音ボタンとの物理ギャップ */
  background: #2a2f37;
  color: #c4ccd6;
  border: 1px solid #3b4150;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.cancel-btn .cancel-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #98a0aa;
  letter-spacing: 0.02em;
}

.cancel-btn:active {
  background: #3b4150;
  transform: scale(0.98);
}

.cancel-btn:disabled {
  opacity: 0.4;
  cursor: wait;
}

.cancel-btn[hidden] {
  display: none;
}

/* === Toast (ephemeral feedback) === */
.toast {
  position: fixed;
  left: 50%;
  bottom: 38vh;
  transform: translateX(-50%) translateY(8px);
  background: rgba(20, 24, 29, 0.95);
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 22px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 100;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.error {
  width: 100%;
  min-height: 0;
  color: #ff8a8a;
  font-size: 14px;
  text-align: center;
  padding: 0 8px;
}

.error:not(:empty) {
  min-height: 24px;
  padding: 8px;
  background: rgba(217, 59, 59, 0.12);
  border-radius: 6px;
}

/* === History === */
.history {
  background: #14181d;
  border-top: 1px solid #232830;
  padding: 14px 16px;
  max-height: 32vh;
  overflow-y: auto;
}

.history h2 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: #98a0aa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#history-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  line-height: 1.4;
  padding: 8px 10px;
  background: #1a1f25;
  border-radius: 6px;
  word-break: break-word;
}

#history-list li.fail {
  background: rgba(217, 59, 59, 0.10);
}

#history-list .status {
  flex-shrink: 0;
  font-size: 16px;
}

#history-list .time {
  flex-shrink: 0;
  color: #98a0aa;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

#history-list .genre {
  flex-shrink: 0;
  color: #98a0aa;
  font-size: 13px;
}

#history-list .text {
  flex: 1;
  min-width: 0;
}

#history-list .retry {
  flex-shrink: 0;
  background: #3b4150;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  min-height: 30px;
}

#history-list .retry:disabled {
  opacity: 0.5;
  cursor: wait;
}

#history-list .empty {
  color: #6e7682;
  font-size: 14px;
  text-align: center;
  padding: 12px;
  background: transparent;
}

/* PC widescreen */
@media (min-width: 720px) {
  body { max-width: 520px; margin: 0 auto; box-shadow: 0 0 0 1px #232830; }
}
