/* layout editor, split screen, my games, chat, homework, balls */
.nx-gone { display: none !important; }
header h1, .tagline { width: fit-content; margin-left: auto; margin-right: auto; }
.nx-hint { font-size: 0.76rem; color: var(--text-dim); }
.nx-status { font-size: 0.82rem; color: var(--accent); min-height: 1.1em; margin-top: 8px; }
.nx-btn-solid, .nx-btn-ghost {
  padding: 0.5rem 1rem; font-size: 0.82rem; font-weight: 600; border-radius: var(--radius-sm); cursor: pointer;
}
.nx-btn-solid { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.nx-btn-solid:hover { background: var(--accent-hover); }
.nx-btn-solid:disabled { opacity: 0.55; cursor: default; }
.nx-btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.nx-btn-ghost:hover { border-color: var(--hover-border); }
.nx-import-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.nx-import-row input[type="text"] { flex: 1 1 150px; min-width: 0; padding: 0.5rem 0.7rem; }
.nx-check { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; color: var(--text-dim); cursor: pointer; }

/* tab bar positions */
.page-tabs { flex-wrap: wrap; justify-content: center; max-width: 96vw; }
.page-tab-btn { padding: calc(0.55rem * var(--nx-tab-size, 1)) calc(1.1rem * var(--nx-tab-size, 1)); font-size: calc(0.9rem * var(--nx-tab-size, 1)); white-space: nowrap; }
.page-content { max-width: var(--nx-width, 1000px); }
.zone-grid { grid-template-columns: repeat(auto-fill, minmax(var(--nx-card, 170px), 1fr)); }
.nx-tabs-bottom .page-tabs {
  position: fixed; left: 50%; bottom: 8px; transform: translateX(-50%); margin: 0; z-index: 40; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
}
.nx-tabs-bottom #homepage { padding-bottom: 64px; }
.nx-tabs-left .page-tabs, .nx-tabs-right .page-tabs {
  position: fixed; top: 0; bottom: 0; margin: 0; width: 176px; flex-direction: column; flex-wrap: nowrap; justify-content: flex-start;
  overflow-y: auto; border-radius: 0; z-index: 40; padding: 10px 8px; max-width: none;
}
.nx-tabs-left .page-tabs { left: 0; border-right: 1px solid var(--border); }
.nx-tabs-right .page-tabs { right: 0; border-left: 1px solid var(--border); }
.nx-tabs-left .page-tab-btn, .nx-tabs-right .page-tab-btn { text-align: left; flex: none; }
.nx-tabs-left #homepage { padding-left: 176px; }
.nx-tabs-right #homepage { padding-right: 176px; }
.nx-tabs-right .acct-btn { right: 192px; }
@media (max-width: 720px) {
  .nx-tabs-left .page-tabs, .nx-tabs-right .page-tabs, .nx-tabs-bottom .page-tabs {
    position: static; transform: none; width: auto; flex-direction: row; flex-wrap: wrap; justify-content: center; border: 0; border-radius: var(--radius-md); max-width: 96vw; margin-top: 1.5rem; padding: 3px;
  }
  .nx-tabs-left #homepage, .nx-tabs-right #homepage, .nx-tabs-bottom #homepage { padding: 0; }
  .nx-tabs-right .acct-btn { right: 16px; }
}
.nx-has-bg { background-size: cover; background-position: center; background-attachment: fixed; }

/* layout edit mode */
.nx-editing header h1, .nx-editing .tagline, .nx-editing .discord-link, .nx-editing #acctBtn,
.nx-editing .page-content, .nx-editing #games .search-bar, .nx-editing footer, .nx-editing .page-tab-btn { cursor: move; touch-action: none; user-select: none; }
.nx-editing .page-content { pointer-events: auto; }
.nx-editing .page-content iframe, .nx-editing .page-content img { pointer-events: none; }
.nx-editing .page-tab-btn.nx-gone { display: inline-block !important; opacity: 0.35; }
.nx-editing #homepage { outline: 1px solid var(--accent-border); outline-offset: -1px; }
.nx-lifting { background: var(--accent) !important; color: #fff !important; opacity: 0.9; }
.nx-bar-grip { flex: none; padding: 0.4rem 0.7rem; font-size: 0.74rem; font-weight: 700; color: #fff; background: var(--accent); border: 0; border-radius: var(--radius-sm); cursor: grab; touch-action: none; }
.nx-moving-bar, .nx-moving-bar * { cursor: grabbing !important; }
.nx-ed-box { position: fixed; display: none; pointer-events: none; z-index: 2147482800; box-sizing: border-box; }
.nx-ed-box span { position: absolute; left: -1px; top: -19px; padding: 1px 6px; font-size: 11px; font-weight: 700; line-height: 16px; white-space: nowrap; color: #fff; border-radius: 3px 3px 0 0; }
.nx-ed-selected { border: 2px solid var(--accent); }
.nx-ed-selected span { background: var(--accent); }
.nx-ed-hover { border: 1px dashed var(--accent); background: rgba(91,156,245,.08); }
.nx-ed-hover span { background: rgba(0,0,0,.75); }
.nx-ed-handle { position: absolute; right: -7px; bottom: -7px; width: 13px; height: 13px; background: #fff; border: 2px solid var(--accent); border-radius: 3px; cursor: nwse-resize; pointer-events: auto; touch-action: none; }
.nx-guide { position: fixed; display: none; background: #f43f5e; pointer-events: none; z-index: 2147482900; }
.nx-guide-x { top: 0; bottom: 0; width: 1px; }
.nx-guide-y { left: 0; right: 0; height: 1px; }
.nx-edge { position: fixed; background: var(--accent); opacity: 0.4; z-index: 2147482000; pointer-events: none; transition: all .08s; }
.nx-edge-top { top: 0; left: 0; right: 0; height: 60px; }
.nx-edge-bottom { bottom: 0; left: 0; right: 0; height: 60px; }
.nx-edge-left { top: 0; bottom: 0; left: 0; width: 176px; }
.nx-edge-right { top: 0; bottom: 0; right: 0; width: 176px; }
.nx-ed { position: fixed; top: 64px; right: 16px; width: 286px; max-height: calc(100vh - 80px); display: flex; flex-direction: column; z-index: 2147483000; color: var(--text); font-size: 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: 0 12px 40px rgba(0,0,0,.55); }
.nx-ed button { font: inherit; font-size: 0.74rem; font-weight: 600; color: var(--text); background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.28rem 0.55rem; cursor: pointer; }
.nx-ed button:hover:not(:disabled) { border-color: var(--hover-border); }
.nx-ed button:disabled { opacity: 0.4; cursor: default; }
.nx-ed button.active, .nx-ed .nx-done { background: var(--accent); border-color: var(--accent); color: #fff; }
.nx-ed-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px; cursor: move; border-bottom: 1px solid var(--border); touch-action: none; }
.nx-ed-head b { flex: 1; font-size: 0.82rem; white-space: nowrap; }
.nx-ed-collapsed .nx-ed-body { display: none; }
.nx-ed-collapsed .nx-ed-head { border-bottom: 0; }
.nx-ed-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.nx-ed-sel { padding: 8px; background: var(--input-bg); border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 6px; }
.nx-ed-title { font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nx-ed-tip, .nx-ed-hint { font-size: 0.72rem; color: var(--text-dim); line-height: 1.35; }
.nx-ed-tip[hidden], .nx-ed-item[hidden], .nx-ed-tab[hidden] { display: none; }
.nx-ed-item label { display: flex; align-items: center; gap: 6px; }
.nx-ed-item input[type="range"] { flex: 1; min-width: 0; }
.nx-ed-pct { width: 36px; text-align: right; color: var(--text-dim); font-size: 0.72rem; }
.nx-ed-btns { display: flex; gap: 4px; margin-top: 4px; }
.nx-ed-btns button { flex: 1; background: var(--surface); }
.nx-ed-row { display: flex; gap: 4px; }
.nx-ed-row input { padding: 0.3rem 0.45rem; font-size: 0.8rem; min-width: 0; }
.nx-ed-tabicon { width: 40px; flex: none; text-align: center; }
.nx-ed-tabname { flex: 1; }
.nx-ed-label { margin-top: 4px; font-size: 0.66rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-dim); }
.nx-ed-pos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.nx-ed-part { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 2px 7px; border-radius: var(--radius-sm); cursor: pointer; }
.nx-ed-part:hover { background: var(--input-bg); }
.nx-ed-part.active { background: var(--accent-dim); color: var(--accent); }
.nx-ed-part.off span { opacity: 0.45; text-decoration: line-through; }
.nx-ed-part .nx-eye { padding: 0.08rem 0.45rem; font-size: 0.66rem; }
.nx-ed-snap { margin-top: 2px; }
@media (max-width: 720px) { .nx-ed { top: auto; bottom: 8px; right: 8px; left: 8px; width: auto; max-height: 46vh; } }

/* settings */
.nx-slider input[type="range"] { flex: 1; margin: 0 8px; min-width: 60px; }
.nx-val { font-size: 0.74rem; color: var(--text-dim); min-width: 44px; text-align: right; }
.nx-item-toggle { margin: 3px 14px 3px 0; }
#nxTabPos, #nxFont { background: var(--input-bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.3rem 0.5rem; font-size: 0.8rem; }
#nxBgUrl { width: 100%; margin-top: 6px; }
.nx-tab-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: var(--radius-sm); }
.nx-tab-row.dragging { background: var(--accent-dim); outline: 1px solid var(--accent); }
.nx-grip { cursor: grab; color: var(--text-dim); letter-spacing: -3px; padding: 4px 8px 4px 2px; touch-action: none; user-select: none; }
.nx-tab-row input[type="text"], .nx-tab-row input:not([type]) { padding: 0.3rem 0.5rem; font-size: 0.82rem; }
.nx-tab-icon { width: 44px; text-align: center; }
.nx-tab-name { flex: 1; min-width: 0; }
.nx-tab-del { background: none; border: none; color: #f87171; font-size: 1.1rem; cursor: pointer; }

/* my games */
.nx-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 16px; margin-top: 12px; border: 2px dashed var(--border); border-radius: var(--radius-md); text-align: center; color: var(--text); }
.nx-drop span { font-size: 0.78rem; color: var(--text-dim); }
.nx-drop.over { border-color: var(--accent); background: var(--accent-dim); }
.nx-paste { margin-top: 10px; font-size: 0.82rem; color: var(--text-dim); }
.nx-paste summary { cursor: pointer; }
.nx-paste input, .nx-paste textarea { display: block; width: 100%; margin: 8px 0; padding: 0.5rem 0.7rem; font-family: monospace; }
.nx-my-card { display: flex; align-items: center; justify-content: center; }
.nx-my-letter { font-size: 3.4rem; font-weight: 800; color: rgba(255,255,255,.85); }
.nx-my-tools { position: absolute; left: 6px; right: 6px; top: 34px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; z-index: 3; }
.nx-my-card:hover .nx-my-tools, .nx-my-card:focus-within .nx-my-tools { opacity: 1; }
.nx-my-tools button { flex: 1; padding: 3px 0; font-size: 0.68rem; font-weight: 600; background: rgba(0,0,0,.65); color: #fff; border: 0; border-radius: 4px; cursor: pointer; }
@media (hover: none) { .nx-my-tools { opacity: 1; } }

/* split screen */
#nxSplit { display: none; position: fixed; inset: 0; z-index: 900; background: var(--bg, #0b0b10); flex-direction: column; }
#nxSplit.active { display: flex; }
.sp-bar { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; flex: none; color: var(--text); font-size: 0.85rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.sp-bar button { background: var(--input-bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 30px; height: 28px; cursor: pointer; }
.sp-layouts { display: flex; gap: 4px; margin-left: auto; }
.sp-layouts button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sp-stage { flex: 1; display: grid; min-height: 0; }
.sp-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #000; }
.sp-pane-bar { display: flex; align-items: center; gap: 4px; height: 26px; flex: none; padding: 0 6px; background: var(--input-bg); color: var(--text-dim); font-size: 0.72rem; }
.sp-pane-bar span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp-pane-bar button { background: none; border: 0; color: var(--text-dim); cursor: pointer; font-size: 0.8rem; padding: 0 4px; }
.sp-pane-bar button:hover { color: var(--text); }
.sp-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #000; display: block; }
.sp-div { background: var(--border); touch-action: none; }
.sp-div:hover { background: var(--accent); }
.sp-div-x { cursor: col-resize; }
.sp-div-y { cursor: row-resize; }
.sp-dragging iframe { pointer-events: none; }
.sp-picker { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 14px; min-height: 0; background: var(--card-bg, #14141b); }
.sp-kinds { display: flex; gap: 4px; }
.sp-kinds button { padding: 0.35rem 0.8rem; font-size: 0.78rem; font-weight: 600; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; }
.sp-kinds button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sp-picker input { padding: 0.5rem 0.7rem; flex: none; }
.sp-results { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.sp-result { display: flex; align-items: center; gap: 10px; padding: 4px 6px; background: none; border: 0; border-radius: var(--radius-sm); color: var(--text); font-size: 0.82rem; text-align: left; cursor: pointer; }
.sp-result:hover { background: var(--surface); }
.sp-result img { width: 32px; height: 32px; object-fit: cover; border-radius: 5px; flex: none; }
.sp-result span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp-result small { color: var(--text-dim); font-size: 0.7rem; }

/* chat */
.cx { display: flex; height: min(72vh, 780px); margin-top: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--card-bg, #14141b); }
.cx-side { width: 200px; flex: none; padding: 12px 10px; overflow-y: auto; border-right: 1px solid var(--border); background: var(--input-bg); }
.cx-me label { font-size: 0.7rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.cx-me input { width: 100%; margin-top: 4px; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.cx-me-note { font-size: 0.68rem; color: var(--text-dim); margin-top: 4px; word-break: break-word; }
.cx-label { font-size: 0.68rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; margin: 14px 0 4px; }
.cx-room { position: relative; display: block; width: 100%; text-align: left; padding: 0.35rem 0.5rem; background: none; border: 0; border-radius: var(--radius-sm); color: var(--text-dim); font-size: 0.85rem; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-room:hover { color: var(--text); background: var(--surface); }
.cx-room.active { color: #fff; background: var(--accent); }
.cx-person { font-size: 0.76rem; padding: 1px 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cx-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cx-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 0.92rem; }
#cxStatus { font-size: 0.74rem; color: var(--accent); }
.cx-messages { flex: 1; overflow-y: auto; padding: 8px 0; min-height: 0; }
.cx-msg { position: relative; padding: 4px 14px; font-size: 0.86rem; color: var(--text); }
.cx-msg:hover { background: var(--surface); }
.cx-mention { background: var(--accent-dim); border-left: 2px solid var(--accent); }
.cx-from { font-weight: 700; }
.cx-badge { margin-left: 5px; font-size: 0.6rem; font-weight: 700; padding: 0 4px; border-radius: 3px; background: var(--accent-dim); color: var(--accent); }
.cx-time { margin-left: 6px; font-size: 0.66rem; color: var(--text-dim); }
.cx-text { line-height: 1.42; word-break: break-word; white-space: pre-wrap; }
.cx-quote { font-size: 0.74rem; color: var(--text-dim); border-left: 2px solid var(--border); padding-left: 6px; margin-bottom: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cx-reacts { display: flex; flex-wrap: wrap; gap: 3px; }
.cx-react { margin-top: 3px; padding: 0 6px; font-size: 0.72rem; border-radius: 9px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); cursor: pointer; }
.cx-react.mine { border-color: var(--accent); background: var(--accent-dim); }
.cx-tools { position: absolute; right: 10px; top: -8px; display: none; gap: 1px; padding: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); z-index: 2; }
.cx-msg:hover .cx-tools, .cx-msg:focus-within .cx-tools { display: flex; }
.cx-tools button { background: none; border: 0; color: var(--text); cursor: pointer; padding: 2px 4px; font-size: 0.78rem; }
.cx-tools button:hover { background: var(--input-bg); border-radius: 3px; }
.cx-typing { height: 16px; padding: 0 14px; font-size: 0.7rem; color: var(--text-dim); font-style: italic; }
.cx-reply { display: flex; justify-content: space-between; padding: 4px 14px; font-size: 0.76rem; color: var(--text-dim); background: var(--input-bg); }
.cx-reply[hidden] { display: none; }
.cx-reply button { background: none; border: 0; color: var(--text-dim); cursor: pointer; }
.cx-input { display: flex; gap: 6px; padding: 8px 10px 10px; }
.cx-input input { flex: 1; min-width: 0; padding: 0.55rem 0.8rem; }
.cx-input button { padding: 0 1.1rem; background: var(--accent); color: #fff; border: 0; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; }
@media (max-width: 640px) {
  .cx { flex-direction: column; height: 80vh; }
  .cx-side { width: auto; max-height: 130px; border-right: 0; border-bottom: 1px solid var(--border); }
  .cx-side #cxOnline, .cx-side .cx-label:last-of-type { display: none; }
}

/* homework */
.hw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 1.2rem; }
.hw-card { padding: 14px; background: var(--card-bg, #14141b); border: 1px solid var(--border); border-radius: var(--radius-md); display: flex; flex-direction: column; gap: 8px; color: var(--text); }
.hw-wide { grid-column: 1 / -1; }
.hw-card h3 { font-size: 0.92rem; font-weight: 700; }
.hw-card textarea, .hw-card input[type="text"] { width: 100%; padding: 0.5rem 0.7rem; resize: vertical; font-family: inherit; font-size: 0.86rem; }
.hw-modes { display: flex; flex-wrap: wrap; gap: 4px; }
.hw-modes button { padding: 0.35rem 0.8rem; font-size: 0.78rem; font-weight: 600; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; }
.hw-modes button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.hw-row { display: flex; align-items: center; gap: 8px; }
.hw-row #hwGo { margin-left: auto; }
#hwThumb { height: 38px; border-radius: 4px; }
#hwThumb[hidden], .hw-out[hidden], #hwCopy[hidden], #hwPhotoX[hidden] { display: none; }
.hw-out { padding: 12px; background: var(--input-bg); border-radius: var(--radius-sm); white-space: pre-wrap; font-size: 0.9rem; line-height: 1.5; word-break: break-word; }
#hwCopy { align-self: flex-start; }
.hw-result { font-size: 0.88rem; font-weight: 600; color: var(--accent); word-break: break-word; }
.hw-cite { font-size: 0.74rem; font-weight: 400; color: var(--text); user-select: all; }
.hw-links { display: flex; flex-wrap: wrap; gap: 6px; }

/* balls */
#nxBalls { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 2147482500; pointer-events: none; }
#nxBallsStop { position: fixed; right: 16px; bottom: 16px; z-index: 2147482600; padding: 0.55rem 1rem; font-weight: 700; font-size: 0.82rem; color: #fff; background: #e11d48; border: 0; border-radius: 999px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
