/* ============================================================
   直播间管理 —— 复古像素风 / 8-bit 红白机游戏 UI
   与 huadi.laishikeji.cn 同一套设计语言：
   粗黑边框、硬阴影、像素锯齿、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);
  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); }

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

/* ---------- 像素小动画 ---------- */
@keyframes px-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes px-wiggle {
  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;
  color: #fff;
  text-shadow: 2px 2px 0 var(--ink);
  letter-spacing: 1px;
  white-space: nowrap;
}
.brand-px { font-family: var(--px); font-size: 15px; }
.brand:hover { color: var(--yellow); animation: px-wiggle .2s steps(2) 2; }
.brand .brand-cn { font-size: 12px; font-weight: 900; 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); }
.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; }

.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; }
.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); }

/* ---------- 表单 ---------- */
.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(140px, 1fr)); gap: 12px; align-items: end; }

/* ---------- 按钮：游戏按键 ---------- */
.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-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: '▲ '; }

/* ---------- 登录页：游戏开始界面 ---------- */
.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);
  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-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); }

/* ---------- 功能入口卡片 ---------- */
.entry-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 22px;
  color: var(--ink);
}
.entry-card:hover { animation: px-wiggle .18s steps(2) 1; color: var(--ink); }
.entry-icon { font-size: 26px; }
.entry-text { display: flex; flex-direction: column; flex: 1; }
.entry-text strong { font-size: 15px; letter-spacing: 2px; }
.entry-arrow { color: var(--red); font-weight: 900; }

/* ---------- 排班表网格 ---------- */
.sched-wrap {
  overflow-x: auto;
  background: #fff;
  border: var(--border);
  box-shadow: var(--shadow);
}
.sched { border-collapse: collapse; font-size: 12.5px; width: max-content; }
.sched th, .sched td {
  border: 2px solid rgba(28, 28, 40, .25);
  padding: 4px 6px;
  text-align: center;
  min-width: 3rem;
  white-space: nowrap;
}
.sched thead th {
  background: var(--blue); color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .4);
  border-color: var(--ink);
}
.sched .slot-col {
  position: sticky; left: 0; z-index: 5;
  background: var(--paper); font-weight: 700;
}
.sched thead .slot-col { background: var(--blue); z-index: 6; }
.sched .wd { font-weight: 400; font-size: 11px; opacity: .85; }
.sched .room { font-weight: 400; font-size: 11px; opacity: .85; }
.sched .promo-row td { background: #fff3d6; font-weight: 700; }
.sched td.cell { cursor: text; background: #fff; }
.sched td.cell:hover { background: #fff3d6; }
.sched td.cell[contenteditable="true"] { background: #ffe9a8; outline: 3px solid var(--red); }
.sched tfoot th {
  position: sticky; left: 0; z-index: 5;
  background: #dff3e2; text-align: left; font-weight: 900;
}
.sched tfoot td { background: #dff3e2; color: #1d6b31; font-weight: 700; }
