* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: #3e2f23; color: #222; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.panel { background: #fffdf7; max-width: 620px; margin: 20px auto; padding: 18px 22px; border-radius: 10px; box-shadow: 0 4px 18px #0005; }
h1 { margin: 0 0 14px; font-size: 1.5em; } h2 { margin: 0 0 10px; font-size: 1.15em; }
input, textarea, button { font: inherit; padding: 9px 11px; border-radius: 6px; border: 1px solid #bbb; }
textarea { width: 100%; resize: vertical; }
#loginForm input, .panel label input, .panel label textarea { display: block; width: 100%; margin: 5px 0 12px; }
.panel label { display: block; font-size: .95em; }
button { background: #2e6b4f; color: #fff; border: none; cursor: pointer; }
button:hover { filter: brightness(.92); }
button.plain { background: #ddd; color: #222; } button.red { background: #8e2b2b; }
.err { color: #b00020; min-height: 1em; margin: 6px 0 0; } .hint { font-size: .85em; color: #666; margin: -6px 0 12px; }
.row3 { display: flex; gap: 10px; } .row3 label { flex: 1; }
fieldset { border: 1px solid #ddd; border-radius: 6px; margin: 0 0 12px; }
fieldset label { display: flex !important; align-items: center; gap: 10px; margin: 4px 0; }
fieldset label input { width: 4.5em !important; margin: 0 !important; display: inline-block !important; }
.btns { display: flex; gap: 10px; }

.bar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: #1f1712; color: #f5ecd9; }
.bar a { color: #f5ecd9; }
#home { text-decoration: none; font-size: 1.5em; }
#dash { min-height: 100%; }
#sessList { max-width: 760px; margin: 16px auto; padding: 0 10px; }
.card { background: #fffdf7; border-radius: 8px; padding: 12px 14px; margin: 10px 0; box-shadow: 0 2px 8px #0004; }
.card .top { display: flex; gap: 10px; align-items: baseline; } .card .t { font-weight: 600; flex: 1; }
.card .meta { font-size: .85em; color: #555; margin: 4px 0 8px; overflow-wrap: anywhere; }
.card .acts { display: flex; flex-wrap: wrap; gap: 6px; } .card .acts > * { padding: 6px 10px; font-size: .9em; }
.card .acts a { background: #e9e1cc; border-radius: 6px; color: #222; text-decoration: none; }
.state { font-size: .75em; padding: 2px 8px; border-radius: 10px; background: #ddd; text-transform: uppercase; letter-spacing: .04em; }
.state.open { background: #fff3c4; } .state.running { background: #c8f0d2; } .state.finished { background: #cfe3ff; }

#sess { display: flex; flex-direction: column; height: 100%; }
.titles #sTitle { font-weight: 600; font-size: 1.1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titles #sSub { font-size: .8em; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#timer { font-variant-numeric: tabular-nums; font-size: 2em; font-weight: 700; }
#timer.low { color: #ff8a65; } #timer.done { color: #999; }
#hostBar, #doneBar { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 6px; background: #2a1f18; color: #f5ecd9; flex-wrap: wrap; }
#hostBar button { padding: 6px 12px; } #doneBar a { color: #ffd54f; font-weight: 600; }
.theme { white-space: pre-wrap; font-size: 1.1em; }

#boardArea { flex: 1; position: relative; min-height: 0; }
#boardWrap { position: absolute; inset: 0; overflow: auto; background: #a9824f; cursor: grab; touch-action: pan-x pan-y; }
#boardWrap.dragging { cursor: grabbing; user-select: none; }
#sizer { position: relative; }
#board { position: absolute; left: 0; top: 0; transform-origin: 0 0;
  background: #b48d5c radial-gradient(#0000001f 1.5px, transparent 1.5px); background-size: 18px 18px; }
.note { position: absolute; width: 170px; min-height: 120px; padding: 12px 14px; box-shadow: 2px 5px 9px #0005;
  display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.25;
  font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; font-size: 17px; overflow-wrap: anywhere;
  --s: 1; transform: rotate(var(--r)) scale(var(--s)); transition: transform 20s cubic-bezier(.4, 0, .9, .6); }
.note.fresh { --s: 2.2; transition: none; }
#zoom { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 4px; z-index: 10; }
#zoom button { width: 44px; height: 40px; padding: 0; font-size: 1.2em; background: #1f1712e6; }
#zoom #zFit { width: 52px; font-size: .9em; }

#postBar { display: flex; gap: 8px; padding: 10px; background: #1f1712; }
#postBar input { flex: 1; font-size: 1.1em; } #postBar button { padding: 10px 20px; }
@media (max-width: 640px) { #timer { font-size: 1.5em; } .row3 { flex-direction: column; gap: 0; } }

/* v3 additions */
select { font: inherit; padding: 9px 11px; border-radius: 6px; border: 1px solid #bbb; display: block; width: 100%; margin: 5px 0 12px; }
button.small { padding: 6px 12px; font-size: .9em; }
.foot { text-align: center; color: #d8c7a8; font-size: .85em; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; width: min(560px, 94vw);
  max-height: 92vh; overflow: auto; z-index: 200000; box-shadow: 0 0 0 100vmax #0008; }
#stars { display: flex; gap: 6px; margin: 6px 0 14px; }
#stars label { display: flex; flex-direction: column; align-items: center; font-size: .8em; }
#stars input { width: auto; margin: 0 0 2px; }
#localInner table { border-collapse: collapse; width: 100%; } #localInner td, #localInner th { padding: 3px 6px; text-align: left; font-weight: normal; }
#localInner input[type=number] { width: 4.5em; margin: 0; display: inline-block; padding: 5px 7px; }
#aiPanel { position: fixed; right: 10px; top: 60px; width: min(420px, 96vw); max-height: calc(100vh - 80px); overflow: auto;
  margin: 0; z-index: 150000; }
#aiPanel .top { display: flex; align-items: center; justify-content: space-between; }
.myai { border: 1px solid #ddd; border-radius: 6px; padding: 8px 10px; margin: 0 0 8px; font-size: .9em; }
.myai .st { color: #555; margin: 4px 0; } .myai .acts { display: flex; gap: 6px; }
.myai .acts button { padding: 4px 10px; font-size: .9em; }
#invited { padding: 4px 14px; background: #2a1f18; color: #e8dcc4; font-size: 13px; line-height: 1.35; }
