/*
 * GEM Exercise Generator — Frontend v4.8.3 (Gemini dark, split layout)
 * - Reset uses :where() → ZERO specificity, so component paddings/margins
 *   always apply (fixes text/counter overflow + left-shifted logo/subtitle).
 * - Big generate button BELOW the composer.
 * - Result opens as a RIGHT-SIDE panel on desktop; stacked on tablet/mobile.
 * Best used on an Elementor Canvas / Full-Width template.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* A felső fehér csík oka általában a böngésző alap 8px body-margója, ami a
   full-bleed elem fölött kilátszik. A CSS csak a shortcode oldalán töltődik be. */
html, body { margin: 0 !important; }

/* ---- RESET (low specificity via :where, so components win) ---- */
.gem-eg, .gem-eg * { box-sizing: border-box; -webkit-font-smoothing: antialiased; }
.gem-eg :where(h1,h2,h3,p,span,div,a,button,textarea,input,img,svg,label) {
  margin: 0; padding: 0; border: 0; background: none;
  font-family: inherit; color: inherit; text-transform: none;
  box-shadow: none; text-shadow: none; float: none; max-width: none; line-height: inherit;
}
.gem-eg :where(a) { text-decoration: none; }
.gem-eg :where(button) { cursor: pointer; -webkit-appearance: none; appearance: none; }
.gem-eg :where([hidden]) { display: none !important; }

.gem-eg {
  /* Gemini-ish dark palette */
  --bg: #131314;
  --bg2: #1e1f20;
  --bg3: #282a2c;
  --line: #3c4043;
  --line2: #4a4e51;
  --fg: #e3e3e3;
  --fg-dim: #9aa0a6;
  --accent: #4aa6bd;
  --accent2: #7cc4d6;
  --grad1: #356a78;
  --grad2: #2b8a9e;
  --ok: #34c98a;
  --err: #ff6b6b;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;        /* függőleges közép (Gemini-szerű, üres állapotban) */
  position: relative;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: clamp(56px, 12vh, 130px) 22px clamp(56px, 12vh, 120px);  /* nagyobb felső/alsó tér */
  min-height: 96vh;

  background:
    radial-gradient(1200px 600px at 50% -5%, rgba(53,106,120,.22), transparent 62%),
    radial-gradient(820px 420px at 88% 8%, rgba(43,138,158,.12), transparent 55%),
    var(--bg);

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px; font-weight: 400; line-height: 1.5;
  letter-spacing: -0.005em; color: var(--fg); text-align: left;
}
/* A téma !important-tal stílusozza a gombokat, és a saját menüpont-szabályunk is
   (display:flex !important) — ezek felülírnák a [hidden] attribútumot. Ez a magasabb
   specificitású szabály garantálja, hogy a rejtett elemek (pl. a kamera opció gépen,
   a zárt menük) tényleg ne látszódjanak. */
.gem-eg [hidden] { display: none !important; }
/* eredmény megjelenésekor felülre igazítunk (a panel magas) */
.gem-eg.is-result { justify-content: flex-start; }

/* ---- Back button (top-left) ---- */
.gem-eg__back {
  position: absolute; top: clamp(16px, 3vh, 28px); left: clamp(16px, 3vw, 32px);
  z-index: 10;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 999px;
  background: rgba(255,255,255,.06) !important;
  border: 1px solid var(--line) !important;
  color: var(--fg-dim) !important;
  font-size: 13.5px; font-weight: 500;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  opacity: 1; /* FOUC ellen: a kritikus CSS opacity:0-ról fadel be */
  transition: background .15s, color .15s, border-color .15s, transform .1s, opacity .2s ease;
}
.gem-eg__back:hover { background: rgba(255,255,255,.1) !important; color: var(--fg) !important; border-color: var(--line2) !important; transform: translateY(-1px); }
.gem-eg__back svg { flex-shrink: 0; }

/* ---- Shell ---- */
.gem-eg__shell {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  opacity: 1; /* a kritikus CSS opacity:0-ról ide fadel be, ha a frontend.css késve tölt (FOUC ellen) */
}
.gem-eg__main { width: 100%; display: flex; flex-direction: column; }

/* ---- Hero ---- */
.gem-eg__hero { text-align: center; margin-bottom: 30px; }
.gem-eg__logo {
  display: block; width: auto; max-width: 150px; height: auto; /* fallback — a backend-beli méret inline felülírja */
  margin: 0 auto 16px;
  filter: invert(1) brightness(1.85);
  opacity: .8;
}
.gem-eg__greeting {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 600; line-height: 1.08; letter-spacing: -0.03em;
  background: linear-gradient(90deg, #cfdee2, #8fb9c4 55%, #66a3b4);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: #cfdee2;
  margin-bottom: 14px;
}
.gem-eg__subtitle {
  font-size: clamp(14px, 2vw, 16.5px);
  color: var(--fg-dim); line-height: 1.55;
  max-width: 560px; margin: 0 auto;    /* középre */
}

/* ---- Composer ---- */
.gem-eg__composer {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 6px 6px 0;
  transition: border-color .18s, box-shadow .18s;
}
.gem-eg__composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(74,166,189,.14), 0 10px 34px -14px rgba(0,0,0,.6);
}
/* Drag & drop (asztali gép): fájlok behúzása a felületre */
.gem-eg__composer.is-dragover {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 4px rgba(74,166,189,.2), 0 10px 34px -14px rgba(0,0,0,.6) !important;
}
.gem-eg__dropzone {
  position: absolute; inset: 0; z-index: 5;
  display: none !important; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(19,19,20,.9); border-radius: 24px;
  text-align: center; padding: 16px; pointer-events: none;
}
.gem-eg__composer.is-dragover .gem-eg__dropzone { display: flex !important; }
.gem-eg__dropzone-ico {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(74,166,189,.16); color: var(--accent2);
}
.gem-eg__dropzone-ico svg { width: 22px; height: 22px; display: block; }
.gem-eg__dropzone-txt { color: var(--accent2); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.gem-eg__textarea {
  display: block; width: 100%;
  padding: 18px 20px 8px;              /* bőséges belső tér → nem lóg a falba */
  background: transparent !important;  /* a téma ne tegyen fehér hátteret rá */
  -webkit-appearance: none; appearance: none;
  font-size: 16px; line-height: 1.6; color: var(--fg) !important;
  caret-color: var(--accent2);
  resize: none; min-height: 120px; max-height: 420px;
  outline: none !important; border: none !important; box-shadow: none !important;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-user-select: text; user-select: text;
  overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line2) transparent;
}
.gem-eg__textarea:focus, .gem-eg__textarea:focus-visible, .gem-eg__textarea:active {
  outline: none !important; border: none !important; box-shadow: none !important; background: transparent !important;
}
.gem-eg__textarea::placeholder { color: #7a8085 !important; opacity: 1; }
.gem-eg__textarea::selection { background: rgba(74,166,189,.3); color: #fff; }
.gem-eg__textarea::-moz-selection { background: rgba(74,166,189,.3); color: #fff; }
.gem-eg__textarea::-webkit-scrollbar { width: 10px; }
.gem-eg__textarea::-webkit-scrollbar-track { background: transparent; }
.gem-eg__textarea::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 8px; border: 2px solid var(--bg2); }
.gem-eg__textarea:-webkit-autofill,
.gem-eg__textarea:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg2) inset !important;
  -webkit-text-fill-color: var(--fg) !important;
  caret-color: var(--accent2) !important;
}
.gem-eg__composer-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
  padding: 4px 12px 12px;
}
.gem-eg__foot-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.gem-eg__count { font-size: 13px; color: var(--fg-dim); white-space: nowrap; margin-left: auto; transition: color .15s; }
.gem-eg__count.is-near { color: #e0a458; }

/* ---- Shared elevated menu (Claude-style card) ---- */
.gem-eg__menu {
  position: absolute; bottom: calc(100% + 10px); z-index: 40;
  display: flex; flex-direction: column; gap: 3px;
  padding: 5px;
  background: #202123; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 16px 40px -10px rgba(0,0,0,.6), 0 4px 12px rgba(0,0,0,.35);
  max-width: calc(100vw - 24px);
  animation: gem-eg-pop .14s cubic-bezier(.2,.7,.3,1);
}
@keyframes gem-eg-pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---- Attach (+) button ---- */
.gem-eg__attach { position: relative; display: inline-flex; }
.gem-eg__attach-btn {
  position: relative;
  display: inline-flex !important; align-items: center; justify-content: center;
  width: 34px !important; height: 34px !important; min-width: 0 !important; min-height: 0 !important;
  padding: 0 !important; border-radius: 10px !important; margin: 0 !important;
  background: transparent !important; color: var(--fg-dim) !important; border: 0 !important;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background .14s, color .14s;
}
.gem-eg__attach-btn:hover { background: rgba(255,255,255,.08) !important; color: var(--fg) !important; }
.gem-eg__attach-btn[aria-expanded="true"] { background: rgba(255,255,255,.1) !important; color: var(--fg) !important; }
/* a „+" tisztán CSS-ből rajzolva → téma-független, mindig látszik; nyitva ×-re fordul */
.gem-eg__attach-btn::before,
.gem-eg__attach-btn::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  background: currentColor; border-radius: 2px;
  transition: transform .18s ease;
}
.gem-eg__attach-btn::before { width: 16px; height: 2px; transform: translate(-50%, -50%); }
.gem-eg__attach-btn::after  { width: 2px; height: 16px; transform: translate(-50%, -50%); }
.gem-eg__attach-btn[aria-expanded="true"]::before { transform: translate(-50%, -50%) rotate(45deg); }
.gem-eg__attach-btn[aria-expanded="true"]::after  { transform: translate(-50%, -50%) rotate(45deg); }

/* ---- Attach menu ---- */
.gem-eg__attach-menu { left: 0; min-width: 232px; }
.gem-eg__menu-item {
  display: flex !important; align-items: center; gap: 13px; width: 100% !important; min-width: 0 !important;
  padding: 10px 11px !important; border-radius: 9px !important; margin: 0 !important;
  background: none !important; color: var(--fg) !important; border: 0 !important;
  font-size: 14.5px; font-weight: 450; text-align: left; line-height: 1.3; white-space: nowrap;
  transition: background .12s;
}
.gem-eg__menu-item:hover { background: rgba(255,255,255,.07) !important; }
.gem-eg__menu-item svg { flex-shrink: 0; width: 19px; height: 19px; color: var(--fg-dim); transition: color .12s; }
.gem-eg__menu-item:hover svg { color: var(--accent2); }
.gem-eg__menu-note {
  margin: 5px 8px 3px; padding: 9px 4px 2px; border-top: 1px solid var(--line);
  font-size: 11.5px; line-height: 1.45; color: var(--fg-dim);
}
.gem-eg__menu-note strong { color: var(--fg); font-weight: 600; }

/* ---- Level selector (Claude model-selector style) ---- */
.gem-eg__level { position: relative; display: inline-flex; }
.gem-eg__level-btn {
  display: inline-flex !important; align-items: center; gap: 7px;
  width: auto !important; height: 34px !important; min-width: 0 !important;
  padding: 0 10px !important; border-radius: 10px !important; margin: 0 !important;
  background: transparent !important; color: var(--fg-dim) !important; border: 0 !important;
  font-size: 13.5px; font-weight: 500; line-height: 1;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background .14s, color .14s;
}
.gem-eg__level-btn:hover { background: rgba(255,255,255,.07) !important; color: var(--fg) !important; }
.gem-eg__level-btn[aria-expanded="true"] { background: rgba(255,255,255,.09) !important; color: var(--fg) !important; }
.gem-eg__level-ic { flex-shrink: 0; width: 15px; height: 15px; opacity: .9; }
.gem-eg__level-label { white-space: nowrap; max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.gem-eg__level-caret { flex-shrink: 0; width: 14px; height: 14px; opacity: .75; transition: transform .16s; }
.gem-eg__level-btn[aria-expanded="true"] .gem-eg__level-caret { transform: rotate(180deg); }

.gem-eg__level-menu { left: 0; min-width: 232px; }
.gem-eg__level-opt {
  display: flex !important; align-items: center; gap: 12px; width: 100% !important; min-width: 0 !important;
  padding: 10px 11px !important; border-radius: 10px !important; margin: 0 !important;
  background: none !important; color: var(--fg) !important; border: 0 !important; text-align: left;
  transition: background .12s;
}
.gem-eg__level-opt:hover { background: rgba(255,255,255,.06) !important; }
.gem-eg__level-opt.is-selected { background: rgba(74,166,189,.12) !important; }
.gem-eg__opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.gem-eg__opt-title { font-size: 14px; font-weight: 600; color: var(--fg); line-height: 1.25; white-space: nowrap; }
.gem-eg__opt-desc { font-size: 12px; font-weight: 400; color: var(--fg-dim); line-height: 1.35; white-space: nowrap; }
.gem-eg__opt-check { flex-shrink: 0; width: 18px; height: 18px; color: var(--accent2); opacity: 0; }
.gem-eg__level-opt.is-selected .gem-eg__opt-check { opacity: 1; }

/* ---- File chips (previews) ---- */
.gem-eg__files { display: flex; flex-wrap: wrap; gap: 9px; padding: 10px 14px 2px; }
.gem-eg__file {
  position: relative;
  display: inline-flex; align-items: center; gap: 9px;
  max-width: 260px; padding: 7px 10px 7px 7px;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 12px;
}
.gem-eg__file-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #000; }
.gem-eg__file-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px; flex-shrink: 0;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; color: #fff;
}
.gem-eg__file-ic--pdf  { background: linear-gradient(135deg,#c0392b,#e05a4a); }
.gem-eg__file-ic--docx { background: linear-gradient(135deg,#2b5a9e,#3f7bc8); }
.gem-eg__file-ic--txt  { background: linear-gradient(135deg,#4a4e51,#6a6e71); }
.gem-eg__file-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.gem-eg__file-name { font-size: 13px; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.gem-eg__file-size { font-size: 11px; color: var(--fg-dim); }
.gem-eg__file-remove {
  position: absolute; top: -8px; left: -8px; z-index: 6;
  width: 22px !important; height: 22px !important; min-width: 0 !important; min-height: 0 !important;
  padding: 0 !important; border-radius: 50% !important;
  display: inline-flex !important; align-items: center; justify-content: center;
  background: #26282b !important; border: 1px solid var(--line2) !important;
  margin: 0 !important; box-shadow: 0 2px 8px rgba(0,0,0,.5);
  opacity: 0; transform: scale(.82); pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
}
.gem-eg__file:hover .gem-eg__file-remove,
.gem-eg__file:focus-within .gem-eg__file-remove { opacity: 1; transform: scale(1); pointer-events: auto; }
/* × pontosan a kör közepén, két elforgatott vonalból (téma-független) */
.gem-eg__file-remove::before,
.gem-eg__file-remove::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 10px; height: 1.7px; background: rgba(255,255,255,.9); border-radius: 2px;
}
.gem-eg__file-remove::before { transform: translate(-50%, -50%) rotate(45deg); }
.gem-eg__file-remove::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.gem-eg__file-remove-tip {
  position: absolute; top: calc(100% + 7px); left: 0;
  padding: 5px 9px; border-radius: 7px;
  background: #16171a; border: 1px solid rgba(255,255,255,.1); color: #fff;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0,0,0,.55); opacity: 0; pointer-events: none;
  transition: opacity .12s;
}
.gem-eg__file-remove:hover .gem-eg__file-remove-tip { opacity: 1; }
/* Érintős eszközön nincs hover → a törlő mindig látszik, buborék nélkül */
@media (hover: none) {
  .gem-eg__file-remove { opacity: 1; transform: scale(1); pointer-events: auto; }
  .gem-eg__file-remove-tip { display: none; }
}

/* ---- Generate button (big, below composer) ---- */
.gem-eg__generate {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  margin-top: 16px;
  padding: 17px 28px;
  border-radius: 14px;
  border: 0 !important;
  background: linear-gradient(135deg, var(--grad1), var(--grad2)) !important;
  color: #fff !important; font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease, background .2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 1px 2px rgba(0,0,0,.25), 0 4px 12px -8px rgba(43,138,158,.45);
  text-shadow: none !important;
}
.gem-eg__generate * { color: #fff !important; }
.gem-eg__generate:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 2px 4px rgba(0,0,0,.2), 0 8px 22px -10px rgba(43,138,158,.55); }
.gem-eg__generate:active:not(:disabled) { transform: translateY(0); }
.gem-eg__generate:disabled { opacity: .6; cursor: not-allowed; }
.gem-eg__generate-icon { transition: transform .15s; display: inline-flex; }
.gem-eg__generate:hover:not(:disabled) .gem-eg__ic-arrow { transform: translateX(4px); }
.gem-eg__generate:hover:not(:disabled) .gem-eg__ic-refresh { transform: rotate(-35deg); }

/* alapból csak a nyíl látszik */
.gem-eg__ic-refresh { display: none !important; }
/* regenerate módban a frissítés-ikon, nyíl elrejtve */
.gem-eg__generate.is-regenerate .gem-eg__ic-arrow { display: none !important; }
.gem-eg__generate.is-regenerate .gem-eg__ic-refresh { display: inline-flex !important; }
/* generálás közben (spinner) egyik ikon sem látszik */
.gem-eg__generate.is-loading .gem-eg__generate-icon { display: none !important; }

/* regenerate gomb: észrevehetően más — világosabb tónus, ugyanaz a letisztult árnyék */
.gem-eg__generate.is-regenerate {
  background: linear-gradient(135deg, #2f8fa3, #57b3c8) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.22), 0 4px 12px -8px rgba(43,138,158,.5) !important;
}
.gem-eg__generate.is-regenerate:hover:not(:disabled) {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.26), 0 2px 4px rgba(0,0,0,.2), 0 8px 22px -10px rgba(43,138,158,.6) !important;
}

.gem-eg__spinner {
  width: 19px; height: 19px;
  border: 2.5px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: gem-spin .7s linear infinite;
}
@keyframes gem-spin { to { transform: rotate(360deg); } }

/* ---- Info box ---- */
.gem-eg__info {
  display: flex; align-items: flex-start; gap: 11px;
  margin-top: 18px;
  padding: 14px 16px;
  background: rgba(74,166,189,.08);
  border: 1px solid rgba(74,166,189,.2);
  border-radius: 14px;
  font-size: 13px; line-height: 1.55; color: var(--fg-dim);
}
.gem-eg__info-icon { flex-shrink: 0; color: var(--accent); margin-top: 1px; }

/* ---- Telegram contact box ---- */
.gem-eg__telegram {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px;
  padding: 14px 16px; border-radius: 14px;
  background: rgba(34,158,217,.1) !important;
  border: 1px solid rgba(34,158,217,.3) !important;
  color: var(--fg) !important;
  transition: background .15s, border-color .15s, transform .1s;
}
.gem-eg__telegram:hover { background: rgba(34,158,217,.16) !important; border-color: rgba(34,158,217,.5) !important; transform: translateY(-1px); }
.gem-eg__telegram-icon { flex-shrink: 0; color: #229ED9 !important; }
.gem-eg__telegram-text { flex: 1; font-size: 13.5px; font-weight: 500; line-height: 1.45; color: var(--fg) !important; }
.gem-eg__telegram-arrow { flex-shrink: 0; color: var(--fg-dim) !important; }

/* ---- Status ---- */
.gem-eg__status {
  display: flex; align-items: flex-start; gap: 11px;
  margin-top: 16px; padding: 14px 16px; border-radius: 14px;
  font-size: 14px; line-height: 1.5; animation: gem-fade .2s ease;
}
.gem-eg__status::before { content: ''; flex-shrink: 0; width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: currentColor; }
.gem-eg__status--info { background: rgba(74,166,189,.12); color: var(--accent2); }
.gem-eg__status--info::before { animation: gem-pulse 1.5s ease-in-out infinite; }
.gem-eg__status--error { background: rgba(255,107,107,.12); color: var(--err); }
.gem-eg__status--warn { background: rgba(245,180,80,.13); color: #f3c06a; }
.gem-eg__status--warn::before { animation: none; }
@keyframes gem-pulse { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:.35;transform:scale(1.5);} }
@keyframes gem-fade { from{opacity:0;transform:translateY(6px);} to{opacity:1;transform:translateY(0);} }

/* ---- Result ---- */
.gem-eg__result {
  margin-top: 24px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 24px 70px -28px rgba(0,0,0,.8);
  animation: gem-fade .25s ease;
  display: flex; flex-direction: column;
}
.gem-eg__toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 14px; background: var(--bg3); border-bottom: 1px solid var(--line);
  flex-shrink: 0; flex-wrap: wrap;
}
.gem-eg__quote {
  flex: 1; min-width: 160px;
  font-size: 13px; font-style: italic; font-weight: 500; line-height: 1.45;
  color: var(--accent2);
}
.gem-eg__quote:empty { display: none; }
.gem-eg__tools { display: flex; gap: 8px; flex-shrink: 0; }
.gem-eg__tool {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 11px;
  background: var(--bg2) !important; color: var(--fg) !important;
  border: 1px solid var(--line2) !important;
  font-size: 13.5px; font-weight: 600;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.gem-eg__tool svg { flex-shrink: 0; }
.gem-eg__tool:hover { color: var(--accent2) !important; border-color: var(--accent) !important; transform: translateY(-1px); }

.gem-eg__share { padding: 14px 16px; background: rgba(74,166,189,.08); border-bottom: 1px solid var(--line); animation: gem-fade .2s ease; flex-shrink: 0; }
.gem-eg__share-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--accent2); margin-bottom: 9px; }
.gem-eg__share-row { display: flex; gap: 9px; }
.gem-eg__share-input { flex: 1; min-width: 0; padding: 11px 14px; border: 1px solid var(--line2); border-radius: 11px; font-size: 13.5px; color: var(--fg) !important; background: var(--bg) !important; }
.gem-eg__share-input:focus { outline: none; border-color: var(--accent); }
.gem-eg__share-copy { flex-shrink: 0; padding: 11px 18px; border-radius: 12px; border: 0 !important; background: linear-gradient(135deg, var(--grad1), var(--grad2)) !important; color: #fff !important; font-size: 13.5px; font-weight: 600; touch-action: manipulation; box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 2px rgba(0,0,0,.2); transition: filter .15s, box-shadow .2s, transform .12s; }
.gem-eg__share-copy:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 6px 16px -8px rgba(43,138,158,.5); }
.gem-eg__share-copy.is-done { background: linear-gradient(135deg, #34d399, #059669) !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 4px 12px -6px rgba(5,150,105,.45) !important; }

.gem-eg__frame-wrap { background: #fff; flex: 1; min-height: 0; }
.gem-eg__frame { display: block; width: 100%; height: 680px; border: 0; background: #fff; transition: height .25s ease; }

/* ---- Result footer (red warning + unified new button) ---- */
.gem-eg__result-foot {
  padding: 18px; background: var(--bg3); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  flex-shrink: 0;
}
.gem-eg__warn {
  display: flex; align-items: flex-start; gap: 11px;
  width: 100%; max-width: 560px;
  padding: 13px 16px; border-radius: 14px;
  background: rgba(255,107,107,.1);
  border: 1px solid rgba(255,107,107,.32);
  font-size: 13px; line-height: 1.5; color: #ff9b9b;
}
.gem-eg__warn svg { flex-shrink: 0; color: var(--err); margin-top: 1px; }

/* =================================================================
   SPLIT LAYOUT — eredmény a jobb oldalon (asztali gép, >=1024px)
   ================================================================= */
@media (min-width: 1024px) {
  .gem-eg.is-result .gem-eg__shell {
    max-width: 1360px;
    display: grid;
    grid-template-columns: 400px minmax(0, 1fr);
    gap: 30px;
    align-items: start;
  }
  .gem-eg.is-result .gem-eg__main {
    position: sticky; top: clamp(24px, 5vh, 56px);
  }
  .gem-eg.is-result .gem-eg__hero { margin-bottom: 22px; }
  .gem-eg.is-result .gem-eg__greeting { font-size: 30px; }
  .gem-eg.is-result .gem-eg__result {
    margin-top: 0;
    position: sticky; top: clamp(24px, 5vh, 56px);
    height: calc(100vh - clamp(48px, 10vh, 112px));
  }
  .gem-eg.is-result .gem-eg__frame { height: 100% !important; } /* panel görget belül */
}

/* ---- Tablet / Mobile (<1024px): stacked, full width ---- */
@media (max-width: 1023px) {
  .gem-eg.is-result .gem-eg__shell { max-width: 860px; }
  .gem-eg__result { /* auto magasság, JS állítja az iframe-et */ }
}

@media (max-width: 640px) {
  .gem-eg { padding: 64px 14px 34px !important; min-height: auto; }
  .gem-eg__back span { display: none; }
  .gem-eg__back { padding: 9px; }
  .gem-eg__composer { border-radius: 20px; }
  .gem-eg__result { border-radius: 18px; }
  .gem-eg__generate { padding: 17px 24px; font-size: 16px; }
  .gem-eg__toolbar { gap: 10px; }
  .gem-eg__tool span { display: none; }
  .gem-eg__tool { padding: 11px; }
  .gem-eg__quote { min-width: 0; font-size: 12px; }
}
