/* 七星短链接 - 全局样式（手机优先，响应式两用） */

:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --border: #e5e7eb;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 14px 80px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 头部 */
.header {
  padding: 12px 0 8px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.header-text {
  min-width: 0;
}

.header h1 {
  font-size: 1.3rem;
  margin: 0 0 2px;
  font-weight: 700;
  text-align: center;
}

.header-text h1,
.header-text .sub {
  text-align: left;
}

.sub {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
}

.header-right {
  flex-shrink: 0;
}

/* 小按钮（认证） */
.btn-mini {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}

.btn-mini.authed {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

.btn-mini:active {
  opacity: 0.8;
}

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.card h2 {
  font-size: 1.05rem;
  margin: 0 0 4px;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 14px;
}

/* 输入框 */
.inp {
  width: 100%;
  height: 46px;
  font-size: 1rem;
  padding: 0 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
}

.inp:focus {
  border-color: var(--primary);
}

.inp-lg {
  height: 52px;
  font-size: 1.05rem;
}

select.inp {
  height: 46px;
}

/* 按钮 */
.btn {
  width: 100%;
  height: 46px;
  font-size: 1rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s, opacity 0.15s;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

.btn:active {
  opacity: 0.85;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.36);
}

.btn-copy {
  background: #eef2ff;
  color: var(--primary);
  font-weight: 600;
  height: 38px;
  width: auto;
  padding: 0 14px;
  margin-top: 0;
  flex-shrink: 0;
}

/* 消息 */
.msg {
  margin: 10px 0 0;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.msg.error {
  color: var(--danger);
}

.msg.success {
  color: var(--success);
}

/* 结果区 */
.result-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-top: 14px;
}

.result-label {
  font-size: 0.8rem;
  color: var(--muted);
}

#short-link {
  flex: 1;
  min-width: 0;
  color: var(--primary);
  font-weight: 600;
  word-break: break-all;
  text-decoration: none;
}

/* 底部 */
.footer {
  margin-top: auto;
  text-align: center;
  padding-top: 24px;
  color: var(--muted);
  font-size: 0.82rem;
}

.footer a {
  color: var(--text);
  text-decoration: none;
}

.footer-links {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: none;
  padding: 4px 0;
}

.link-btn:hover {
  color: var(--primary);
}

.sep {
  color: var(--border);
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  background: var(--card);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in 0.2s ease;
}

@keyframes modal-in {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
}

.mini-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
  touch-action: manipulation;
}

.mini-btn:active {
  opacity: 0.7;
}

.mini-btn.danger {
  color: var(--danger);
  border-color: #fecaca;
}

/* 设备信息弹窗 */
.dev-row {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.dev-row:last-child {
  border-bottom: none;
}

.dev-k {
  flex-shrink: 0;
  width: 56px;
  color: var(--muted);
}

.dev-v {
  word-break: break-all;
  color: var(--text);
}

/* 原始 UA 弹窗 */
.ua-box {
  background: #111827;
  color: #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  word-break: break-all;
  white-space: pre-wrap;
  margin: 10px 0;
  max-height: 200px;
  overflow-y: auto;
}

.ua-actions {
  margin-bottom: 6px;
}

.ua-parsed {
  margin-top: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

.ua-parsed-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

/* 危险按钮（注销确认等） */
.btn-danger {
  background: #dc2626;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.28);
}

.btn-danger:hover {
  background: #b91c1c;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.36);
}

/* 大屏（桌面）微调：放宽宽度显示更多内容 */
@media (min-width: 768px) {
  .page {
    max-width: 960px;
    padding: 20px 24px 80px;
  }
  .card {
    padding: 24px;
  }
  .header h1 {
    font-size: 1.6rem;
  }
  .logo {
    width: 56px;
    height: 56px;
  }
}

/* 轻提示 toast（右上角堆叠，2 秒消失） */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1f2937;
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  max-width: 78vw;
  word-break: break-all;
  animation: toast-in 0.25s ease;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.success {
  background: #059669;
}

.toast.error {
  background: #dc2626;
}

.toast.info {
  background: #2563eb;
}

@keyframes toast-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 确保 hidden 属性始终生效（防止被 display:flex 等规则覆盖） */
[hidden] {
  display: none !important;
}
