#app-hamburger-btn {
  background: var(--panel);
  color: var(--text);
  border: 1.5px solid #475569;
  border-radius: 6px;
  width: 38px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

#app-hamburger-btn:hover {
  background: #334155;
  border-color: var(--accent);
  color: var(--accent);
}

#app-flyout-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

#app-flyout-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

#app-flyout {
  position: fixed;
  top: 0;
  left: 0;
  height: 100dvh;
  width: 370px;
  max-width: 90vw;
  background: var(--surface);
  border-right: 1px solid #334155;
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.65);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#app-flyout.open {
  transform: translateX(0);
}

.flyout-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid #334155;
}

.flyout-top span {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.flyout-close-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.flyout-close-btn:hover {
  background: var(--panel);
  color: var(--text);
  border-color: #475569;
}

.flyout-sections {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.flyout-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flyout-divider {
  border: 0;
  border-top: 1px solid #334155;
  margin: 0;
}

.flyout-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.flyout-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #475569;
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.flyout-btn:hover {
  background: #334155;
  border-color: var(--accent);
}

.flyout-btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.flyout-btn-primary:hover {
  background: var(--primary-dark);
}

.flyout-btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--wrong);
  color: #fca5a5;
}

.flyout-btn-danger:hover {
  background: var(--wrong);
  color: #fff;
}

/* Save Slots inside Flyout */
#save-list {
  max-height: 290px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.save-slot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 4px solid #38bdf8;
}

.save-slot-info {
  cursor: pointer;
  flex: 1 1 160px;
  min-width: 0;
  font-size: 0.85rem;
}

.save-slot-info small {
  color: #94a3b8;
  display: block;
  margin-top: 3px;
  font-size: 0.74rem;
}

.save-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.save-actions button {
  padding: 6px 9px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.75rem;
}

.btn-load {
  background: #22c55e;
  color: white;
}

.btn-del {
  background: #ef4444;
  color: white;
}

.menu-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.menu-actions button {
  padding: 10px 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.78rem;
}

/* Git-Style Diff Modal */
#git-diff-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.88);
  z-index: 10005;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
}

.git-diff-content {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 12px;
  width: 94%;
  max-width: 680px;
  padding: 22px;
  color: #e6edf3;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.git-diff-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #30363d;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.git-diff-stats {
  display: flex;
  gap: 8px;
  font-family: monospace;
  font-size: 0.82rem;
  font-weight: 700;
}

.git-stat-add {
  color: #3fb950;
  background: rgba(46, 160, 67, 0.15);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(46, 160, 67, 0.4);
}

.git-stat-mod {
  color: #d29922;
  background: rgba(187, 128, 9, 0.15);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(187, 128, 9, 0.4);
}

.git-stat-del {
  color: #f85149;
  background: rgba(248, 81, 73, 0.15);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(248, 81, 73, 0.4);
}

.git-diff-list {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #161b22;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.git-diff-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #21262d;
  line-height: 1.4;
}

.git-diff-row:last-child {
  border-bottom: none;
}

.git-diff-row.git-add {
  background: rgba(46, 160, 67, 0.14);
  border-left: 4px solid #2ea043;
  color: #7ee787;
}

.git-diff-row.git-del {
  background: rgba(248, 81, 73, 0.14);
  border-left: 4px solid #f85149;
  color: #ffa198;
}

.git-diff-row.git-mod {
  background: rgba(187, 128, 9, 0.14);
  border-left: 4px solid #d29922;
  color: #e3b341;
}

.git-diff-select {
  background: #0d1117;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 5px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 0.78rem;
}

/* Collapsible Key-Value Version Drawer inside Flyout Menu */
.version-toggle-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  background: #1e293b;
  border-color: #475569;
  color: var(--text);
}

.version-toggle-btn[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: #0f172a;
}

.version-chevron {
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.version-toggle-btn[aria-expanded="true"] .version-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.version-kv-panel {
  background: #090d16;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 10px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.45);
}

.version-kv-list {
  display: flex;
  flex-direction: column;
}

.version-kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px solid #1e293b;
  font-size: 0.78rem;
}

.version-kv-row:last-child {
  border-bottom: none;
}

.version-kv-key {
  color: #94a3b8;
  font-weight: 600;
  word-break: break-word;
  min-width: 0;
  flex: 1;
}

.version-kv-val {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}