/* web/css/style.css — 网页版样式 */
:root {
  --accent: #1B63F3;
  --bg: #F2F1ED;
  --panel: #FFFFFF;
  --border: #E4E2DC;
  --text: #333333;
  --muted: #999999;
}

* { box-sizing: border-box; }

/* 显式 display 会覆盖 hidden 属性的 UA 样式，这里统一兜底 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- 顶栏 ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex: none;
  flex-wrap: wrap;
}

.brand {
  font-size: 16px;
  font-weight: 600;
  margin-right: auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand .sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

button {
  border: 1px solid var(--border);
  background: #FAFAF8;
  color: var(--text);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

button:hover { border-color: var(--accent); color: var(--accent); }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}

button.primary:hover { filter: brightness(1.08); color: #fff; }

button.small { padding: 5px 10px; font-size: 12px; }

/* ---- 主区 ---- */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, 5fr) 7fr;
  min-height: 0;
}

.pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.pane-head {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: none;
}

.muted { font-size: 11px; font-weight: 400; color: var(--muted); }

.editor-pane { border-right: 1px solid var(--border); }

#editor {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 14px 16px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: var(--panel);
}

.preview-scroll {
  flex: 1;
  overflow-y: auto;
  background: #EDEBE6;
}

#page { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }

#output ::-webkit-scrollbar { width: 5px; height: 5px; }
#output ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 3px; }
#output ::-webkit-scrollbar-track { background: transparent; }

/* ---- 设置面板 ---- */
#config-panel {
  position: fixed;
  top: 56px;
  right: 150px;
  width: 300px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  padding: 14px 16px;
  z-index: 30;
}

.cfg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
}

.cfg-row label { width: 96px; flex: none; color: #555; }
.cfg-row select, .cfg-row input[type="range"] { flex: 1; }
.cfg-row code { font-size: 11px; color: var(--muted); }
.cfg-row input[type="color"] {
  width: 42px; height: 26px; padding: 0; border: 1px solid var(--border);
  border-radius: 6px; background: none; cursor: pointer;
}

/* ---- 复制兜底弹窗 ---- */
#copy-modal .modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 50;
}

#copy-modal .modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 40px));
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  padding: 20px 22px;
  z-index: 51;
}

#copy-modal .modal p { margin: 0 0 12px; font-size: 13px; line-height: 1.7; color: #555; }

#copy-holder {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #FAFAF8;
  outline: none;
}

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* ---- Toast ---- */
#toast {
  position: fixed;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 32, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 10px;
  z-index: 40;
}

/* ---- 窄屏 ---- */
@media (max-width: 860px) {
  body { overflow: auto; }
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 42vh minmax(420px, 1fr);
  }
  .editor-pane { border-right: none; border-bottom: 1px solid var(--border); }
  #config-panel { right: 12px; left: 12px; width: auto; }
}
