/* Ramble "Try it" demo, embedded in the portfolio's Playground section.
   Everything is prefixed rb- so it can't collide with the page's own styles. */
.rb {
  /* Sage green, matching the Ramble logo */
  --rb-accent: #4f7a45;
  --rb-wash: #e4eedd;
  --rb-mac: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

/* The mock Mac desktop */
.rb-screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: 5 / 4;
  border-radius: 14px;
  /* Flat, muted sage: a sketchbook feel rather than a glossy wallpaper */
  background: #cfe0c4; /* the same sage as the Ramble icon */
  box-shadow: 0 1px 3px rgba(31, 42, 36, 0.08);
  font-family: var(--rb-mac);
}

.rb-menubar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 26px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #22301d; /* dark menu bar text, as macOS uses on a light wallpaper */
  font-size: 13px;
  font-weight: 600;
}

.rb-menubar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.rb-menubar__icon {
  width: 18px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.rb-screen.is-recording .rb-menubar__icon { stroke: #c0392b; }

.rb-window {
  position: absolute;
  top: 46px;
  left: 7%;
  right: 7%;
  bottom: 118px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(31, 42, 36, 0.12);
}

.rb-window__bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  height: 30px;
  background: #f4f2f7;
  border-bottom: 1px solid #e6e3ec;
}

.rb-dots {
  position: absolute;
  left: 12px;
  display: flex;
  gap: 7px;
}

.rb-dots i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff5f57;
}

.rb-dots i:nth-child(2) { background: #febc2e; }
.rb-dots i:nth-child(3) { background: #28c840; }

.rb-window__title {
  font-size: 12px;
  font-weight: 600;
  color: #5d5866;
}

.rb-note {
  flex: 1;
  overflow-y: auto;
  padding: 16px 22px;
  color: #1d1b20;
  font: 400 14px/1.55 var(--rb-mac);
}

.rb-note p { margin: 0 0 10px; }
.rb-note .rb-hint { color: #a8a2b3; }
.rb-note .rb-interim { color: #8d86a0; }

.rb-note .rb-typed { animation: rb-type-in 0.35s ease backwards; }

@keyframes rb-type-in {
  from { opacity: 0; transform: translateY(4px); }
}

.rb-caret {
  display: inline-block;
  width: 1.5px;
  height: 1.15em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--rb-accent);
  animation: rb-blink 1.1s steps(1) infinite;
}

@keyframes rb-blink { 50% { opacity: 0; } }

/* The floating cat and bar, as in the app */
.rb-bar {
  position: absolute;
  left: 50%;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 260px;
  margin-left: -130px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.2s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rb-bar.is-up {
  opacity: 1;
  transform: none;
}

.rb-bar__cat {
  position: relative;
  margin-bottom: -1px;
  pointer-events: auto; /* hovering wakes the cat */
}

.rb-bar__cat canvas {
  display: block;
  image-rendering: pixelated;
}

.rb-cat {
  width: 144px;
  height: 66px;
}

.rb-bubble {
  position: absolute;
  top: -22px;
  right: 2px;
  width: 40px;
  height: 40px;
}

.rb-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 26px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  color: #fff;
  font: 500 11px/1 var(--rb-mac);
  transition: opacity 0.2s ease;
}

.rb-pill.is-hidden { opacity: 0; }

.rb-pill__rec {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff3b30;
}

.rb-pill__wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 14px;
}

.rb-pill__wave i {
  width: 3px;
  height: 3px;
  border-radius: 2px;
  background: #fff;
}

.rb-pill__cancel {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
}

.rb-pill[data-mode="text"] .rb-pill__rec,
.rb-pill[data-mode="text"] .rb-pill__wave,
.rb-pill[data-mode="text"] .rb-pill__cancel { display: none; }
.rb-pill[data-mode="rec"] .rb-pill__text { display: none; }

/* Option key and status under the screen */
.rb-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.rb-key {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  width: 84px;
  height: 58px;
  padding: 7px 9px 6px;
  border: 1px solid #cdd6c8;
  border-bottom-width: 4px;
  border-radius: 12px;
  background: #fbfcf9;
  color: #1f2a24;
  font: 400 12px/1 var(--rb-mac);
  cursor: pointer;
  transition: transform 0.08s ease, border-bottom-width 0.08s ease, background-color 0.2s ease;
}

/* A Mac-style keycap: the symbol top right, the name bottom left */
.rb-key__glyph { font-size: 16px; }
.rb-key__name { align-self: flex-start; }

.rb-key:active,
.rb-key.is-pressed {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.rb-key:disabled { cursor: default; opacity: 0.55; }

.rb-key.is-live {
  background: var(--rb-wash);
  border-color: #b5cfa8;
  animation: rb-nudge 1.6s ease-in-out infinite;
}

@keyframes rb-nudge { 50% { box-shadow: 0 0 0 6px rgba(79, 122, 69, 0.18); } }

.rb-key:focus-visible {
  outline: 2px solid var(--rb-accent);
  outline-offset: 3px;
}

.rb-status {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  color: #5b6760;
}

@media (max-width: 600px) {
  .rb-screen { aspect-ratio: 3 / 4; }
  .rb-window { left: 4%; right: 4%; }
  .rb-note { padding: 12px 14px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .rb *, .rb *::before, .rb *::after { transition: none !important; animation: none !important; }
}
