/* boyaki.css
   Styles for 「ぼやきボタン」 -- the floating voice-grumble feedback button
   (js/boyaki.js builds the DOM this styles; nothing here is in any page's
   HTML). Shares css/app.css's design tokens (--accent/--danger/--surface/
   --ink/--border/--radius/--tap-min/--focus-ring/--shadow) so dark mode and
   the 40-50代 high-contrast/large-tap-target requirements come for free --
   see that file's header. Loaded on all four pages. */

/* -------------------- FAB -------------------- */

.boyaki-fab {
  position: fixed;
  right: 16px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 40; /* above .feedback-footer (no z-index / stacking context) and
                  .phrase-action-bar (30, css/hayakuchi.css), below the
                  eye-training fullscreen overlay (100, css/eye-training.css) */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 64px;
  height: 64px;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
}

.boyaki-fab:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.boyaki-fab-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.boyaki-fab-label {
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.boyaki-fab[data-state="preparing"] {
  opacity: 0.7;
  cursor: default;
}

.boyaki-fab[data-state="recording"] {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* review/sending -- js/boyaki.js also sets the `hidden` attribute directly
   during those states (the bottom sheet takes over that corner of the
   screen); this is a defensive restatement, same convention as
   .phrase-action-bar[hidden] in css/hayakuchi.css. */
.boyaki-fab[hidden] {
  display: none;
}

/* -------------------- status/timer pill -------------------- */

.boyaki-pill {
  position: fixed;
  right: 16px;
  bottom: calc(158px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.boyaki-pill[hidden] {
  display: none;
}

.boyaki-pill-dot {
  display: none;
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--danger);
}

.boyaki-pill.is-recording {
  border-color: var(--danger);
}

.boyaki-pill.is-recording .boyaki-pill-dot {
  display: block;
  animation: boyaki-pulse 1.2s ease-in-out infinite;
}

@keyframes boyaki-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

@media (prefers-reduced-motion: reduce) {
  .boyaki-pill.is-recording .boyaki-pill-dot {
    animation: none;
  }
}

/* -------------------- review bottom sheet -------------------- */

.boyaki-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.boyaki-panel[hidden] {
  display: none;
}

.boyaki-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 16, 16, 0.45);
}

.boyaki-panel-sheet {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  box-shadow: 0 -4px 20px rgba(16, 16, 16, 0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.boyaki-panel-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.boyaki-panel-audio {
  width: 100%;
}

.boyaki-panel-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
  color: var(--ink-2);
}

.boyaki-panel-field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
}

.boyaki-panel-field textarea:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.boyaki-panel-message {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.95rem;
  color: var(--danger);
}

.boyaki-panel-message:empty {
  min-height: 0;
}

.boyaki-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.boyaki-panel-actions .btn {
  flex: 1 1 auto;
  min-width: 100px;
}

/* -------------------- toast -------------------- */

.boyaki-toast {
  position: fixed;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top));
  z-index: 70;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}

.boyaki-toast[hidden] {
  display: none;
}

/* The home menu has no active exercise: don't cover its primary links with
   an idle feedback button. During recording the existing fixed stop stays. */
.hub-app .boyaki-fab[data-state="idle"],
.hub-app .boyaki-fab[data-state="sent"] {
  position: static;
  margin: 16px auto 0;
  width: auto;
  height: auto;
  padding: 14px 22px;
  flex-direction: row;
  border-radius: var(--radius-sm);
}
.hub-app .boyaki-fab[data-state="idle"] .boyaki-fab-label,
.hub-app .boyaki-fab[data-state="sent"] .boyaki-fab-label {
  font-size: 1rem;
}
