.igchess-story {
  --story-accent: #075947;
  --story-bg: #fff;
  --story-soft: #e6f4ee;
  --story-ink: #182423;
  --story-dim: #52635c;
  --story-line: #d7e2dc;
  position: fixed;
  z-index: 1040;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 10px;
  max-width: calc(100% - 44px);
  color: var(--story-ink);
  font: 14px/1.5 system-ui, sans-serif;
  direction: rtl;
}
:is([data-bs-theme="dark"], .dark) .igchess-story {
  --story-accent: #176a53;
  --story-bg: #1e2724;
  --story-soft: #2a493d;
  --story-ink: #edf5f1;
  --story-dim: #b9c9c3;
  --story-line: #43524b;
}
.igchess-story *, .igchess-story *::before, .igchess-story *::after { box-sizing: border-box; }
.igchess-story [hidden] { display: none !important; }
.igchess-story button { cursor: pointer; font: inherit; color: inherit; }
.igchess-story button:disabled { cursor: default; opacity: .55; }
.igchess-story :is(button, textarea):focus-visible { outline: 2px solid #46a886; outline-offset: 3px; }
.igchess-story svg { width: 18px; height: 18px; flex: none; }
.igchess-story .igchess-story-launch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 5px 4px 13px;
  background: var(--story-accent);
  color: #fff;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgb(0 30 20 / 25%);
  white-space: nowrap;
}
.igchess-story-launch-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgb(255 255 255 / 16%);
}
.igchess-story .igchess-story-panel {
  width: min(340px, calc(100vw - 44px));
  max-height: calc(100dvh - 110px);
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--story-line);
  border-radius: 13px;
  background: var(--story-bg);
  box-shadow: 0 9px 25px rgb(0 30 20 / 23%);
}
.igchess-story .igchess-story-header, .igchess-story .igchess-story-record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.igchess-story .igchess-story-title { margin: 0; color: var(--story-ink); font: 700 17px/1.45 system-ui, sans-serif; }
.igchess-story .igchess-story-destination { margin: 0; color: var(--story-dim); font-size: 12px; }
.igchess-story .igchess-story-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.igchess-story .igchess-story-action, .igchess-story .igchess-story-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid var(--story-line);
  border-radius: 8px;
  background: var(--story-bg);
}
.igchess-story .igchess-story-action[aria-pressed="true"] { background: var(--story-soft); font-weight: 650; }
.igchess-story .igchess-story-close { min-width: 44px; font-size: 22px; }
.igchess-story .igchess-story-voice, .igchess-story .igchess-story-writing { display: grid; gap: 7px; }
.igchess-story .igchess-story-voice audio { width: 100%; max-width: 100%; height: 46px; }
.igchess-story textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--story-line);
  border-radius: 8px;
  background: var(--story-bg);
  color: var(--story-ink);
  font: 16px/1.5 system-ui, sans-serif;
  resize: vertical;
}
.igchess-story .igchess-story-send { background: var(--story-accent); color: #fff; font-weight: 650; }
.igchess-story .igchess-story-feedback { margin: 0; color: var(--story-dim); font-size: 13px; }
.igchess-story .igchess-story-feedback[data-error] { color: #b32636; }
:is([data-bs-theme="dark"], .dark) .igchess-story .igchess-story-feedback[data-error] { color: #ffa4ac; }
@media (max-width: 480px) {
  .igchess-story { left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); max-width: calc(100% - 28px); }
  .igchess-story .igchess-story-panel { width: min(340px, calc(100vw - 28px)); }
}
