/* GH图床 —— 自定义样式（基础组件由 mdui 提供，此处为补充与适配）
   颜色变量存的是 "R G B" 三元组，使用时写成 rgb(var(--c-xxx)) */

:root {
  --page-max: 860px;
  --gutter: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* 浅色 */
  --c-primary: 103 80 164;
  --c-primary-container: 234 221 255;
  --c-on-primary-container: 33 0 94;
  --c-surface-container-low: 247 242 250;
  --c-surface-container: 243 237 247;
  --c-surface-container-high: 236 230 240;
  --c-surface-container-highest: 230 224 233;
  --c-on-surface: 29 27 32;
  --c-on-surface-variant: 73 69 79;
  --c-outline: 121 116 126;
  --c-outline-variant: 202 196 208;
  --c-error: 179 38 30;
}

/* 深色：mdui 在 <html> 或 <body> 上挂 .mdui-theme-dark 或由 mdui-theme-auto 推断 */
.mdui-theme-dark,
:root:has(body.mdui-theme-dark) {
  --c-primary: 207 188 255;
  --c-primary-container: 79 55 138;
  --c-on-primary-container: 234 221 255;
  --c-surface-container-low: 29 27 32;
  --c-surface-container: 33 31 38;
  --c-surface-container-high: 43 41 48;
  --c-surface-container-highest: 54 52 59;
  --c-on-surface: 230 224 233;
  --c-on-surface-variant: 202 196 208;
  --c-outline: 147 143 153;
  --c-outline-variant: 73 69 79;
  --c-error: 242 184 181;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-primary: 207 188 255;
    --c-primary-container: 79 55 138;
    --c-on-primary-container: 234 221 255;
    --c-surface-container-low: 29 27 32;
    --c-surface-container: 33 31 38;
    --c-surface-container-high: 43 41 48;
    --c-surface-container-highest: 54 52 59;
    --c-on-surface: 230 224 233;
    --c-on-surface-variant: 202 196 208;
    --c-outline: 147 143 153;
    --c-outline-variant: 73 69 79;
    --c-error: 242 184 181;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: rgb(var(--c-surface-container-low));
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 10;
}

.container {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 16px 12px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 说明卡片 */
.notice {
  padding: 14px 16px;
  border-radius: 16px;
}

.notice-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.notice-icon {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 22px;
  color: rgb(var(--c-primary));
}

.notice-body p {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.6;
}

.notice-body p:last-child {
  margin-bottom: 0;
}

.notice-body a {
  color: rgb(var(--c-primary));
}

/* 上传区 */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  border-radius: 20px;
  border-style: dashed;
  transition: background-color 0.2s, border-color 0.2s;
}

.drop-zone.is-dragover {
  background: rgb(var(--c-primary-container));
  border-color: rgb(var(--c-primary));
}

.drop-icon {
  font-size: 56px;
  color: rgb(var(--c-outline));
}

.drop-title {
  margin: 12px 0 4px;
  font-size: 16px;
  font-weight: 500;
}

.drop-tip {
  margin: 0;
  font-size: 12px;
  color: rgb(var(--c-outline));
}

/* 工具栏 */
.toolbar {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* 结果列表 */
.result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  align-items: flex-start;
}

.result-thumb {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  border-radius: 12px;
  overflow: hidden;
  background: rgb(var(--c-surface-container-highest));
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-thumb mdui-circular-progress {
  --size: 32px;
}

.result-main {
  flex: 1;
  min-width: 0;
}

.result-link {
  display: block;
  font-size: 13px;
  color: rgb(var(--c-outline));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.result-link:hover {
  color: rgb(var(--c-primary));
}

/* Markdown 格式：位于链接下方，点击即复制 */
.result-md {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: rgb(var(--c-outline));
  background: rgb(var(--c-surface-container-high));
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s, background-color .15s;
}

.result-md:hover {
  color: rgb(var(--c-primary));
  background: rgb(var(--c-surface-container-highest));
}

.result-md:active {
  background: rgb(var(--c-primary-container));
}

.result-actions {
  display: flex;
  gap: 2px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.result-error {
  font-size: 12px;
  color: rgb(var(--c-error));
}

/* 页脚 */
.footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 12px 40px;
  text-align: center;
  font-size: 12px;
  color: rgb(var(--c-outline));
}

.footer p {
  margin: 0 0 12px;
  line-height: 1.6;
}

.footer a {
  color: rgb(var(--c-primary));
}

.footer-divider {
  margin-bottom: 12px;
}

.footer-links {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.footer-links a {
  text-decoration: none;
}

.dot {
  opacity: 0.5;
}

/* 上传中的环形进度居中 */
.result-thumb mdui-circular-progress {
  --size: 32px;
  margin: auto;
}

/* ---------- 小屏手机适配 ---------- */
@media (max-width: 600px) {
  :root {
    --gutter: 10px;
  }

  .container {
    padding: 12px var(--gutter) calc(28px + var(--safe-bottom));
    gap: 12px;
  }

  .notice {
    padding: 12px 14px;
  }

  .notice-body p {
    font-size: 13px;
  }

  .drop-zone {
    padding: 28px 16px;
  }

  .drop-icon {
    font-size: 40px;
  }

  .drop-title {
    font-size: 15px;
  }

  /* 三枚按钮等分，拇指更好点 */
  .toolbar {
    gap: 8px;
  }

  .toolbar mdui-button {
    flex: 1;
    min-width: 0;
  }

  .result-item {
    gap: 10px;
    padding: 10px;
  }

  .result-thumb {
    width: 64px;
    height: 64px;
  }

    .result-link {
    font-size: 12px;
  }

  .result-md {
    font-size: 11px;
    padding: 3px 6px;
  }

  .result-actions {
    gap: 0;
  }

  /* 页脚说明与顶部卡片重复，小屏隐藏 */
  .footer p,
  .footer-divider {
    display: none;
  }
}

@media (max-width: 375px) {
  .drop-zone {
    padding: 22px 12px;
  }

  .drop-icon {
    font-size: 34px;
  }

  .result-thumb {
    width: 56px;
    height: 56px;
  }
}

/* 触屏：44px 触控目标 */
@media (pointer: coarse) {
  .result-actions mdui-button-icon {
    min-width: 44px;
    min-height: 44px;
  }
}
