/* App shell: header, main area, footer and responsive rules. */

/* ---------- header ---------- */
#top {
  height: 48px; flex: none; display: flex; justify-content: space-between; align-items: center;
  padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--border); gap: 8px;
}
#top .left, #top .right { display: flex; align-items: center; gap: 4px; min-width: 0; }
#top .right { justify-content: flex-end; }
.logo { display: flex; align-items: center; gap: 8px; margin-right: 6px; font-size: 16px; letter-spacing: -0.02em; }
.logo .mark { width: 24px; height: 24px; border-radius: 6px; background: var(--accent); position: relative; }
.logo .mark::after { content: ""; position: absolute; inset: 6px; border: 2px dashed #fff; border-radius: 2px; }
.proj { display: flex; align-items: center; gap: 6px; margin-right: 6px; }
#projName {
  border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 3px 6px; width: 170px;
  font-size: 12px;
}
#projName:hover { background: var(--hover); }
#projName:focus { outline: none; border-color: var(--accent); background: var(--panel); }
#dirtyDot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); visibility: hidden; }
#dirtyDot.on { visibility: visible; }

#top button, #foot button {
  border: none; background: transparent; border-radius: 6px; padding: 4px 9px; cursor: pointer; font-size: 12px;
}
#top button:hover, #foot button:hover { background: var(--hover); }
#top button.icon { padding: 6px; display: flex; color: var(--muted); }
#top button.icon:hover { color: var(--text); }
#top button.icon:disabled { opacity: 0.35; cursor: default; background: transparent; }
button.primary { background: var(--accent) !important; color: #fff; font-weight: 500; }
button.primary:hover { background: var(--accent-hover) !important; }



/* ---------- main ---------- */
#main { flex: 1; display: flex; min-height: 0; }
#side {
  width: 300px; flex: none; display: flex; flex-direction: column; background: var(--panel);
  border-left: 1px solid var(--border);
}
#panel { flex: 1; overflow: auto; padding: 4px 0 24px; font-size: 12px; }

#stage { position: relative; flex: 1; min-width: 0; overflow: hidden; background: var(--cv-bg); }
#cv { display: block; touch-action: none; user-select: none; }

/* ---------- footer ---------- */
#foot {
  height: 28px; flex: none; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 0 10px; background: var(--panel); border-top: 1px solid var(--border); font-size: 11px; color: var(--muted);
}
#foot .l, #foot .r { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
#foot button { padding: 2px 7px; font-size: 11px; color: var(--muted); }
#foot button.on { color: var(--accent); }
#foot a { padding: 2px 7px; border-radius: 6px; font-size: 11px; color: var(--muted); text-decoration: none; }
#foot a:hover { background: var(--hover); }
#fPos { min-width: 120px; }
#fStep { border: none; background: transparent; color: var(--muted); font-size: 11px; padding: 2px 4px; border-radius: 6px; cursor: pointer; }
#fStep:hover { background: var(--hover); }
#fHint { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd {
  border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-family: ui-monospace, monospace;
  font-size: 10px; background: var(--soft); color: var(--text);
}

/* ---------- tool strap (bottom, leather-strap style) ---------- */
#tools {
  --strap: #3a2a20;
  --strap-ink: #f1e4d3;
  --strap-stitch: rgba(241, 228, 211, 0.38);
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 10;
  width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 4px; padding: 8px 14px;
  background: linear-gradient(180deg, #47342a 0%, var(--strap) 100%);
  border-radius: 999px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .18), 0 10px 26px rgba(58, 42, 32, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
}
/* saddle-stitch line along the strap */
#tools::before {
  content: ""; position: absolute; inset: 4px; border-radius: 999px; pointer-events: none;
  border: 1.5px dashed var(--strap-stitch);
}
#tools button {
  position: relative; width: 36px; height: 36px; padding: 0; border: none; border-radius: 50%;
  background: transparent; cursor: pointer; color: var(--strap-ink);
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s, transform .12s;
}
#tools button svg { width: 18px; height: 18px; }
#tools button:hover { background: rgba(241, 228, 211, .12); }
#tools button:active { transform: scale(.94); }
#tools button.on { background: var(--strap-ink); color: var(--strap); box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
#tools .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--strap-stitch); margin: 0 6px; }
#tools .tip {
  position: absolute; bottom: calc(100% + 14px); left: 50%; transform: translate(-50%, 4px);
  display: flex; align-items: center; gap: 6px; white-space: nowrap; pointer-events: none;
  padding: 5px 9px; border-radius: 999px; background: var(--strap-ink); color: var(--strap);
  font-size: 12px; font-weight: 500; line-height: 1; box-shadow: 0 4px 12px rgba(58, 42, 32, .25);
  opacity: 0; transition: opacity .12s, transform .12s;
}
#tools .tip kbd { background: rgba(58, 42, 32, .12); border: none; color: var(--strap); padding: 2px 5px; border-radius: 999px; }
#tools button:hover .tip { opacity: 1; transform: translate(-50%, 0); transition-delay: .25s; }

/* ---------- narrow windows ---------- */
@media (max-width: 1180px) {
  #top { display: flex; }
  #top .left { flex: 1; }
  #top .right { flex: none; }
  .logo b, [data-act=new], [data-act=open] { display: none; }
  #projName { width: 120px; }
}
@media (max-width: 900px) {
  #side { width: 230px; }
  [data-act=save], .proj, #fHint, #fArea { display: none; }
  #foot { grid-template-columns: auto 1fr auto; }
}
