:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-soft: #f0f4f2;
  --line: #d8dee6;
  --text: #14201c;
  --muted: #617069;
  --green: #146b59;
  --blue: #315f9f;
  --danger: #9a3d2f;
  --shadow: 0 18px 46px rgba(31, 45, 61, 0.12);
  --radius: 8px;
  --font-sans: "Inter", "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", "SFMono-Regular", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(245, 247, 249, 0.96)),
    linear-gradient(135deg, #eef5f2 0%, #f7f8fb 52%, #eef3fb 100%);
  font-family: var(--font-sans);
}
button, input, textarea { font: inherit; }
button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: var(--green);
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.16s ease, background 0.16s ease;
}
button:hover { transform: translateY(-1px); background: #0f5949; }
.ghost-button { color: var(--text); background: rgba(20, 32, 28, 0.08); }
.ghost-button:hover { background: rgba(20, 32, 28, 0.12); }
.clip-shell {
  width: min(1060px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 26px 0 32px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}
.topbar, .editor-panel, .message-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}
.topbar { display: grid; grid-template-columns: auto minmax(320px, 1fr) auto; gap: 18px; align-items: end; padding: 18px; }
.home-link { align-self: center; color: var(--green); font-weight: 800; text-decoration: none; }
.key-panel { display: grid; gap: 8px; }
label { color: var(--muted); font-size: 13px; font-weight: 800; }
.key-row { display: flex; gap: 10px; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: #ffffff; color: var(--text); }
input:focus, textarea:focus { outline: 3px solid rgba(49, 95, 159, 0.16); border-color: rgba(49, 95, 159, 0.42); }
#keyInput { max-width: 148px; height: 44px; padding: 0 14px; font-family: var(--font-mono); font-size: 24px; font-weight: 900; letter-spacing: 0.18em; text-transform: uppercase; }
.expiry-text { align-self: center; margin: 0; color: var(--muted); font-size: 14px; font-weight: 700; text-align: right; }
.editor-panel { min-height: 0; padding: 18px; display: grid; grid-template-rows: minmax(360px, 1fr) auto; gap: 14px; }
textarea { min-height: 360px; padding: 18px; resize: vertical; line-height: 1.7; font-size: 16px; }
.action-bar { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.status-text { margin: 0; color: var(--muted); font-size: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.message-panel { margin-top: 20vh; padding: 28px; }
.message-panel h1, .message-panel p { margin: 0 0 14px; }
.message-panel a { color: var(--green); font-weight: 800; }
/* 手机只让文本框内部滚动；电脑继续使用原来的布局。 */
@media (max-width: 760px), (pointer: coarse) and (max-height: 600px) {
  html.clip-page { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .clip-page body { position: fixed; inset: 0; min-height: 0; overflow: hidden; overscroll-behavior: none; }
  .clip-page .clip-shell {
    position: absolute;
    top: var(--clip-viewport-top, 0px);
    left: 0;
    width: 100%;
    height: var(--clip-viewport-height, 100vh);
    height: var(--clip-viewport-height, 100dvh);
    min-height: 0;
    margin: 0;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    overflow: hidden;
  }
  .clip-page .topbar { grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding: 10px; align-items: center; }
  .clip-page .home-link { grid-column: 1; grid-row: 1; font-size: 14px; }
  .clip-page .expiry-text { grid-column: 2; grid-row: 1; font-size: 12px; line-height: 1.4; text-align: right; overflow-wrap: anywhere; }
  .clip-page .key-panel { grid-column: 1 / -1; grid-row: 2; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; }
  .clip-page .key-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
  .clip-page #keyInput { min-width: 0; max-width: none; padding-inline: 8px; }
  .clip-page button { padding-inline: 12px; touch-action: manipulation; }
  .clip-page .editor-panel { min-width: 0; min-height: 0; padding: 10px; grid-template-rows: minmax(0, 1fr) auto; gap: 8px; overflow: hidden; }
  .clip-page #contentInput {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 12px;
    resize: none;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-padding-block: 12px;
    line-height: 1.6;
  }
  .clip-page .action-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
  .clip-page .status-text { min-width: 0; max-height: 2.8em; overflow: auto; overscroll-behavior: contain; overflow-wrap: anywhere; font-size: 12px; line-height: 1.4; }
  .clip-page .actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .clip-page .actions button { min-width: 0; padding-inline: 6px; }
  /* 横屏或键盘占据大部分屏幕时暂收起辅助信息，保留取件与编辑按钮。 */
  .clip-page.clip-compact .home-link, .clip-page.clip-compact .expiry-text { display: none; }
  .clip-page.clip-compact .key-panel { grid-row: 1; }
  .clip-page.clip-compact .topbar, .clip-page.clip-compact .editor-panel { padding: 6px; }
  .clip-page.clip-compact .clip-shell, .clip-page.clip-compact .editor-panel { gap: 6px; }
}
/* 仅用于复制失败时的兼容操作，不影响原界面布局。 */
.copy-helper { position: fixed; left: -10000px; top: 0; }
