:root {
  --bg: #101214; --bg-2: #15191c; --surface: #1b2025; --line: #2a3239;
  --text: #ece7dc; --muted: #8d8880; --faint: #5c5852;
  --brass: #b08d57; --brass-2: #c9a66b; --sage: #6f8f7a;
  --danger: #c45c4a; --ok: #7ea48a;
  --font: "Segoe UI Variable","Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  --serif: "Palatino Linotype","Songti SC","STSong",serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
}
:root { --page-dir: 1; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes draw-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes page-in {
  from { opacity: 0; transform: translate3d(calc(var(--page-dir, 1) * 36px), 12px, 0); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes page-out {
  from { opacity: 1; transform: none; filter: none; }
  to { opacity: 0; transform: translate3d(calc(var(--page-dir, 1) * -22px), -8px, 0) scale(.985); filter: blur(5px); }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
::view-transition-old(okkk-page) {
  animation: page-out .34s cubic-bezier(.4, 0, .2, 1) both;
}
::view-transition-new(okkk-page) {
  animation: page-in .52s cubic-bezier(.2, .7, .2, 1) both;
}
::view-transition-group(okkk-page) { overflow: hidden; }
.login-body {
  display: grid; place-items: center; min-height: 100%;
  background: radial-gradient(720px 380px at 10% -8%, rgba(176,141,87,.1), transparent 60%), var(--bg);
}
.login-box {
  width: 520px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px 34px 28px; position: relative;
  animation: rise .45s ease both;
}
.brand { font-family: var(--serif); letter-spacing: .32em; font-size: 26px; margin: 0 0 4px; }
.sub { color: var(--muted); letter-spacing: .2em; text-transform: uppercase; font-size: 11px; margin: 0 0 22px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font: inherit; outline: none;
}
input:focus { border-color: var(--brass); }
.btn {
  appearance: none; border: 1px solid var(--brass); background: transparent;
  color: var(--brass-2); border-radius: 10px; height: 40px; padding: 0 14px;
  font: inherit; cursor: pointer; letter-spacing: .06em;
}
.btn:hover { background: rgba(176,141,87,.12); }
.btn.primary { background: var(--brass); color: #1a1612; font-weight: 650; width: 100%; margin-top: 16px; }
.btn.ghost { width: 100%; margin-top: 8px; border-color: var(--line); color: var(--muted); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.sage { border-color: var(--sage); color: var(--ok); }
.btn.sm { height: 30px; font-size: 12px; padding: 0 10px; }
.err { color: var(--danger); min-height: 18px; font-size: 12px; margin-top: 8px; }
.corner { position: absolute; width: 12px; height: 12px; border: 1px solid var(--brass); opacity: .45; }
.corner.tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.corner.tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.corner.br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }
.cap-prompt { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
.cap-board { position: relative; margin-top: 8px; }
.cap-board img, .cap-board canvas { width: 100%; border-radius: 8px; display: block; }
.cap-board canvas { position: absolute; inset: 0; cursor: crosshair; }
.slider { position: relative; height: 46px; margin-top: 6px; user-select: none; }
.slider img#track { width: 100%; display: block; border-radius: 8px; }
.slider img#piece { position: absolute; top: 5px; left: 0; width: 36px; height: 36px; cursor: grab; }

.shell { display: flex; min-height: 100%; }
.nav {
  width: 220px; background: var(--bg-2); border-right: 1px solid var(--line);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.nav .brand { font-size: 20px; padding: 0 8px; }
.nav .sub { padding: 0 8px; }
.nav-list { position: relative; display: flex; flex-direction: column; gap: 4px; }
.nav-ink {
  position: absolute; left: 0; right: 0; top: 0; height: 42px;
  border-radius: 8px; background: rgba(176,141,87,.12);
  box-shadow: inset 2px 0 0 var(--brass);
  pointer-events: none; z-index: 0;
  transition: transform .4s cubic-bezier(.2,.7,.2,1), height .4s cubic-bezier(.2,.7,.2,1);
}
.nav-btn {
  position: relative; z-index: 1;
  text-align: left; background: transparent; border: 0; color: var(--muted);
  padding: 11px 12px; border-radius: 8px; cursor: pointer; font: inherit;
  transition: color .2s;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active { color: var(--text); }
.nav-foot { margin-top: auto; padding: 10px 8px; color: var(--faint); font-size: 12px; line-height: 1.7; }
.nav-foot a { color: var(--brass-2); text-decoration: none; }
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.page-rule {
  height: 1px; flex-shrink: 0;
  background: linear-gradient(90deg, transparent, var(--brass), transparent);
  transform: scaleX(0); transform-origin: left; opacity: .4;
}
.workspace.switching .page-rule { animation: draw-line .55s cubic-bezier(.2,.7,.2,1) both; }
.content {
  flex: 1; padding: 26px 28px; overflow: auto;
  view-transition-name: okkk-page;
}
.content.page-in { animation: page-in .5s cubic-bezier(.2,.7,.2,1) both; }
.content.page-out { animation: page-out .28s cubic-bezier(.4,0,.2,1) both; }
h1 { font-size: 20px; margin: 0 0 6px; }
.lead { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.grid { display: grid; gap: 14px; }
.grid.four { grid-template-columns: repeat(4, 1fr); }
.grid.two { grid-template-columns: 1fr 1fr; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  animation: card-in .48s cubic-bezier(.2,.7,.2,1) both;
}
.card:nth-child(2) { animation-delay: .05s; }
.card:nth-child(3) { animation-delay: .1s; }
.card:nth-child(4) { animation-delay: .15s; }
.card:nth-child(5) { animation-delay: .2s; }
.card h3 { margin: 0 0 10px; font-size: 11px; letter-spacing: .16em; color: var(--muted); }
.val { font-size: 22px; font-weight: 650; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; }
.tag.unused { background: rgba(126,164,138,.18); color: var(--ok); }
.tag.used { background: rgba(176,141,87,.18); color: var(--brass-2); }
.tag.banned { background: rgba(196,92,74,.18); color: var(--danger); }
.mono { font-family: Consolas,"Cascadia Mono",monospace; letter-spacing: .04em; }
.result {
  background: #0c0e10; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; min-height: 160px; white-space: pre-wrap; font-family: Consolas, monospace;
  font-size: 13px; line-height: 1.6;
}
.toast {
  position: fixed; right: 22px; bottom: 22px; background: var(--surface);
  border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; animation: rise .25s ease both;
}
.dlg {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 20;
}
.dlg .box { width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--muted); font-size: 12px; }
@media (max-width: 980px) {
  .grid.four { grid-template-columns: 1fr 1fr; }
  .login-box { width: 94vw; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-ink, .content, .card, .page-rule { animation: none !important; transition: none !important; }
  ::view-transition-old(okkk-page), ::view-transition-new(okkk-page) { animation: none !important; }
}
