[hidden]{display:none!important}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overscroll-behavior: none; }
body {
  background: #0a0f0c; color: #f2f2f2;
  font-family: -apple-system, "Segoe UI", Tahoma, sans-serif;
  display: flex; flex-direction: column; height: 100dvh;
  padding-top: env(safe-area-inset-top);
}
#topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid #1e2a22;
}
#app-title { font-weight: 800; font-size: 20px; color: #00c853; }
#date-label { font-size: 13px; color: #9aa; }
#tabs { display: flex; gap: 8px; padding: 10px 12px; justify-content: center; }
.tab {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid #2c3a30;
  background: #121a14; color: #ddd; font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.tab.active { border-color: #00c853; color: #00c853; }
.tab .chk {
  position: absolute; top: -7px; left: -7px; font-size: 15px;
  background: #00c853; border-radius: 50%; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
}
#stage-wrap { flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative; min-height: 0; padding: 6px; }
#stage { position: relative; touch-action: none; }
#render { display: block; width: 100%; height: auto; border-radius: 10px;
  box-shadow: 0 6px 30px rgba(0,0,0,.6); }
#handles { position: absolute; inset: 0; }
.handle {
  position: absolute; border: 2px dashed rgba(0,200,83,.9); border-radius: 8px;
  background: rgba(0,200,83,.06); touch-action: none;
}
.handle.selected { border-style: solid; background: rgba(0,200,83,.14);
  box-shadow: 0 0 0 3px rgba(0,200,83,.25); }
.handle .tag {
  position: absolute; top: -24px; right: 0; font-size: 11px; color: #0a0f0c;
  background: #00c853; border-radius: 6px; padding: 1px 7px; font-weight: 700;
  white-space: nowrap;
}
#loading { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; background: rgba(10,15,12,.55); font-size: 18px;
  border-radius: 10px; }
#toolbar { padding: 8px 12px; border-top: 1px solid #1e2a22; }
#comp-label { font-size: 14px; color: #9aa; margin-bottom: 6px; text-align: center; }
#actions { display: flex; gap: 8px; justify-content: center; }
.tbtn {
  background: #182420; color: #eee; border: 1px solid #2c3a30; border-radius: 12px;
  padding: 10px 16px; font-size: 16px;
}
.tbtn:active { background: #223128; }
#footbar { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.big-btn {
  width: 100%; background: #00c853; color: #06110a; border: none; border-radius: 14px;
  padding: 14px; font-size: 18px; font-weight: 800;
}
.big-btn:active { background: #00b34a; }
.big-btn:disabled { background: #274434; color: #9aa; }
#editor-modal { position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
#editor-card { background: #141d17; border-radius: 16px; padding: 18px; width: 100%;
  max-width: 420px; border: 1px solid #2c3a30; }
#editor-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
#editor-text { width: 100%; background: #0a0f0c; color: #fff; border: 1px solid #2c3a30;
  border-radius: 10px; padding: 12px; font-size: 19px; line-height: 1.9; resize: vertical; }
#editor-hint { font-size: 12px; color: #9aa; margin: 8px 0 12px; }
#editor-btns { display: flex; gap: 10px; }
#editor-btns .big-btn { padding: 12px; font-size: 16px; }

.handle { touch-action: none; -webkit-user-select: none; user-select: none; }
.rgrip { position: absolute; right: -16px; bottom: -16px; width: 32px; height: 32px;
  border-radius: 50%; background: #00e065; color: #04120a; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; box-shadow: 0 2px 8px rgba(0,0,0,.5); z-index: 5; }

#btn-bg.on { background: #00e065; color: #04120a; }
#footbar { display: flex; flex-direction: column; gap: 10px; }
#footbar .big-btn { flex: 1 1 auto; }
.frow { display: flex; gap: 10px; }
.frow .tbtn { flex: 1 1 0; padding: 10px 6px; font-size: 15px; }
.tab.arrow { color: #00c853; font-size: 22px; }
#toast {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: rgba(20, 28, 22, .95); color: #ffd54a; border: 1px solid #5a4a1a;
  border-radius: 12px; padding: 10px 16px; font-size: 15px; max-width: 86%;
  text-align: center; z-index: 60; box-shadow: 0 4px 18px rgba(0,0,0,.5);
}
#top-right { display: flex; align-items: center; gap: 8px; }
#save-ind { font-size: 12px; color: #00c853; opacity: 0.4; min-width: 86px; text-align: right; }
.tbtn.small { padding: 6px 10px; font-size: 13px; }
.tbtn.post { background: #0a3d22; border-color: #00c853; color: #7dffb0; font-weight: 700; }
#btn-beforeafter.on { background: #00e065; color: #04120a; }
#lib-modal, #caption-modal, #post-modal, #new-modal { z-index: 55; }
#lib-modal { position: fixed; inset: 0; background: rgba(0,0,0,.8); display: flex; align-items: center; justify-content: center; padding: 14px; }
#lib-card { background: #141d17; border-radius: 16px; border: 1px solid #2c3a30; width: 100%; max-width: 560px; max-height: 86dvh; display: flex; flex-direction: column; overflow: hidden; }
#lib-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid #2c3a30; font-weight: 700; font-size: 17px; }
#lib-grid { overflow-y: auto; padding: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lib-head { grid-column: 1 / -1; font-size: 14px; font-weight: 700; color: #00c853; margin-top: 6px; }
.lib-item { border-radius: 8px; overflow: hidden; border: 1px solid #2c3a30; }
.lib-item img { width: 100%; height: 90px; object-fit: cover; display: block; }
.lib-item:active { border-color: #00c853; }
#caption-text, #post-caption { width: 100%; background: #0a0f0c; color: #fff; border: 1px solid #2c3a30; border-radius: 10px; padding: 12px; font-size: 15px; line-height: 1.6; resize: vertical; }
#post-btns { display: flex; gap: 10px; }
#post-btns .tbtn { flex: 1; }
#post-btns .big-btn { flex: 1.4; padding: 12px; font-size: 16px; }
#post-send { background: #182420; }
#new-date-row { padding: 10px 14px; font-size: 15px; }
#new-date { background: #0a0f0c; color: #fff; border: 1px solid #2c3a30; border-radius: 8px; padding: 8px; font-size: 15px; width: 140px; }
#new-rows { overflow-y: auto; padding: 0 14px 10px; }
.new-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.new-thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; border: 1px solid #2c3a30; }
.new-headline { flex: 1; min-width: 0; background: #0a0f0c; color: #fff; border: 1px solid #2c3a30; border-radius: 8px; padding: 10px; font-size: 16px; }
#new-create { margin: 0 14px 14px; }


#topbar { position: relative; }
#top-right { position: static; }
#menu-drop {
  position: absolute; top: calc(100% + 4px); right: 8px; z-index: 200;
  background: #141d17; border: 1px solid #2c3a30; border-radius: 14px;
  min-width: 190px; padding: 6px;
  box-shadow: 0 8px 28px rgba(0,0,0,.6);
}
.menu-item {
  display: flex; width: 100%; align-items: center; gap: 10px;
  background: none; border: none; color: #f2f2f2;
  font-size: 16px; padding: 12px 14px; border-radius: 10px;
  font-family: inherit; text-align: left;
}
.menu-item:active { background: #0a3d22; }
#date-label { white-space: nowrap; }

.story-block { border: 1px solid #1e2a22; border-radius: 12px; padding: 8px; margin-bottom: 10px; }
.story-prev-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.story-prev-big { width: 72px; height: 128px; object-fit: cover; border-radius: 8px;
  border: 1px solid #2c3a30; background: #111; flex: none; }
.story-prev-hint { color: #9fb3a5; font-size: 12px; }

#next-strip {
  text-align: center; font-size: 12.5px; color: #9fd8b4;
  padding: 5px 12px; border-bottom: 1px solid #1e2a22;
  background: rgba(10, 61, 34, .25); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

/* floating close button for fullscreen modals (v36b) */
.modal-fab {
  position: fixed; top: calc(max(14px, env(safe-area-inset-top)) + 56px); right: 14px; z-index: 300;
  width: 44px; height: 44px; border-radius: 50%;
  background: #0a3d22; color: #7dffb0; border: 2px solid #00c853;
  font-size: 20px; font-weight: 700; line-height: 1;
  box-shadow: 0 2px 12px rgba(0,0,0,.6);
}
.modal-fab:active { background: #00c853; color: #04120a; }

/* carousel switcher dropdown (v38) */
#carousel-switch {
  position: fixed; top: 60px; right: 10px; z-index: 250;
  background: #101a14; border: 1px solid #2c3a30; border-radius: 12px;
  padding: 6px; min-width: 200px; max-height: 50vh; overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,.7);
}
#carousel-switch .menu-item { border: none; background: transparent; }
#carousel-switch .menu-item:active { background: #1c2b22; }
