/*
 * Typatone Primary Stylesheet
 * Minimalist, elegant musical typewriter aesthetic.
 */

:root {
  --bg-color: #efefef;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --accent-color: #0ea5e9;
  --accent-hover: #0284c7;
  --cursor-color: #0ea5e9;
  --card-bg: rgba(255, 255, 255, 0.92);
  --border-color: #e5e7eb;
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Space Grotesk', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
  font-family: var(--font-main);
  color: var(--text-main);
  background-color: var(--bg-color);
  user-select: none;
  transition: background-color 1s ease;
}

/* Fullscreen interactive canvas */
.typatone-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

#view-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  z-index: 2;
}

/* Main Workspace Wrapper (3-Column Layout on Desktop) */
.workspace-wrapper {
  flex: 1;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  position: relative;
  z-index: 2;
  overflow-y: auto;
}

/* Ad Sidebars (Left and Right) */
.ad-sidebar {
  flex: 1;
  max-width: 320px;
  min-width: 160px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: sticky;
  top: 1rem;
}

.ad-slot {
  width: 100%;
  max-width: 300px;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-placeholder {
  width: 100%;
  min-height: 500px;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.ad-placeholder:hover {
  border-color: rgba(14, 165, 233, 0.8);
  background: rgba(255, 255, 255, 0.65);
}

.ad-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 0.75rem;
}

.ad-inner-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
}

/* Center Workspace (Typing Container & Keyboard) */
.center-workspace {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 500px;
  flex-shrink: 0;
  gap: 1rem;
}

/* Central Stage: 500x500 on Desktop */
#stage {
  width: 500px;
  height: 500px;
  max-width: 500px;
  max-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: text;
  flex: none;
  padding: 0;
}

/* 500x500 Typing Container Box */
.stage-inner.typing-container-500 {
  width: 100%;
  max-width: 500px;
  height: 100%;
  max-height: 500px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 20px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 2.2rem 1.8rem;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Custom Sleek Scrollbar for 500x500 container */
.stage-inner.typing-container-500::-webkit-scrollbar {
  width: 6px;
}
.stage-inner.typing-container-500::-webkit-scrollbar-thumb {
  background: rgba(14, 165, 233, 0.35);
  border-radius: 4px;
}
.stage-inner.typing-container-500::-webkit-scrollbar-thumb:hover {
  background: rgba(14, 165, 233, 0.6);
}
.stage-inner.typing-container-500::-webkit-scrollbar-track {
  background: transparent;
}

/* Keyboard Area in Center */
#keyboard-area {
  width: 100%;
  max-width: 500px;
  display: flex;
  justify-content: center;
}

/* Text Container inside 500x500 box */
#content {
  font-family: var(--font-main);
  font-size: clamp(1.4rem, 2.5vw, 2.1rem);
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  color: var(--text-main);
  letter-spacing: -0.01em;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  word-wrap: break-word;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  position: relative;
  margin: auto 0;
  padding-bottom: 1.5rem;
  box-sizing: border-box;
}

/* Dynamic text scaling classes for long SMS & compositions */
#content.text-md {
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  line-height: 1.4;
}

#content.text-sm {
  font-size: clamp(0.95rem, 1.6vw, 1.25rem);
  line-height: 1.35;
}

#content.text-xs {
  font-size: clamp(0.82rem, 1.3vw, 1.05rem);
  line-height: 1.3;
}

#content .char {
  display: inline-block;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, color 0.15s ease;
  border-radius: 4px;
}

#content .char.space {
  display: inline;
}

#content .char:hover {
  background: rgba(14, 165, 233, 0.08);
}

#content .char.active {
  color: #0284c7;
  transform: scale(1.22);
  text-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

/* Custom Animated Cursor */
#cursor {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 1.25em;
  background-color: var(--cursor-color);
  border-radius: 2px;
  pointer-events: none;
  animation: blink 1.1s infinite;
  transition: transform 0.12s cubic-bezier(0.2, 0, 0, 1);
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.6);
  z-index: 5;
}

@keyframes blink {
  0%, 45% { opacity: 1; }
  50%, 95% { opacity: 0; }
  100% { opacity: 1; }
}

/* Toolbar Controls */
#toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(229, 231, 235, 0.6);
  position: relative;
  z-index: 10;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: #374151;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  transform: translateY(-1px);
}

.tool-btn:active {
  transform: translateY(0);
  background: #f3f4f6;
}

.tool-btn.primary {
  background: #0ea5e9;
  color: #ffffff;
  border-color: #0ea5e9;
}

.tool-btn.primary:hover {
  background: #0284c7;
  border-color: #0284c7;
}

.tool-btn.playing {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

.tool-btn.muted {
  color: #ef4444;
  border-color: #fca5a5;
  background: #fef2f2;
}

/* Speed Slider */
.speed-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.speed-control input[type="range"] {
  width: 90px;
  accent-color: #0ea5e9;
  cursor: pointer;
}

/* Modals Overlay */
#modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 24, 39, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#modal-overlay.visible {
  display: flex;
  opacity: 1;
}

.modal {
  display: none;
  background: #ffffff;
  width: 100%;
  max-width: 480px;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  position: relative;
  text-align: center;
  animation: modalScale 0.25s ease forwards;
}

.modal.visible {
  display: block;
}

@keyframes modalScale {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal .close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  font-size: 1.6rem;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
}

.modal .close:hover {
  color: #1f2937;
}

.modal h2 {
  font-size: 1.5rem;
  margin-bottom: 0.8rem;
  font-weight: 700;
}

.modal p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.2rem;
}

/* QR & Share form */
.qr-box {
  display: flex;
  justify-content: center;
  margin: 1rem 0 0.8rem;
}

#share-qrcode {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  min-width: 160px;
  min-height: 160px;
}

/* QRCode.js generates both <canvas> and <img>. Keep canvas hidden so only one QR is visible */
#share-qrcode canvas {
  display: none !important;
}

#share-qrcode img {
  display: block !important;
  border-radius: 6px;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.share-input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.share-input-group input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  outline: none;
}

.share-input-group input:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.social-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #374151;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.social-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.14);
}

/* Brand-colored social buttons */
.social-btn-wa  { background: #25D366; color: #fff; }
.social-btn-wa:hover  { background: #20ba58; }
.social-btn-x   { background: #000; color: #fff; }
.social-btn-x:hover   { background: #222; }
.social-btn-fb  { background: #1877F2; color: #fff; }
.social-btn-fb:hover  { background: #1362cf; }
.social-btn-li  { background: #0A66C2; color: #fff; }
.social-btn-li:hover  { background: #0754a3; }
.social-btn-tm  { background: #34526f; color: #fff; }
.social-btn-tm:hover  { background: #2a3f56; }

/* Share toolbar button highlight */
.share-toolbar-btn {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff !important;
  border-color: #0284c7;
  font-weight: 600;
}
.share-toolbar-btn:hover {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  transform: translateY(-1px);
}

/* Integrated Top Stage Bar directly above typing box */
.stage-top-bar {
  width: 100%;
  max-width: 500px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.4rem;
  margin-bottom: 0.35rem;
  box-sizing: border-box;
  flex-shrink: 0;
}

.stage-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.75);
  padding: 0.28rem 0.65rem;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0ea5e9;
  box-shadow: 0 0 6px rgba(14, 165, 233, 0.7);
}

.stage-brand-title,
h1.stage-brand-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.01em;
  margin: 0;
  padding: 0;
  line-height: 1;
  display: inline-block;
}

/* Screen reader only utility for accessible and SEO headings */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.stage-voice-pill {
  font-size: 0.72rem;
  font-weight: 600;
  color: #0ea5e9;
  background: rgba(14, 165, 233, 0.1);
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  text-transform: capitalize;
}

.stage-top-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-stage-download-apk {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.95rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font-main);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.35);
  transition: all 0.18s ease;
}

.btn-stage-download-apk:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(16, 185, 129, 0.45);
  color: #ffffff;
}

.btn-stage-download-apk:active {
  transform: translateY(0);
}

.btn-stage-download-apk .apk-icon {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
}

.btn-stage-download-apk .apk-label {
  letter-spacing: 0.01em;
  white-space: nowrap;
}

@media (max-width: 400px) {
  .btn-stage-download-apk {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 340px) {
  .btn-stage-download-apk .apk-label {
    display: none;
  }
  .btn-stage-download-apk {
    padding: 0.38rem 0.55rem;
  }
}

/* Paste Modal textarea */
#paste-input {
  width: 100%;
  height: 120px;
  padding: 0.8rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  resize: vertical;
  margin-bottom: 1.2rem;
  outline: none;
}

#paste-input:focus {
  border-color: #0ea5e9;
}

/* Toast Notifications */
#toast {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(17, 24, 39, 0.88);
  color: #ffffff;
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Viewer Prompt Overlay */
.viewer-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  transition: opacity 0.4s ease;
}

.viewer-prompt.hidden {
  opacity: 0;
  pointer-events: none;
}

.prompt-card {
  background: #ffffff;
  padding: 2.5rem 3rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.prompt-card h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.prompt-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
  align-items: center;
}

.prompt-play-btn {
  padding: 0.9rem 2.2rem;
  background: #0ea5e9;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4);
  transition: all 0.15s ease;
  width: 100%;
  max-width: 250px;
}

.prompt-play-btn:hover {
  background: #0284c7;
  transform: scale(1.03);
}

.prompt-reply-btn {
  padding: 0.75rem 2.2rem;
  background: #ffffff;
  color: #0ea5e9;
  font-size: 1.05rem;
  font-weight: 700;
  border: 2px solid #0ea5e9;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.12);
  transition: all 0.15s ease;
  width: 100%;
  max-width: 250px;
}

.prompt-reply-btn:hover {
  background: #f0f9ff;
  border-color: #0284c7;
  color: #0284c7;
  transform: scale(1.03);
}

.prompt-sub {
  margin-top: 1.2rem;
  font-size: 0.85rem;
}

.prompt-sub a {
  color: #0ea5e9;
  text-decoration: none;
}

/* Reply Banner & Thread Indicator */
.reply-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 500px;
  max-width: 100%;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.35);
  border-radius: 12px;
  padding: 0.55rem 0.9rem;
  font-size: 0.82rem;
  color: #0369a1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  margin-bottom: 0.5rem;
  box-sizing: border-box;
  animation: slideDown 0.25s ease;
}

.reply-banner-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-banner-content span {
  font-weight: 600;
}

.reply-banner .btn-action-reply {
  background: none;
  border: none;
  color: #0284c7;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0 4px;
}

.reply-banner .btn-dismiss-reply {
  background: none;
  border: none;
  color: #64748b;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.reply-banner .btn-dismiss-reply:hover {
  color: #0f172a;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Big Prominent Actions for mobile & desktop recipients */
.viewer-actions-bar {
  width: 500px;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.65rem;
  margin: 0.75rem 0 0.4rem;
  padding: 0 0.5rem;
  box-sizing: border-box;
  animation: slideDown 0.3s ease;
}

.btn-big-reply {
  flex: 1.3;
  padding: 0.85rem 1.2rem;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.45), 0 2px 4px rgba(0, 0, 0, 0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-big-reply:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.55);
}

.btn-big-reply:active {
  transform: translateY(0);
}

.btn-big-share {
  flex: 1;
  padding: 0.85rem 1.2rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45), 0 2px 4px rgba(0, 0, 0, 0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-big-share:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55);
}

.btn-big-share:active {
  transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 1023px) {
  html, body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  #view-app {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
  }

  .workspace-wrapper {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.6rem 0.2rem;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
  }

  .ad-sidebar {
    display: none; /* Hide sidebars on mobile & tablets to dedicate 100% focus to typing & keyboard */
  }

  .center-workspace {
    flex: 1 1 0%;
    min-height: 0;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 0.25rem;
    overflow: hidden;
  }

  #reply-banner-area {
    width: 100%;
    max-width: 500px;
    flex-shrink: 0;
  }

  .reply-banner {
    width: 100%;
    margin-bottom: 0.2rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    border-radius: 10px;
  }

  #stage {
    flex: 1 1 0%;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 80px;
    height: auto !important;
    max-height: none !important;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    margin: 0;
  }

  .stage-inner.typing-container-500 {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
    min-height: 80px;
    max-height: none !important;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: stretch;
    justify-content: flex-start;
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.04);
  }

  #content {
    font-size: clamp(1.15rem, 4.5vw, 1.65rem);
    line-height: 1.4;
    padding-bottom: 0.5rem;
    margin: auto 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #content.text-md {
    font-size: 1.12rem;
    line-height: 1.35;
  }

  #content.text-sm {
    font-size: 0.95rem;
    line-height: 1.3;
  }

  #content.text-xs {
    font-size: 0.82rem;
    line-height: 1.25;
  }

  .stage-top-bar {
    width: 100%;
    max-width: 500px;
    margin-bottom: 0.25rem;
    padding: 0 0.2rem;
  }

  .viewer-actions-bar {
    width: 100%;
    max-width: 500px;
    flex-shrink: 0;
    margin: 0.35rem 0;
    padding: 0 0.2rem;
    gap: 0.5rem;
  }

  .btn-big-reply,
  .btn-big-share {
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
    border-radius: 12px;
  }

  #keyboard-area {
    flex-shrink: 0;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding-bottom: 2px;
  }
}

@media (max-width: 768px) {
  #toolbar {
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    padding: 0 0.5rem;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 25;
  }

  #toolbar::-webkit-scrollbar {
    display: none;
  }

  .toolbar-group {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .tool-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
    height: 34px;
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: 8px;
  }

  .speed-control {
    display: none;
  }
}

/* Legal & Static Content Pages (Privacy, Terms, DMCA, Contact) */
.legal-container {
  max-width: 840px;
  margin: 0 auto;
  background: #ffffff;
  padding: 2.8rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  font-family: var(--font-main);
  color: #334155;
  line-height: 1.7;
}

.legal-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.legal-header h1 {
  font-size: 1.9rem;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.02em;
}

.legal-meta-badge {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.4rem;
}

.legal-nav-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.legal-nav-bar a {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0ea5e9;
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.legal-nav-bar a:hover {
  background: rgba(14, 165, 233, 0.1);
}

.legal-nav-bar a.active {
  background: #0ea5e9;
  color: #ffffff;
}

.legal-content h2 {
  font-size: 1.3rem;
  color: #0f172a;
  margin: 2rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #f1f5f9;
}

.legal-content h3 {
  font-size: 1.1rem;
  color: #1e293b;
  margin: 1.4rem 0 0.5rem;
}

.legal-content p {
  margin-bottom: 1.1rem;
}

.legal-content ul, .legal-content ol {
  margin: 0.5rem 0 1.2rem 1.4rem;
}

.legal-content li {
  margin-bottom: 0.4rem;
}

.legal-content strong {
  color: #0f172a;
}

.legal-content .highlight-box {
  background: #f8fafc;
  border-left: 4px solid #0ea5e9;
  padding: 1rem 1.2rem;
  border-radius: 0 8px 8px 0;
  margin: 1.4rem 0;
  font-size: 0.92rem;
}

.legal-footer-links {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: #64748b;
}

.legal-footer-links a {
  color: #0ea5e9;
  text-decoration: none;
}

@media (max-width: 640px) {
  .legal-container {
    padding: 1.5rem 1.2rem;
  }
  .legal-header h1 {
    font-size: 1.5rem;
  }
}
