/* ==================================================================
   Build My Rooftop Garden
   ================================================================== */

.rg-page {
    position: relative;
    width: 100%;
}

.rg-page-app {
    height: calc(100dvh - var(--header-h));
    min-height: 560px;
}

.rg-page-demo {
    height: min(880px, calc(100dvh - 124px));
    min-height: 600px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--s-4);
}

@media (max-width: 991.98px) {
    .rg-page-demo { padding: 0; height: calc(100dvh - 72px); }
}

.rg {
    --glass: rgba(255, 255, 255, 0.9);
    --glass-strong: rgba(255, 255, 255, 0.97);
    --glass-border: rgba(255, 255, 255, 0.7);
    --rg-shadow: 0 8px 28px rgba(15, 59, 33, 0.16), 0 1px 3px rgba(15, 59, 33, 0.08);
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    isolation: isolate;
    font-family: var(--font-body);
    color: var(--ink);
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.rg-page-demo .rg {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

@media (max-width: 767.98px) {
    .rg-page-demo .rg { border-radius: 0; }
}

.rg input, .rg textarea, .rg select { -webkit-user-select: text; user-select: text; }
.rg [hidden] { display: none !important; }

/* ------------------------------------------------------------------
   Stage & sky
   ------------------------------------------------------------------ */
.rg-stage {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #8ED0F0 0%, #CDEBF5 52%, #F1EFDA 100%);
    transition: background 1.2s ease;
}

.rg-stage[data-sky="dawn"] { background: linear-gradient(180deg, #F2A97F 0%, #F7D4B0 52%, #F7EEDB 100%); }
.rg-stage[data-sky="dusk"] { background: linear-gradient(180deg, #6C64A8 0%, #EE9A7C 55%, #F5D6A6 100%); }
.rg-stage[data-sky="night"] { background: linear-gradient(180deg, #081734 0%, #182B55 55%, #2E3D66 100%); }
.rg-stage[data-sky="rain"] { background: linear-gradient(180deg, #6F8698 0%, #A3B4C0 55%, #C9D1D4 100%); }
.rg-stage[data-sky="heat"] { background: linear-gradient(180deg, #F3B769 0%, #F8DDA6 55%, #FBF0D6 100%); }

.rg-sun {
    position: absolute;
    top: 12%;
    right: 12%;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: radial-gradient(circle, #FFF6C9 0%, #FFE27A 45%, rgba(255, 226, 122, 0) 72%);
    opacity: 0.9;
    transition: opacity 1s ease, background 1s ease;
    pointer-events: none;
}

.rg-stage[data-sky="night"] .rg-sun {
    background: radial-gradient(circle, #F4F1E4 0%, #DCD8C8 38%, rgba(220, 216, 200, 0) 62%);
    width: 60px;
    height: 60px;
}

.rg-stage[data-sky="rain"] .rg-sun { opacity: 0; }

.rg-canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
    cursor: grab;
    touch-action: none;
}

.rg-canvas:active { cursor: grabbing; }
.rg[data-tool="water"] .rg-canvas,
.rg[data-tool="feed"] .rg-canvas,
.rg[data-tool="spray"] .rg-canvas,
.rg[data-tool="harvest"] .rg-canvas { cursor: pointer; }
.rg[data-tool="remove"] .rg-canvas { cursor: not-allowed; }

.rg-loading, .rg-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--s-3);
    text-align: center;
    color: var(--green-900);
    font-family: var(--font-display);
    font-weight: 600;
    z-index: 5;
    padding: var(--s-6);
}

.rg-loading-leaf {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--glass);
    box-shadow: var(--rg-shadow);
    font-size: 1.6rem;
    color: var(--green-600);
    animation: rg-bob 1.4s ease-in-out infinite;
}

.rg-fallback i { font-size: 2rem; color: var(--clay); }
.rg-fallback p { max-width: 36ch; }

@keyframes rg-bob { 50% { transform: translateY(-8px) rotate(-6deg); } }

/* ------------------------------------------------------------------
   Glass surfaces
   ------------------------------------------------------------------ */
.rg-hud > *, .rg-quick, .rg-save, .rg-dock, .rg-zoom, .rg-tool-hint, .rg-place-banner, .rg-sheet, .rg-toast {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--rg-shadow);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    backdrop-filter: blur(14px) saturate(1.3);
}

.rg button { font-family: var(--font-display); }
.rg button:focus-visible { outline: none; box-shadow: var(--ring); }

/* ------------------------------------------------------------------
   HUD
   ------------------------------------------------------------------ */
.rg-hud {
    position: absolute;
    z-index: 10;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    pointer-events: none;
}

.rg-hud > * { pointer-events: auto; border-radius: 16px; }

.rg-level {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    border: 0;
    color: var(--ink);
    text-align: left;
    min-width: 0;
}

.rg-ring {
    --progress: 0;
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: conic-gradient(var(--leaf) calc(var(--progress) * 1%), rgba(15, 59, 33, 0.12) 0);
    font-weight: 800;
    font-size: 1.05rem;
    color: #fff;
}

.rg-ring::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--green-600), var(--green-900));
}

.rg-ring span { position: relative; }

.rg-level-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.rg-level-text strong { font-size: 0.9rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-level-text small { font-size: 0.72rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }

.rg-stats-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
}

.rg-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rg-stat strong { font-weight: 800; }
.rg-stat + .rg-stat { border-left: 1px solid rgba(15, 59, 33, 0.08); border-radius: 0 12px 12px 0; }
.tone-seeds { color: var(--green-600); }
.tone-water { color: #2F8FD0; }
.tone-health { color: #E0485F; }
.tone-leaf { color: var(--leaf); }

.rg-stat-water { flex-wrap: wrap; row-gap: 2px; }
.rg-mini-bar {
    display: block;
    width: 48px;
    height: 5px;
    border-radius: 99px;
    background: rgba(47, 143, 208, 0.16);
    overflow: hidden;
}

.rg-mini-bar span { display: block; height: 100%; background: linear-gradient(90deg, #5DB7EC, #2F8FD0); border-radius: inherit; transition: width .4s ease; }

.rg-clock {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 12px;
}

.rg-weather { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rg-weather > i { font-size: 1.25rem; color: #F2A60C; width: 24px; text-align: center; }
.rg-weather span { display: flex; flex-direction: column; line-height: 1.15; }
.rg-weather strong { font-family: var(--font-display); font-size: 0.88rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rg-weather small { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

.rg-speed {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 12px;
    background: rgba(15, 59, 33, 0.06);
}

.rg-speed button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink-2);
    font-size: 0.85rem;
}

.rg-speed button:hover { background: rgba(255, 255, 255, 0.8); }
.rg-speed button[aria-pressed="true"] { background: var(--green-700); color: #fff; box-shadow: 0 2px 6px rgba(15, 59, 33, 0.25); }

/* ------------------------------------------------------------------
   Quick actions, save status, hints
   ------------------------------------------------------------------ */
.rg-quickbar {
    position: absolute;
    z-index: 9;
    top: 78px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    pointer-events: none;
}

.rg-quick-list { display: flex; flex-wrap: wrap; gap: 6px; }

.rg-quick {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 6px 14px 6px 8px;
    border-radius: 99px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink);
    animation: rg-in .35s var(--ease) both;
}

.rg-quick i {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #fff;
    font-size: 0.75rem;
}

.rg-quick.is-ready i { background: #E7A80D; }
.rg-quick.is-thirsty i { background: #2F8FD0; }
.rg-quick.is-pests i { background: #8A5A2B; }
.rg-quick.is-hungry i { background: #9C7B3C; }
.rg-quick:hover { transform: translateY(-1px); }

.rg-save {
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.rg-save[data-status="saving"] i { color: var(--sky); animation: rg-pulse 1s infinite; }
.rg-save[data-status="saved"] i { color: var(--green-600); }
.rg-save[data-status="error"] { color: var(--danger); }
.rg-save[data-status="error"] i { color: var(--danger); }

@keyframes rg-pulse { 50% { opacity: .4; } }
@keyframes rg-in { from { opacity: 0; transform: translateY(-6px) scale(.96); } }

.rg-tool-hint, .rg-place-banner {
    position: absolute;
    z-index: 11;
    left: 50%;
    bottom: 104px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100% - 24px);
    padding: 8px 8px 8px 14px;
    border-radius: 99px;
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    animation: rg-in .3s var(--ease) both;
}

.rg-tool-hint i { color: var(--green-600); }
.rg-tool-hint span, .rg-place-banner span:not(.rg-place-icon) { overflow: hidden; text-overflow: ellipsis; }
.rg-tool-hint button {
    border: 0;
    border-radius: 99px;
    padding: 6px 14px;
    background: var(--green-700);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
}

.rg-place-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--green-100);
    color: var(--green-700);
}

.rg-place-banner .btn { min-height: 34px; border-radius: 99px; }

/* ------------------------------------------------------------------
   Zoom
   ------------------------------------------------------------------ */
.rg-zoom {
    position: absolute;
    z-index: 9;
    right: 12px;
    bottom: 104px;
    display: flex;
    flex-direction: column;
    padding: 4px;
    border-radius: 14px;
}

.rg-zoom button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink-2);
}

.rg-zoom button:hover { background: var(--green-50); color: var(--green-800); }

/* ------------------------------------------------------------------
   Dock
   ------------------------------------------------------------------ */
.rg-dock {
    position: absolute;
    z-index: 10;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 22px;
    max-width: calc(100% - 24px);
}

.rg-tools, .rg-menu { display: flex; gap: 2px; }
.rg-menu { padding-left: 6px; border-left: 1px solid rgba(15, 59, 33, 0.1); }

.rg-dock button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 58px;
    height: 58px;
    padding: 4px 6px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--ink-2);
    font-size: 0.7rem;
    font-weight: 700;
    transition: background-color .15s, color .15s, transform .15s;
}

.rg-dock button i { font-size: 1.1rem; }
.rg-dock button:hover { background: var(--green-50); color: var(--green-800); }
.rg-dock button[aria-pressed="true"], .rg-dock button[aria-expanded="true"] { background: var(--green-700); color: #fff; }
.rg-dock button.is-build { background: linear-gradient(160deg, var(--leaf), var(--green-600)); color: #fff; }
.rg-dock button.is-build:hover { filter: brightness(1.05); color: #fff; }
.rg-dock button.is-build[aria-expanded="true"] { background: var(--green-900); }

.rg-dock button em {
    position: absolute;
    top: 4px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 99px;
    background: var(--ink);
    color: #fff;
    font-style: normal;
    font-size: 10px;
    line-height: 18px;
    font-variant-numeric: tabular-nums;
}

.rg-dock button[data-arg="quests"] em { background: var(--danger); }

/* ------------------------------------------------------------------
   Sheets
   ------------------------------------------------------------------ */
.rg-sheet {
    position: absolute;
    z-index: 20;
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: min(400px, calc(100% - 24px));
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    background: var(--glass-strong);
    overflow: hidden;
    animation: rg-sheet-in .3s var(--ease) both;
    -webkit-user-select: text;
    user-select: text;
}

@keyframes rg-sheet-in { from { opacity: 0; transform: translateX(24px); } }

@media (min-width: 768px) {
    .rg.has-sheet .rg-dock { left: calc((100% - 424px) / 2); max-width: calc(100% - 448px); overflow-x: auto; scrollbar-width: none; }
    .rg.has-sheet .rg-dock::-webkit-scrollbar { display: none; }
    .rg.has-sheet .rg-zoom { right: 424px; }
    .rg.has-sheet .rg-tool-hint, .rg.has-sheet .rg-place-banner, .rg.has-sheet .rg-toasts { left: calc((100% - 424px) / 2); }
    .rg.has-sheet .rg-hud, .rg.has-sheet .rg-quickbar { right: 424px; }
}

.rg-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 14px 10px 18px;
}

.rg-sheet-head h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.1rem;
}

.rg-sheet-head h2 i { color: var(--green-600); }
.rg-sheet-head.is-floating { position: absolute; top: 0; right: 0; z-index: 2; padding: 12px; }

.rg-close {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    background: rgba(15, 59, 33, 0.06);
    color: var(--ink-2);
}

.rg-close:hover { background: var(--green-100); }

.rg-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 18px 20px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.rg-sheet-head.is-floating + .rg-sheet-body { padding-top: 18px; }

.rg-eyebrow {
    margin: 0 0 2px;
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--green-600);
}

.rg-subhead {
    margin: 18px 0 8px;
    font-size: 0.8rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.rg-sheet-note {
    display: flex;
    gap: 8px;
    margin: 4px 0 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--green-50);
    color: var(--green-800);
    font-size: 0.8rem;
    line-height: 1.4;
}

.rg-sheet-note i { margin-top: 2px; }

/* Shop */
.rg-shop-tabs {
    display: flex;
    gap: 4px;
    margin: 0 14px 10px;
    padding: 4px;
    border-radius: 14px;
    background: rgba(15, 59, 33, 0.06);
    overflow-x: auto;
    scrollbar-width: none;
}

.rg-shop-tabs::-webkit-scrollbar { display: none; }

.rg-shop-tabs button {
    flex: 1 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 6px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.rg-shop-tabs button[aria-selected="true"] { background: #fff; color: var(--green-800); box-shadow: 0 1px 4px rgba(15, 59, 33, .12); }

.rg-cards { display: grid; gap: 8px; }

.rg-card {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 12px 8px 8px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    color: var(--ink);
    text-align: left;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}

.rg-card:hover:not(:disabled) { border-color: var(--green-500); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.rg-card.is-locked { opacity: .62; background: var(--surface-2); }
.rg-card.is-unaffordable .rg-price { color: var(--danger); }

.rg-icon {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 14px;
    background: radial-gradient(circle at 50% 70%, #F2E6D6 0%, #F8F3EC 70%);
    overflow: hidden;
}

.rg-icon img { max-width: 92%; max-height: 92%; object-fit: contain; }
.rg-icon.sm { width: 44px; height: 44px; border-radius: 12px; }
.rg-icon.lg { width: 88px; height: 88px; border-radius: 18px; }

.rg-card-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rg-card-title { font-family: var(--font-display); font-weight: 800; font-size: 0.95rem; }
.rg-card-desc { font-size: 0.76rem; color: var(--muted); line-height: 1.35; }

.rg-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.rg-tags span {
    padding: 1px 7px;
    border-radius: 99px;
    background: var(--green-50);
    color: var(--green-800);
    font-size: 0.66rem;
    font-weight: 600;
    white-space: nowrap;
}

.rg-price {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-display);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--green-700);
    white-space: nowrap;
}

.rg-price i { font-size: .8em; }

.rg-lock {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 99px;
    background: rgba(15, 59, 33, .08);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Inspect */
.rg-inspect-head {
    display: flex;
    gap: 14px;
    align-items: center;
    padding-right: 40px;
    margin-bottom: 14px;
}

.rg-inspect-head h3 { margin: 0 0 2px; font-size: 1.2rem; }
.rg-inspect-head p:last-child { margin: 0; font-size: 0.8rem; color: var(--muted); line-height: 1.4; }

.rg-plant {
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}

.rg-plant header { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.rg-plant h4 { margin: 0; font-size: 1rem; }
.rg-plant header p { margin: 0; font-size: 0.76rem; color: var(--muted); }
.rg-status { font-weight: 700; color: var(--green-700); }
.rg-plant.is-thirsty .rg-status, .rg-plant.is-hungry .rg-status { color: #B7791F; }
.rg-plant.is-wilting .rg-status, .rg-plant.is-pests .rg-status, .rg-plant.is-dead .rg-status { color: var(--danger); }
.rg-plant.is-ready { border-color: #E7C45A; box-shadow: 0 0 0 3px rgba(231, 196, 90, .25); }
.rg-plant.is-dead { background: var(--surface-2); }

.rg-growth {
    height: 6px;
    margin-bottom: 10px;
    border-radius: 99px;
    background: var(--green-50);
    overflow: hidden;
}

.rg-growth span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--leaf), var(--green-600)); transition: width .4s; }

.rg-need {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    font-size: 0.76rem;
}

.rg-need-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.rg-need-label i { width: 14px; text-align: center; }
.rg-need-bar { height: 7px; border-radius: 99px; background: rgba(15, 59, 33, .08); overflow: hidden; }
.rg-need-bar span { display: block; height: 100%; border-radius: inherit; transition: width .4s; }
.rg-need-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); }
.rg-need.tone-water i, .rg-need.tone-water .rg-need-bar span { color: #2F8FD0; background: #2F8FD0; }
.rg-need.tone-feed i, .rg-need.tone-feed .rg-need-bar span { color: #9C7B3C; background: #9C7B3C; }
.rg-need.tone-health i, .rg-need.tone-health .rg-need-bar span { color: #E0485F; background: #E0485F; }
.rg-need.tone-pests i, .rg-need.tone-pests .rg-need-bar span { color: #6B4A2B; background: #6B4A2B; }
.rg-need i { background: none !important; }
.rg-need.is-low .rg-need-val { color: var(--danger); }
.rg-need.tone-pests.is-low .rg-need-val { color: var(--ink-2); }

.rg-plant-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rg-plant-actions .btn { flex: 1 1 auto; min-height: 38px; border-radius: 12px; }
.rg-plant-actions .btn small { font-weight: 600; opacity: .7; }

.rg-tip {
    display: flex;
    gap: 8px;
    margin: 10px 0 0;
    font-size: 0.76rem;
    color: var(--muted);
    line-height: 1.4;
}

.rg-tip i { color: #E7A80D; margin-top: 2px; }

.rg-empty-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px;
    margin-bottom: 10px;
    border: 2px dashed var(--border-strong);
    border-radius: 16px;
    background: transparent;
    color: var(--green-700);
    text-align: left;
    font-weight: 700;
}

.rg-empty-slot:hover { border-color: var(--green-500); background: var(--green-50); }
.rg-empty-slot > i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--green-100); }
.rg-empty-slot span { display: flex; flex-direction: column; }
.rg-empty-slot small { color: var(--muted); font-weight: 600; }

.rg-picker h4 { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 8px; font-size: 1rem; }
.rg-picker h4 small { color: var(--muted); font-size: .75rem; }
.rg-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }

.rg-seed {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    text-align: center;
}

.rg-seed:hover { border-color: var(--green-500); box-shadow: var(--shadow-md); }
.rg-seed.is-disabled { opacity: .55; }
.rg-seed.is-disabled:hover { box-shadow: none; border-color: var(--border); }
.rg-seed-name { font-size: 0.78rem; font-weight: 700; line-height: 1.2; }
.rg-seed-reason { font-size: 0.64rem; color: var(--muted); line-height: 1.2; font-family: var(--font-body); font-weight: 500; }

.rg-effect {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: var(--green-50);
    color: var(--green-900);
    font-size: 0.84rem;
    line-height: 1.45;
}

.rg-effect i { color: var(--green-600); margin-top: 3px; }
.rg-inspect-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
.rg-inspect-foot .btn small { font-weight: 600; opacity: .8; }

/* Quests */
.rg-level-card { display: flex; gap: 14px; align-items: center; padding-right: 40px; }
.rg-level-card h3 { margin: 0; font-size: 1.25rem; }
.rg-level-card p:last-child { margin: 2px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }

.rg-level-badge {
    flex: none;
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: linear-gradient(160deg, var(--leaf), var(--green-800));
    color: #fff;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.6rem;
    box-shadow: 0 6px 16px rgba(15, 59, 33, .25);
}

.rg-next { margin-top: 14px; padding: 12px; border-radius: 16px; background: #fff; border: 1px solid var(--border); }
.rg-next-top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.8rem; margin-bottom: 6px; }
.rg-next-top span:last-child { color: var(--muted); font-weight: 600; white-space: nowrap; }

.rg-xpbar { height: 9px; border-radius: 99px; background: var(--green-50); overflow: hidden; }
.rg-xpbar.sm { height: 5px; margin: 4px 0 2px; }
.rg-xpbar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--leaf), var(--green-600)); }

.rg-unlocks { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 10px 0 0; font-size: 0.74rem; color: var(--muted); }
.rg-unlocks span { padding: 2px 8px; border-radius: 99px; background: var(--harvest-100); color: #7A5A00; font-weight: 700; }

.rg-quests { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rg-quests li {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--border);
}

.rg-quests p { margin: 0; font-weight: 600; font-size: 0.86rem; line-height: 1.3; }
.rg-quests small { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rg-quest-check { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--green-50); color: var(--green-600); }
.rg-quests li.is-done { background: var(--green-50); border-color: transparent; }
.rg-quests li.is-done .rg-quest-check { background: var(--green-600); color: #fff; }
.rg-quests li.is-done p { color: var(--muted); }
.rg-reward { font-family: var(--font-display); font-size: 0.7rem; font-weight: 800; color: var(--green-700); text-align: right; line-height: 1.35; white-space: nowrap; }

/* Journal */
.rg-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-right: 0; }
.rg-stats div { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 4px; border-radius: 14px; background: #fff; border: 1px solid var(--border); text-align: center; }
.rg-stats i { color: var(--green-600); font-size: .9rem; }
.rg-stats strong { font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rg-stats span { font-size: 0.66rem; color: var(--muted); font-weight: 600; line-height: 1.2; }

.rg-journal { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rg-journal button {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto 20px;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 6px 10px 6px 6px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    text-align: left;
}

.rg-journal button:hover { border-color: var(--green-500); }
.rg-journal strong { display: block; font-size: 0.86rem; }
.rg-journal small { display: block; font-size: 0.7rem; color: var(--muted); font-family: var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-journal-meters { display: flex; gap: 8px; font-size: 0.72rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.rg-journal-meters i { margin-right: 3px; }
.rg-journal-meters span:first-child i { color: #2F8FD0; }
.rg-journal-meters span:last-child i { color: #E0485F; }
.rg-journal-flag i { color: #E7A80D; }
.rg-journal li.is-thirsty .rg-journal-flag i, .rg-journal li.is-hungry .rg-journal-flag i { color: #B7791F; }
.rg-journal li.is-wilting .rg-journal-flag i, .rg-journal li.is-dead .rg-journal-flag i, .rg-journal li.is-pests .rg-journal-flag i { color: var(--danger); }
.rg-journal li.is-dead button { background: var(--surface-2); }

.rg-empty { text-align: center; padding: 20px 10px; color: var(--muted); }
.rg-empty > i { font-size: 1.6rem; color: var(--green-500); }

.rg-log { list-style: none; margin: 0; padding: 0; font-size: 0.8rem; }
.rg-log li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.rg-log li span { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.rg-log li.is-death { color: var(--danger); }
.rg-log li.is-level, .rg-log li.is-quest { color: var(--green-800); font-weight: 600; }

/* Roof */
.rg-roof-head { display: flex; gap: 14px; align-items: center; padding-right: 40px; margin-bottom: 12px; }
.rg-roof-head h3 { margin: 0; font-size: 1.2rem; }
.rg-roof-thumb { flex: none; width: 76px; height: 76px; border-radius: 16px; background: var(--green-50); padding: 6px; }
.rg-roof-thumb polygon { fill: #D9B28C; stroke: var(--green-700); stroke-width: 2; stroke-linejoin: round; }
.rg-dl { margin: 0; display: grid; gap: 0; }
.rg-dl div { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.86rem; }
.rg-dl dt { color: var(--muted); font-weight: 600; }
.rg-dl dd { margin: 0; font-weight: 600; }
.rg-dl small { color: var(--muted); font-weight: 500; }
.rg-roof-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ------------------------------------------------------------------
   Roof editor
   ------------------------------------------------------------------ */
.rg-editor {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    background: linear-gradient(160deg, #EAF4EC 0%, #F6F3EA 100%);
    animation: rg-fade .35s ease both;
    -webkit-user-select: none;
    user-select: none;
}

@keyframes rg-fade { from { opacity: 0; } }

.rg-editor-map {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 16px;
    gap: 10px;
}

.rg-editor-intro-mobile { display: none; }
.rg-editor-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rg-extent { display: flex; align-items: center; gap: 8px; margin-right: auto; font-family: var(--font-display); font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.rg-extent .form-select { width: auto; min-height: 36px; }

.rg-editor-svg {
    flex: 1;
    width: 100%;
    min-height: 0;
    border-radius: 18px;
    touch-action: none;
    cursor: crosshair;
    background: #fff;
    box-shadow: var(--shadow-md);
}

.rg-map-bg { fill: #FBFDF9; }
.rg-map-grid line { vector-effect: non-scaling-stroke; }
.rg-map-grid line.minor { stroke: #E8EFE6; stroke-width: 1; }
.rg-map-grid line.major { stroke: #CFDDCB; stroke-width: 1; }
.rg-map-axis text { fill: var(--subtle); font-family: var(--font-display); font-weight: 600; }
.rg-map-help { fill: var(--muted); font-family: var(--font-display); font-weight: 700; pointer-events: none; }
.rg-map-help.sub { font-weight: 500; }
.rg-roof-fill { fill: rgba(217, 178, 140, 0.55); }
.rg-roof-fill.is-invalid { fill: rgba(192, 57, 43, 0.18); }
.rg-hatch-line { stroke: rgba(184, 138, 99, 0.35); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rg-roof-hatch { pointer-events: none; }
.rg-edge { stroke: var(--green-700); stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rg-edge.is-closing { stroke-dasharray: 6 5; }
.rg-edge.is-invalid { stroke: var(--danger); }
.rg-edge.is-preview { stroke: var(--green-500); stroke-width: 2; stroke-dasharray: 4 5; opacity: .7; pointer-events: none; }
.rg-edge-label rect { fill: #fff; stroke: #D9E4D5; stroke-width: 1; vector-effect: non-scaling-stroke; }
.rg-edge-label text { fill: var(--green-900); font-family: var(--font-display); font-weight: 700; pointer-events: none; }
.rg-edge-label { pointer-events: none; }
.rg-mid { cursor: copy; }
.rg-mid circle { fill: #fff; stroke: var(--green-600); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.rg-mid path { stroke: var(--green-700); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.rg-vertex { cursor: move; }
.rg-vertex-hit { fill: transparent; }
.rg-vertex-dot { fill: #fff; stroke: var(--green-700); stroke-width: 3; vector-effect: non-scaling-stroke; }
.rg-vertex.is-first .rg-vertex-dot { fill: var(--leaf); }
.rg-vertex:hover .rg-vertex-dot { fill: var(--green-100); }
.rg-cursor { fill: var(--green-600); opacity: .5; pointer-events: none; }

.rg-readout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rg-readout div { display: flex; flex-direction: column; align-items: center; padding: 8px; border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); }
.rg-readout strong { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; color: var(--green-800); }
.rg-readout span { font-size: 0.7rem; color: var(--muted); font-weight: 600; }
.rg-editor-tip { margin: 0; font-size: 0.74rem; color: var(--muted); text-align: center; }

.rg-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 22px 22px 18px;
    background: #fff;
    border-left: 1px solid var(--border);
    overflow-y: auto;
    -webkit-user-select: text;
    user-select: text;
}

.rg-editor-panel h2 { margin: 0; font-size: 1.6rem; }
.rg-editor-lead { margin: -4px 0 0; color: var(--muted); font-size: 0.9rem; }
.rg-editor-hint { display: flex; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--sky-100); color: #1F4F75; font-size: .82rem; }
.rg-fieldset { margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 16px; display: grid; gap: 8px; }
.rg-fieldset legend { float: none; width: auto; margin: 0 0 -2px; padding: 0 6px; font-family: var(--font-display); font-size: 0.8rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--green-700); }
.rg-fieldset .form-label { margin: 4px 0 2px; }
.rg-preset-size { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rg-preset-size label { font-size: 0.78rem; font-weight: 700; color: var(--ink-2); font-family: var(--font-display); }
.rg-unit-input { position: relative; display: block; margin-top: 4px; }
.rg-unit-input .form-control { padding-right: 30px; }
.rg-unit-input > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--subtle); font-weight: 600; }
.rg-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rg-presets button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: .74rem; font-weight: 700; }
.rg-presets button:hover { border-color: var(--green-500); background: var(--green-50); color: var(--green-800); }
.rg-presets svg { width: 40px; height: 30px; }
.rg-presets path { fill: #E7CDB2; stroke: var(--green-700); stroke-width: 2; stroke-linejoin: round; }
.rg-readout-grid { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--green-50); color: var(--green-800); font-size: .82rem; font-weight: 600; }
.rg-two { display: grid; grid-template-columns: minmax(0, 1fr) 100px; gap: 8px; }
.rg-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rg-choice label { position: relative; }
.rg-choice input { position: absolute; opacity: 0; }
.rg-choice span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border: 1px solid var(--border); border-radius: 12px; text-align: center; cursor: pointer; transition: border-color .15s, background-color .15s; }
.rg-choice span i { color: #E7A80D; font-size: 1.1rem; }
.rg-choice span strong { font-family: var(--font-display); font-size: .8rem; }
.rg-choice span small { font-size: .66rem; color: var(--muted); }
.rg-choice input:checked + span { border-color: var(--green-600); background: var(--green-50); box-shadow: inset 0 0 0 1px var(--green-600); }
.rg-choice input:focus-visible + span { box-shadow: var(--ring); }
.rg-editor-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: auto; padding-top: 6px; }
.rg-editor-actions .btn-primary { flex: 1; }
.rg-editor-actions .btn.is-busy { opacity: .7; pointer-events: none; }

/* ------------------------------------------------------------------
   Modal & toasts
   ------------------------------------------------------------------ */
.rg-modal { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; }
.rg-modal-backdrop { position: absolute; inset: 0; background: rgba(8, 30, 17, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: rg-fade .25s both; }

.rg-modal-card {
    position: relative;
    width: min(460px, 100%);
    max-height: calc(100% - 16px);
    overflow-y: auto;
    padding: 26px 24px 20px;
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: rg-pop .4s var(--ease) both;
    -webkit-user-select: text;
    user-select: text;
}

@keyframes rg-pop { from { opacity: 0; transform: translateY(12px) scale(.95); } }

.rg-modal-card h2 { font-size: 1.4rem; margin: 0 0 8px; }
.rg-modal-card h2:focus { outline: none; }
.rg-modal-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: -2px auto 12px; border-radius: 20px; background: var(--green-100); color: var(--green-700); font-size: 1.6rem; }
.rg-modal-card.is-celebrate .rg-modal-icon { background: linear-gradient(160deg, #FFE27A, #F2A60C); color: #fff; box-shadow: 0 8px 20px rgba(242, 166, 12, .35); }
.rg-modal-card.is-danger .rg-modal-icon { background: var(--danger-bg); color: var(--danger); }
.rg-modal-body { color: var(--ink-2); font-size: .92rem; }
.rg-modal-body p { margin: 0 0 10px; }
.rg-modal-sub { font-size: .8rem; color: var(--muted); font-weight: 600; }
.rg-modal-actions { display: flex; flex-wrap: wrap-reverse; justify-content: center; gap: 8px; margin-top: 16px; }
.rg-modal-actions .btn { flex: 1 1 auto; }

.rg-steps { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.rg-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: .86rem; line-height: 1.4; }
.rg-steps i { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 10px; background: var(--green-100); color: var(--green-700); }

.rg-unlock-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.rg-unlock-list li { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 84px; font-size: .72rem; font-weight: 700; line-height: 1.2; }
.rg-unlock-list .rg-icon.sm { width: 56px; height: 56px; }

.rg-away { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.rg-away li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: .86rem; font-weight: 600; }
.rg-away li i { width: 18px; text-align: center; color: var(--muted); }
.rg-away li.is-good i { color: var(--green-600); }
.rg-away li.is-warn i { color: #B7791F; }
.rg-away li.is-bad { color: var(--danger); }
.rg-away li.is-bad i { color: var(--danger); }

.rg-toasts {
    position: absolute;
    z-index: 35;
    top: 132px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: min(440px, calc(100% - 24px));
    pointer-events: none;
}

.rg-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 16px;
    background: rgba(23, 35, 27, .92);
    border-color: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: .86rem;
    font-weight: 600;
    line-height: 1.35;
    animation: rg-in .3s var(--ease) both;
}

.rg-toast i { flex: none; }
.rg-toast.is-success i { color: #7FDB9C; }
.rg-toast.is-warn i { color: #FFD166; }
.rg-toast.is-error i { color: #FF8A7A; }
.rg-toast.is-info i { color: #8EC9F0; }
.rg-toast.is-level { background: linear-gradient(135deg, #1E6B3C, #0F3B21); }
.rg-toast.is-level i { color: #FFE27A; }
.rg-toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity .35s, transform .35s; }

/* ------------------------------------------------------------------
   Public demo page chrome
   ------------------------------------------------------------------ */
.rg-intro { padding: var(--s-8) var(--s-4) var(--s-6); background: linear-gradient(180deg, var(--green-50), var(--canvas)); }
.rg-intro-inner { max-width: 1440px; margin: 0 auto; padding: 0 var(--s-4); display: grid; gap: var(--s-6); align-items: end; grid-template-columns: minmax(0, 1fr); }
.rg-intro h1 { font-size: var(--fs-3xl); letter-spacing: -.03em; margin: 4px 0 8px; }
.rg-intro-lead { max-width: 62ch; color: var(--ink-2); font-size: 1.05rem; margin: 0; }
.rg-intro-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rg-intro-points li { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 16px; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-sm); font-size: .82rem; color: var(--muted); }
.rg-intro-points i { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--green-100); color: var(--green-700); }
.rg-intro-points strong { display: block; color: var(--ink); font-family: var(--font-display); font-size: .9rem; }

@media (min-width: 1100px) {
    .rg-intro-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 560px); }
}

@media (max-width: 767.98px) {
    .rg-intro { padding: var(--s-6) 0 var(--s-4); }
    .rg-intro-points { grid-template-columns: minmax(0, 1fr); }
    .rg-intro-points li { padding: 8px 12px; }
}

.rg-join { padding: var(--s-10) var(--s-4); }
.rg-join-inner { max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: var(--s-5); align-items: center; justify-content: space-between; padding: var(--s-8); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--green-800), var(--green-900)); color: #DCEADF; }
.rg-join h2 { color: #fff; margin: 0 0 6px; }
.rg-join p { margin: 0; max-width: 60ch; }
.rg-join-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rg-join .btn-secondary { --bs-btn-bg: transparent; --bs-btn-color: #fff; --bs-btn-border-color: rgba(255,255,255,.4); --bs-btn-hover-bg: rgba(255,255,255,.1); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #fff; }

/* ------------------------------------------------------------------
   Phones & tablets
   ------------------------------------------------------------------ */
@media (max-width: 991.98px) {
    .rg-editor { display: block; overflow-y: auto; overscroll-behavior: contain; }
    .rg-editor-intro-mobile { display: block !important; padding: 4px 4px 2px; }
    .rg-editor-intro-title { margin: 0; font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink); line-height: 1.15; }
    .rg-editor-intro-lead { margin: 4px 0 0; font-size: .84rem; color: var(--muted); line-height: 1.45; }
    .rg-editor-panel > .rg-eyebrow, .rg-editor-panel > h2, .rg-editor-panel > .rg-editor-lead { display: none; }
    .rg-editor-map { padding: 10px; }
    .rg-editor-svg { flex: none; width: 100%; height: auto; aspect-ratio: 1 / 1; max-height: 62vh; min-height: 0; }
    .rg-editor-panel { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
    .rg-readout strong { font-size: 1rem; }
}

@media (max-width: 767.98px) {
    .rg-hud { top: 8px; left: 8px; right: 8px; gap: 6px; }
    .rg-level { padding: 4px 10px 4px 4px; flex: 1 1 0; }
    .rg-ring { width: 40px; height: 40px; font-size: .95rem; }
    .rg-level-text strong { font-size: .82rem; }
    .rg-clock { margin-left: 0; padding: 3px 3px 3px 10px; }
    .rg-weather small { display: none; }
    .rg-weather strong { font-size: .8rem; }
    .rg-speed button { width: 34px; height: 34px; }
    .rg-stats-bar { order: 3; flex: 1 1 100%; justify-content: space-between; padding: 2px 4px; }
    .rg-stat { padding: 5px 6px; font-size: .82rem; gap: 5px; }
    .rg-mini-bar { display: none; }
    .rg-quickbar { top: 116px; left: 8px; right: 8px; }
    .rg-save { display: none; }
    .rg-toasts { top: 164px; }

    .rg-dock { left: 8px; right: 8px; bottom: 8px; transform: none; max-width: none; justify-content: space-between; border-radius: 20px; padding: 4px; overflow-x: auto; scrollbar-width: none; }
    .rg-dock::-webkit-scrollbar { display: none; }
    .rg-dock button { min-width: 48px; height: 52px; padding: 2px 4px; font-size: .62rem; border-radius: 14px; }
    .rg-dock button i { font-size: 1rem; }
    .rg-menu { padding-left: 4px; }
    .rg-zoom { bottom: 76px; right: 8px; }
    .rg-zoom button { width: 36px; height: 36px; }
    .rg-tool-hint, .rg-place-banner { bottom: 72px; font-size: .78rem; white-space: normal; }

    .rg-sheet { top: auto; left: 8px; right: 8px; bottom: 74px; width: auto; max-height: calc(100% - 74px - 124px); border-radius: 22px; animation-name: rg-sheet-up; }
    .rg-sheet::before { content: ""; display: block; width: 44px; height: 5px; margin: 8px auto 0; border-radius: 99px; background: rgba(15, 59, 33, .18); flex: none; }
    .rg-sheet-head.is-floating { top: 8px; }
    .rg-card { grid-template-columns: 60px minmax(0, 1fr); }
    .rg-card .rg-icon { width: 60px; height: 60px; }
    .rg-card-foot { grid-column: 2; }
    .rg-need { grid-template-columns: 88px minmax(0, 1fr) 26px; }
}

@media (max-width: 575.98px) {
    .rg-sheet { bottom: 116px; max-height: calc(100% - 116px - 118px); }
    .rg-dock { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; overflow: visible; }
    .rg-tools, .rg-menu { display: contents; }
    .rg-dock button { min-width: 0; height: 46px; font-size: .6rem; gap: 2px; }
    .rg-dock button i { font-size: .95rem; }
    .rg-zoom { bottom: 124px; }
    .rg-zoom button[data-action="zoom-in"], .rg-zoom button[data-action="zoom-out"] { display: none; }
    .rg-tool-hint, .rg-place-banner { bottom: 122px; }
    .rg-level-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .rg-speed button { width: 32px; height: 32px; }
    .rg-weather { gap: 6px; }
    .rg-weather > i { font-size: 1.05rem; width: 20px; }
}

@media (max-width: 379.98px) {
    .hide-xs { display: none !important; }
    .rg-readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rg-choice { grid-template-columns: minmax(0, 1fr); }
}

@keyframes rg-sheet-up { from { opacity: 0; transform: translateY(40px); } }

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

/* ------------------------------------------------------------------
   Help, full screen
   ------------------------------------------------------------------ */
.rg-zoom-sep { display: block; height: 1px; margin: 4px 6px; background: rgba(15, 59, 33, .12); }
.rg-zoom button[aria-pressed="true"] { background: var(--green-700); color: #fff; }

.rg-help-title { margin: 0 44px 6px 0; font-size: 1.3rem; }
.rg-help-lead { margin: 0 0 12px; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.rg-help-block { padding: 12px 14px; margin-bottom: 8px; border-radius: 16px; background: #fff; border: 1px solid var(--border); font-size: .84rem; line-height: 1.5; color: var(--ink-2); }
.rg-help-block h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: .95rem; }
.rg-help-block h4 i { color: var(--green-600); width: 18px; text-align: center; }
.rg-help-block p, .rg-help-block ul, .rg-help-block ol { margin: 0; }
.rg-help-block ul, .rg-help-block ol { padding-left: 18px; display: grid; gap: 4px; }
.rg-help-block kbd { padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--ink); font-size: .75rem; font-family: var(--font-display); }

.rg-page:fullscreen { width: 100vw; height: 100vh; max-width: none; padding: 0; background: var(--canvas); }
.rg-page:-webkit-full-screen { width: 100vw; height: 100vh; max-width: none; padding: 0; background: var(--canvas); }
.rg-page:fullscreen .rg { border-radius: 0; box-shadow: none; }
.rg-page:-webkit-full-screen .rg { border-radius: 0; box-shadow: none; }
.rg-page.is-immersive { position: fixed; inset: 0; z-index: 2000; width: auto; height: 100dvh; max-width: none; margin: 0; padding: 0; background: var(--canvas); }
.rg-page.is-immersive .rg { border-radius: 0; box-shadow: none; }
html.rg-lock-scroll, html.rg-lock-scroll body { overflow: hidden; }

/* Roof editor: closing the outline */
.rg-editor-status { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 8px 12px; border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); font-size: .8rem; color: var(--ink-2); text-align: left; line-height: 1.35; }
.rg-editor-status i { color: var(--green-600); flex: none; }
.rg-editor-status.is-done { background: var(--green-50); color: var(--green-900); }
.rg-editor-status.is-flash { animation: rg-flash .6s ease 2; }
@keyframes rg-flash { 50% { background: var(--harvest-100); } }
.rg-vertex.is-closable { cursor: pointer; }
.rg-vertex.is-closable .rg-vertex-dot { fill: var(--leaf); stroke: var(--green-800); }
.rg-vertex-pulse { fill: var(--leaf); opacity: .35; transform-box: fill-box; transform-origin: center; animation: rg-vertex-pulse 1.3s ease-out infinite; pointer-events: none; }
@keyframes rg-vertex-pulse { from { transform: scale(.6); opacity: .55; } to { transform: scale(1.9); opacity: 0; } }
.rg-edge.is-snap { stroke: var(--leaf); stroke-dasharray: none; stroke-width: 3; opacity: 1; }
