/* ============================================================
   华帝团队协作平台 —— 复古像素风 / 8-bit 红白机游戏 UI
   纯外观层：粗黑边框、硬阴影、像素锯齿、FC 红白机配色
   ============================================================ */

/* 自托管像素字体（Press Start 2P, OFL 协议），仅覆盖拉丁字母/数字 */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/press-start-2p.woff2') format('woff2');
}

:root {
  --ink: #1c1c28;            /* 像素黑 */
  --cream: #f4ead2;          /* 奶油底 */
  --paper: #fffaf0;          /* 卡片纸面 */
  --red: #d8342c;            /* FC 红 */
  --red-dark: #a41f1a;
  --blue: #2b50c8;           /* FC 蓝 */
  --blue-dark: #1d3891;
  --yellow: #f7b500;         /* FC 黄 */
  --green: #3a9b4f;          /* HP 绿 */
  --muted: #8a7f68;
  --border: 3px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --px: 'Press Start 2P', monospace;
}

* { box-sizing: border-box; border-radius: 0 !important; }  /* 像素世界没有圆角 */

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--cream);
  /* 点阵底纹（纯 CSS，极淡，不影响阅读） */
  background-image:
    radial-gradient(rgba(28, 28, 40, .06) 1px, transparent 1px);
  background-size: 8px 8px;
  image-rendering: pixelated;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--red); text-decoration: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.main { padding-top: 28px; padding-bottom: 56px; }

/* ---------- 像素小动画 ---------- */
@keyframes px-blink {          /* 经典 1UP 闪烁：阶梯式，无渐变 */
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes px-wiggle {         /* hover 轻微抖动 */
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-1px, 1px); }
  75% { transform: translate(1px, -1px); }
}
.blink { animation: px-blink 1.1s steps(1) infinite; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--red);
  border-bottom: 4px solid var(--ink);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner { display: flex; align-items: center; gap: 26px; min-height: 60px; padding: 6px 20px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--px);
  font-size: 15px;
  color: #fff;
  text-shadow: 2px 2px 0 var(--ink);
  letter-spacing: 1px;
  white-space: nowrap;
}
.brand-logo {
  height: 28px; width: auto; display: block;
  border: none; box-shadow: none;   /* logo 不吃全局像素边框 */
}
.brand:hover { color: var(--yellow); animation: px-wiggle .2s steps(2) 2; }
.brand .brand-cn {
  font-family: inherit; font-size: 11px; color: var(--yellow);
  text-shadow: 2px 2px 0 var(--ink);
}
.nav { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 6px 12px;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  border: 3px solid transparent;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .45);
}
.nav a:hover { border-color: var(--ink); background: var(--red-dark); color: #fff; }
.nav a.active {
  background: var(--yellow); color: var(--ink);
  border-color: var(--ink); text-shadow: none;
  box-shadow: var(--shadow-sm);
}
.user-box { display: flex; align-items: center; gap: 12px; color: #fff; }
.user-name { font-size: 13px; font-weight: 700; text-shadow: 1px 1px 0 rgba(0, 0, 0, .45); }
.badge {
  display: inline-block; margin-left: 6px; padding: 2px 6px;
  font-size: 11px; color: var(--ink); background: var(--yellow);
  border: 2px solid var(--ink);
}
.user-box .link-btn { color: #fff; text-shadow: 1px 1px 0 rgba(0, 0, 0, .45); }
.user-box .link-btn:hover { color: var(--yellow); }

/* ---------- 页面结构 ---------- */
.page-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.page-head h2 {
  margin: 0; font-size: 20px; letter-spacing: 3px; font-weight: 900;
  text-shadow: 3px 3px 0 rgba(28, 28, 40, .18);
}
.page-head h2::before { content: '▶ '; color: var(--red); }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- 卡片：游戏面板 ---------- */
.card {
  background: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 22px;
  position: relative;
}
/* 左上角像素角装饰 */
.card::before {
  content: '';
  position: absolute; top: -3px; left: -3px;
  width: 10px; height: 10px;
  background: var(--paper);
  border-top: var(--border); border-left: var(--border);
  box-shadow: inset 2px 2px 0 var(--yellow);
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: -4px -6px 12px; padding: 0 6px 8px;
  border-bottom: 3px dashed rgba(28, 28, 40, .35);
}
.card-head h3 { margin: 0; font-size: 15px; letter-spacing: 2px; font-weight: 900; }
.card-head h3::before { content: '■ '; color: var(--blue); font-size: 12px; }
.more { font-size: 13px; font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 列表 ---------- */
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { padding: 10px 0; border-bottom: 2px dashed rgba(28, 28, 40, .25); }
.simple-list li:last-child { border-bottom: none; }
.list-title { font-weight: 700; }
.list-title a { color: var(--ink); border-bottom: 2px solid transparent; }
.list-title a:hover { color: var(--red); border-bottom-color: var(--red); }
.list-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.list-body { margin-top: 6px; color: #3a3a48; font-size: 13.5px; }
.desc-block { color: #2c2c38; }
.desc-cell { max-width: 360px; color: #3a3a48; }
.muted { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.empty { color: var(--muted); margin: 8px 0; }
.empty::before { content: '· · · '; letter-spacing: 4px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; border: var(--border); background: #fff; }
.table th, .table td {
  text-align: left; padding: 9px 10px;
  border-bottom: 2px solid rgba(28, 28, 40, .25);
}
.table th {
  background: var(--blue); color: #fff;
  font-size: 12.5px; letter-spacing: 2px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .4);
  border-bottom: var(--border);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fff3d6; }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 15px; }
.field > span { display: block; margin-bottom: 5px; font-weight: 700; letter-spacing: 1px; }
.req { color: var(--red); font-style: normal; }
input[type="text"], input[type="password"], input[type="date"],
input[type="file"], select, textarea {
  width: 100%; padding: 8px 10px; font-size: 14px; font-family: inherit;
  border: var(--border); background: #fff; color: var(--ink);
  box-shadow: inset 2px 2px 0 rgba(28, 28, 40, .12);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: inset 2px 2px 0 rgba(28, 28, 40, .12), 0 0 0 3px var(--yellow);
}
.form-card { max-width: 760px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.upload-form { max-width: 600px; }
.filter-form select { width: auto; }

/* ---------- 按钮：游戏按键（按下吃掉阴影） ---------- */
.btn {
  display: inline-block; padding: 8px 18px;
  font-size: 13.5px; font-weight: 900; letter-spacing: 2px;
  font-family: inherit; cursor: pointer;
  color: var(--ink); background: #fff;
  border: var(--border);
  box-shadow: 4px 4px 0 var(--ink);
  transition: none;   /* 像素风不要丝滑过渡 */
}
.btn:hover { background: var(--yellow); animation: px-wiggle .18s steps(2) 1; }
.btn:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--ink);
  animation: none;
}
.btn-primary { background: var(--red); color: #fff; text-shadow: 1px 1px 0 rgba(0, 0, 0, .5); }
.btn-primary:hover { background: var(--red-dark); }
.btn-danger { color: #fff; background: var(--ink); }
.btn-danger:hover { background: var(--red-dark); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 6px; padding: 12px; font-size: 15px; }
.inline-form { display: inline; }
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--blue); font-size: 13px; font-weight: 700; font-family: inherit;
  border-bottom: 2px solid transparent;
}
.link-btn:hover { color: var(--red); border-bottom-color: var(--red); }
.link-danger { color: var(--red); }

/* ---------- 提示框 ---------- */
.flash {
  padding: 10px 14px; margin-bottom: 18px;
  border: var(--border); box-shadow: var(--shadow-sm);
  font-size: 13.5px; font-weight: 700;
}
.flash-ok { background: #dff3e2; color: #1d6b31; }
.flash-ok::before { content: '★ '; }
.flash-err { background: #fbdeda; color: var(--red-dark); }
.flash-err::before { content: '▲ '; }

/* ---------- 游戏标签：状态 / 优先级 ---------- */
.tag {
  display: inline-block; padding: 2px 8px;
  font-size: 12px; font-weight: 900; letter-spacing: 1px;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  vertical-align: middle;
}
.tag-priority-high { background: var(--red); color: #fff; }
.tag-priority-high::before { content: '▲ '; }
.tag-priority-medium { background: var(--yellow); color: var(--ink); }
.tag-priority-medium::before { content: '● '; }
.tag-priority-low { background: var(--blue); color: #fff; }
.tag-priority-low::before { content: '■ '; }
.tag-status-todo { background: #d9d2c0; color: var(--ink); }
.tag-status-doing { background: var(--blue); color: #fff; }
.tag-status-done { background: var(--green); color: #fff; }
.tag-status-done::before { content: '✔ '; }
.tag-archived { background: #d9d2c0; color: #555; }

/* ---------- 看板：三个游戏面板 ---------- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .kanban { grid-template-columns: 1fr; } }
.kanban-col {
  background: #e9dfc6;
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 12px;
  min-height: 140px;
}
.kanban-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 3px solid var(--ink);
  font-weight: 900; letter-spacing: 2px;
}
.kanban-head .muted { font-family: var(--px); font-size: 11px; color: var(--ink); }
.task-card {
  background: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.task-card:hover { animation: px-wiggle .18s steps(2) 1; }
.task-title { font-weight: 900; }
.task-title::before { content: '▸ '; color: var(--red); }
.task-title .tag { margin-left: 6px; }
.task-desc { color: #3a3a48; font-size: 13px; margin-top: 4px; }
.task-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  color: #55504a; font-size: 12.5px; margin-top: 6px;
}
.task-actions {
  display: flex; gap: 12px; align-items: center;
  margin-top: 8px; padding-top: 8px;
  border-top: 2px dashed rgba(28, 28, 40, .3);
}
.task-actions select { width: auto; padding: 3px 6px; font-size: 12.5px; }

/* ---------- 进度条：HP / 经验条 ---------- */
.progress {
  display: inline-block; width: 130px; height: 14px;
  vertical-align: middle; margin-right: 8px;
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    var(--green) 0 8px,
    #57c06d 8px 16px
  );
  border-right: 2px solid var(--ink);
}

/* ---------- 登录页：游戏开始界面 ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background-color: var(--cream);
  background-image:
    radial-gradient(rgba(28, 28, 40, .07) 1px, transparent 1px),
    repeating-linear-gradient(0deg, rgba(28, 28, 40, .025) 0 2px, transparent 2px 4px); /* 淡 scanline */
  background-size: 8px 8px, auto;
}
.login-card {
  width: 400px;
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 40px 34px 34px;
  position: relative;
}
.login-card::before {   /* 顶部像素条纹 */
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 10px;
  background: repeating-linear-gradient(90deg,
    var(--red) 0 24px, var(--yellow) 24px 48px, var(--blue) 48px 72px);
  border-bottom: 3px solid var(--ink);
}
.login-logo {
  font-family: var(--px);
  font-size: 22px; text-align: center;
  color: var(--red);
  text-shadow: 3px 3px 0 var(--ink);
  margin: 6px 0 2px;
  letter-spacing: 2px;
}
.login-logo-img {
  display: block; margin: 10px auto 6px;
  height: 48px; width: auto;
  border: none; box-shadow: none;   /* logo 不吃全局像素边框 */
}
.login-title { margin: 0; font-size: 19px; text-align: center; letter-spacing: 6px; font-weight: 900; }
.login-sub { text-align: center; color: var(--muted); margin: 8px 0 6px; font-size: 13px; }
.login-start {
  text-align: center; font-weight: 900; letter-spacing: 2px;
  color: var(--ink); margin: 4px 0 20px; font-size: 13.5px;
}
.login-start .blink { color: var(--red); }
.login-ver {
  margin: 18px 0 0; text-align: center;
  font-family: var(--px); font-size: 8px; color: var(--muted);
  letter-spacing: 1px;
}

/* ---------- 用户管理页 ---------- */
.reset-form input {
  width: 110px; display: inline-block; padding: 4px 8px;
  font-size: 12.5px; margin: 0 6px;
}
