/* Draw & Guess Activity: the chat games' palette (night teal, cyan glow). */
:root {
  --night: #07202a; --deep: #0c2835; --edge: #1e4152; --steel: #718ca0;
  --cyan: #19ace6; --cyanhi: #5fd3ff; --cyandeep: #0b5874; --gold: #f5c542; --white: #fff; --red: #e5484d;
  --font: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: linear-gradient(#103242, var(--deep) 55%, var(--night)); color: var(--white); font-family: var(--font); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

#app { display: grid; grid-template-columns: minmax(0, 1fr) 280px; grid-template-rows: auto minmax(0, 1fr); gap: 10px; height: 100%; padding: 10px; }
#top { grid-column: 1 / 3; display: flex; align-items: center; gap: 14px; background: rgba(13, 42, 55, .9); border: 1px solid var(--edge); border-radius: 14px; padding: 8px 14px; min-height: 56px; }
#title { font-weight: 800; color: var(--cyanhi); white-space: nowrap; font-size: 15px; }
#title .turn { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.1); color: var(--gold); margin-inline-start: 4px; }
#hints { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tilerow { display: flex; gap: 4px; }
.tile { width: 28px; height: 30px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 17px; background: rgba(25, 172, 230, .25); border: 1px solid var(--cyan); }
.tile.hid { background: rgba(11, 88, 116, .5); border-color: var(--edge); color: transparent; position: relative; }
.tile.hid::after { content: ""; position: absolute; left: 25%; right: 25%; bottom: 7px; height: 2px; background: var(--cyanhi); }
.tile.gap { width: 12px; background: none; border: 0; }
.tile.word { background: rgba(245, 197, 66, .2); border-color: var(--gold); }
#clock { width: 120px; height: 26px; border-radius: 13px; background: rgba(11, 88, 116, .5); border: 1px solid var(--edge); position: relative; overflow: hidden; }
#clockbar { position: absolute; inset: 0; width: 0; background: linear-gradient(90deg, var(--cyandeep), var(--cyan)); transition: width .25s linear; }
#clockbar.low { background: linear-gradient(90deg, #7a2a2e, var(--red)); }
#clocktext { position: relative; display: block; text-align: center; line-height: 26px; font-weight: 800; font-size: 14px; }

#stage { display: flex; flex-direction: column; gap: 8px; min-height: 0; min-width: 0; }
#boardwrap { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
#board { background: #fff; border-radius: 12px; box-shadow: 0 0 0 4px var(--cyandeep), 0 0 24px rgba(25, 172, 230, .45); touch-action: none; max-width: 100%; max-height: 100%; aspect-ratio: 4 / 3; }
#board.drawer { cursor: crosshair; }
#overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(4, 16, 22, .55); border-radius: 12px; backdrop-filter: blur(2px); }
#card { background: rgba(13, 42, 55, .96); border: 1px solid var(--cyan); border-radius: 16px; padding: 18px 22px; max-width: min(460px, 92%); text-align: center; box-shadow: 0 0 30px rgba(25, 172, 230, .35); }
#card h2 { margin: 0 0 8px; font-size: 20px; color: var(--cyanhi); }
#card p { margin: 6px 0; color: #cfe6f1; font-size: 14px; line-height: 1.5; }
#card .choices { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.btn { background: var(--cyandeep); border: 1px solid var(--cyan); border-radius: 10px; padding: 10px 16px; font-weight: 800; font-size: 15px; }
.btn:hover { background: #0e6d90; }
.btn.big { font-size: 17px; padding: 12px 26px; }
.btn small { display: block; font-weight: 600; color: var(--cyanhi); font-size: 12px; }
#card .rows { margin-top: 10px; text-align: start; }
#card .row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--edge); font-size: 14px; }
#card .row b { color: var(--gold); }

#tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: rgba(13, 42, 55, .9); border: 1px solid var(--edge); border-radius: 14px; padding: 8px 10px; }
#colors { display: grid; grid-template-columns: repeat(8, 24px); gap: 4px; }
.color { width: 24px; height: 24px; border-radius: 6px; border: 2px solid rgba(255, 255, 255, .2); padding: 0; }
.color.on { border-color: var(--white); box-shadow: 0 0 0 2px var(--cyan); }
#sizes { display: flex; gap: 6px; }
.size { width: 34px; height: 34px; border-radius: 8px; background: rgba(11, 88, 116, .5); border: 1px solid var(--edge); display: grid; place-items: center; padding: 0; }
.size i { display: block; border-radius: 50%; background: var(--white); }
.size.on { border-color: var(--cyan); box-shadow: 0 0 8px rgba(25, 172, 230, .6); }
#actions { display: flex; gap: 6px; margin-inline-start: auto; }
.tool { width: 38px; height: 38px; border-radius: 9px; background: rgba(11, 88, 116, .5); border: 1px solid var(--edge); font-size: 18px; padding: 0; }
.tool.on { border-color: var(--cyan); box-shadow: 0 0 8px rgba(25, 172, 230, .6); }

#side { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
#players { list-style: none; margin: 0; padding: 6px; background: rgba(13, 42, 55, .9); border: 1px solid var(--edge); border-radius: 14px; max-height: 40%; overflow: auto; }
#players li { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; font-size: 14px; }
#players li.me { background: rgba(25, 172, 230, .12); }
#players li.off { opacity: .45; }
#players li.guessed { background: rgba(67, 160, 71, .22); }
.av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--cyandeep); border: 1px solid var(--cyan); flex: none; }
#players .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#players .sc { color: var(--gold); font-weight: 800; }
#feed { list-style: none; margin: 0; padding: 8px; flex: 1; min-height: 60px; overflow: auto; background: rgba(13, 42, 55, .9); border: 1px solid var(--edge); border-radius: 14px; font-size: 14px; }
#feed li { padding: 3px 2px; word-wrap: break-word; }
#feed li b { color: var(--cyanhi); }
#feed li.ok { color: #8ee59a; font-weight: 700; }
#feed li.close { color: var(--gold); }
#feed li.sys { color: var(--steel); font-size: 13px; }
#guessform { display: flex; gap: 6px; }
#guess { flex: 1; min-width: 0; background: rgba(6, 26, 34, .95); border: 1px solid var(--edge); border-radius: 10px; padding: 10px 12px; color: var(--white); font: inherit; font-size: 15px; }
#guess:focus { outline: none; border-color: var(--cyan); }
#send { width: 44px; border-radius: 10px; border: 1px solid var(--cyan); background: var(--cyandeep); font-size: 18px; }

#boot { position: fixed; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; background: var(--night); z-index: 10; text-align: center; padding: 20px; }
#boot.gone { display: none; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--edge); border-top-color: var(--cyan); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Phones and narrow windows: everything in one column, the board first. */
@media (max-width: 720px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr); padding: 6px; gap: 6px; }
  #top { grid-column: 1; flex-wrap: wrap; gap: 8px; padding: 6px 10px; }
  #title { font-size: 13px; }
  #clock { width: 90px; }
  #boardwrap { flex: none; }
  #board { width: 100%; height: auto; }
  #colors { grid-template-columns: repeat(8, 22px); }
  .color { width: 22px; height: 22px; }
  #players { max-height: 90px; display: flex; flex-wrap: wrap; gap: 2px; }
  #players li { padding: 3px 5px; }
  .tile { width: 22px; height: 24px; font-size: 14px; }
}
