/* Feed 'em — see design/feedem-design.html (the design IS the spec, per STYLE.md) */

@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/fredoka-hebrew.woff2") format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/fredoka-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/fredoka-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/fredoka-hebrew.woff2") format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/fredoka-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/fredoka-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Author rules that set `display` on a class (e.g. .overlay-wrap {
 * display: flex }) otherwise beat the UA stylesheet's [hidden]{display:none}
 * at equal specificity, since author-origin rules always win over UA-origin
 * rules in the cascade regardless of source order. Every element app.js
 * toggles via .hidden needs this to actually disappear.
 */
[hidden] { display: none !important; }

:root {
  --ink: #2d2a26;
  --ink-secondary: #4a453e;
  --ink-tertiary: #6b6459;
  --card-bg: #faf7f2;
  --page-bg: #1a1a1a;
  --log-bg: #141210;
  --log-text: #f5f1ea;
  --accent: #3e7c4f;
  --accent-hover: #356b43;
  --live: #9edab0;
  --live-dot: #e05252;
  --muted: #9b948b;
  --muted-hover: #c9c3ba;
  --border-hairline: rgba(255, 255, 255, 0.08);
}

html, body {
  height: 100%;
  background: var(--page-bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI Rounded",
    ui-rounded, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes birdHop { 0%, 100% { transform: translateX(0) rotate(-8deg); } 50% { transform: translateX(3px) rotate(8deg); } }
@keyframes liveFlash { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page-bg);
}

/* ---------- Top bar ---------- */

.topbar {
  height: 84px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  padding: 0 28px;
  background: var(--page-bg);
  border-bottom: 1px solid var(--border-hairline);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: flex-start;
}

.wordmark {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 34px;
  color: var(--card-bg);
  letter-spacing: 0.3px;
  display: flex;
  align-items: baseline;
}

.wordmark__apostrophe { position: relative; }

.wordmark__bird {
  position: absolute;
  top: -9px;
  left: 19px;
  font-size: 18px;
  display: inline-block;
  animation: birdHop 1.6s ease-in-out infinite;
}

.divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
}

.live-indicator { display: flex; align-items: center; gap: 7px; }

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--live-dot);
  display: inline-block;
  animation: liveFlash 1.2s ease-in-out infinite;
}

.live-text {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--live);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.live-indicator.is-offline { display: none; }

.topbar__nav {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.pill-btn {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  font-size: 14px;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 20px;
  width: 110px;
  text-align: center;
}
.pill-btn:hover, .pill-btn:focus-visible { background: var(--accent-hover); }

/* ---------- Main area ---------- */

.main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 12px;
  min-height: 0;
  overflow: hidden;
}

.video-zone {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--page-bg);
}

.video-zone__placeholder {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg, #232323 0, #232323 18px, #1a1a1a 18px, #1a1a1a 36px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-zone__placeholder span {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.28);
  letter-spacing: 1px;
}

.video-zone__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
}

.scrim {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card {
  position: relative;
  background: var(--card-bg);
  border-radius: 18px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.3s ease;
}

.card--status { padding: 32px 44px; max-width: 320px; }
.card--status .card__emoji { font-size: 28px; margin-bottom: 10px; }
.card--status .card__title { font-family: 'Fredoka', sans-serif; font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.card--status .card__subtext { font-family: 'Fredoka', sans-serif; font-size: 14px; color: var(--ink-tertiary); line-height: 1.5; }

.card--prompt { width: 280px; padding: 28px 32px; }
.card--prompt .card__title { font-family: 'Fredoka', sans-serif; font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 16px; }

.card--info { max-width: 320px; padding: 32px 28px; }
.card--info .card__pill {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  font-size: 16px;
  padding: 8px 16px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 14px;
}
.card--info .card__body {
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  color: var(--ink-secondary);
  line-height: 1.6;
  text-align: left;
}

.card__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card--info .card__close { width: 28px; height: 28px; font-size: 14px; }
.card__close:hover, .card__close:focus-visible { background: rgba(0, 0, 0, 0.12); }

.name-input {
  width: 100%;
  padding: 10px 12px;
  font-family: 'Fredoka', sans-serif;
  font-size: 16px;
  border: 1px solid #d8d2c6;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
  margin-bottom: 12px;
}
.name-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.name-error {
  font-family: 'Fredoka', sans-serif;
  font-size: 12px;
  color: #b3492f;
  margin-bottom: 10px;
  text-align: left;
}

.card__actions { display: flex; gap: 8px; }

.btn {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 10px 0;
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover, .btn--primary:focus-visible { background: var(--accent-hover); }
.btn--secondary { background: transparent; color: var(--ink-tertiary); border: 1px solid #d8d2c6; }
.btn--secondary:hover, .btn--secondary:focus-visible { background: #f1ede5; }

.viewer-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--card-bg);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.audio-control {
  position: absolute;
  bottom: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

#volume-slider { width: 80px; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: var(--card-bg);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover, .icon-btn:focus-visible { background: rgba(0, 0, 0, 0.65); }

.feed-control { position: absolute; bottom: 14px; left: 14px; }

.feed-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.feed-btn--enabled { background: var(--accent); cursor: pointer; }
.feed-btn--enabled.is-cooling { background: var(--accent-hover); cursor: default; }
.feed-btn__icon { position: relative; z-index: 2; font-size: 26px; }
.feed-btn__ring { position: absolute; top: 0; left: 0; transform: rotate(-90deg); }
.feed-btn__countdown {
  /* Anchored from the button's own left edge, not centered on it —
   * this element shows both the short cooldown countdown ("45s") and
   * longer transient messages ("outside feeding hours"). Centering via
   * transform:translateX(-50%) pushed long text off-screen to the left,
   * since the feed button sits at the video zone's bottom-LEFT corner. */
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  max-width: 180px;
  font-family: 'Fredoka', sans-serif;
  font-size: 11px;
  color: var(--card-bg);
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 8px;
  border-radius: 8px;
  white-space: normal;
  line-height: 1.3;
}

.feed-btn-wrap { position: relative; }
.feed-btn--disabled {
  background: var(--muted);
  font-size: 26px;
  cursor: not-allowed;
  opacity: 0.85;
}
.feed-tooltip {
  position: absolute;
  bottom: 60px;
  left: 0;
  background: var(--page-bg);
  color: var(--card-bg);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: 'Fredoka', sans-serif;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.feed-btn-wrap:hover .feed-tooltip { opacity: 1; }

/* ---------- Activity log sidebar ---------- */

.log-sidebar {
  width: 300px;
  flex: 0 0 auto;
  height: 100%;
  background: var(--log-bg);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.log-sidebar__date {
  font-family: 'Fredoka', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: rgba(245, 241, 234, 0.65);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 8px;
  flex: 0 0 auto;
}

.log-scroll {
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: flex-start;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.log-scroll:hover { scrollbar-color: rgba(255, 255, 255, 0.4) transparent; }
.log-scroll::-webkit-scrollbar { width: 6px; }
.log-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }
.log-scroll:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.4); }

.log-entry {
  display: flex;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: transparent;
  align-items: baseline;
  min-width: 0;
}
.log-entry--tint { background: rgba(255, 255, 255, 0.05); }

.log-entry__time {
  font-family: 'Fredoka', sans-serif;
  font-size: 11px;
  color: rgba(245, 241, 234, 0.45);
  flex: 0 0 52px;
  white-space: nowrap;
}
.log-entry__text {
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  color: var(--log-text);
  line-height: 1.4;
  font-weight: 500;
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

/* ---------- Footer ---------- */

.footer {
  height: 36px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--page-bg);
  border-top: 1px solid var(--border-hairline);
}
.footer__links { display: flex; gap: 16px; }
.footer__links a {
  font-family: 'Fredoka', sans-serif;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}
.footer__links a:hover, .footer__links a:focus-visible { color: var(--muted-hover); }
.footer__brand {
  font-family: 'Fredoka', sans-serif;
  color: var(--ink-tertiary);
  font-size: 12px;
}

/* ---------- Mobile (<768px, portrait) ---------- */

/* orientation: portrait, not just max-width -- a landscape phone can be
   just as narrow as a portrait one (iPhone SE landscape is 667px wide,
   under this breakpoint) but has the opposite problem: little height,
   not little width. Without the orientation check, .main/.log-sidebar
   below stack into flex-direction: column on a landscape phone too,
   and .log-sidebar's max-height: 220px leaves .video-zone (min-height:
   0) almost no room in a ~375px-tall viewport -- confirmed via
   Chromium at 667x375, video collapses to 0px height entirely.
   Landscape should always get the side-by-side desktop-style layout
   (design/feedem-design.html's landscape view), regardless of width. */
@media (max-width: 767px) and (orientation: portrait) {
  .topbar {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
  }
  .topbar__brand { justify-content: center; width: 100%; }
  .wordmark { font-size: 24px; }
  .wordmark__bird { font-size: 13px; top: -6px; left: 13px; }
  .divider { height: 16px; }
  .live-dot { width: 7px; height: 7px; }
  .live-text { font-size: 11px; }
  .topbar__nav {
    justify-content: space-between;
    padding-top: 12px;
    width: 100%;
  }
  .pill-btn { width: 46%; }

  .main { flex-direction: column; }
  .log-sidebar { width: 100%; max-height: 220px; }
}
