/* Draw Fast in the browser. Sketchbook look after the app's design system (DrawFast/Design):
   cream paper, pen ink, hard offset shadows, hand lettering. Light theme only. */

@font-face { font-family: "Patrick Hand"; src: url(fonts/patrick-hand.woff2) format("woff2"); font-display: swap;
  unicode-range: U+0020-00FF, U+2013-2026, U+2190-2193; }
@font-face { font-family: "Permanent Marker"; src: url(fonts/permanent-marker.woff2) format("woff2"); font-display: swap;
  unicode-range: U+0020-007E, U+00A0, U+2013-2026; }
@font-face { font-family: "Playpen Sans Arabic"; src: url(fonts/playpen-sans-arabic.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  color-scheme: only light;
  --paper: #f8f3e5; --paper-deep: #eee7d5; --ink: #1b1816; --pencil: #6e6860; --rule: #c2d4e2;
  --red: #dc3229; --yellow: #ffe743; --blue: #2554c4; --green: #269955; --orange: #ef7a24; --pink: #ff8fbd; --mint: #5acfb8;
  --hand: "Patrick Hand", "Playpen Sans Arabic", "Comic Sans MS", "Segoe Print", cursive, sans-serif;
  --display: "Permanent Marker", "Playpen Sans Arabic", "Patrick Hand", cursive, sans-serif;
  --dw: 400;
  --col: min(100vw, 460px);
}
html[lang="ar"] {
  --hand: "Playpen Sans Arabic", "Patrick Hand", "Geeza Pro", "Noto Naskh Arabic", sans-serif;
  --display: "Playpen Sans Arabic", "Patrick Hand", "Geeza Pro", sans-serif;
  --dw: 800;
}

* { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  color: var(--ink); font: 400 20px/1.3 var(--hand);
  background: var(--paper) repeating-linear-gradient(to bottom, transparent 0, transparent 33px, rgba(194, 212, 226, .6) 33px, rgba(194, 212, 226, .6) 34px);
  -webkit-tap-highlight-color: transparent;
}
html[lang="ar"] body { font-size: 17.5px; line-height: 1.5; font-weight: 500; }
[hidden] { display: none !important; }
h1, h2, p, ol { margin: 0; padding: 0; }
button, input { font: inherit; color: inherit; }
button { touch-action: manipulation; }
a { color: var(--blue); }
bdi { unicode-bidi: isolate; }
.red { color: var(--red); }

.app { max-width: 460px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; display: flex; flex-direction: column;
  padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.top { display: flex; align-items: center; justify-content: space-between; height: 44px; flex: none; }
.brand { font: 400 24px/1 "Permanent Marker", var(--display); color: var(--ink); text-decoration: none; padding: 4px 8px; transform: rotate(-2deg);
  background: linear-gradient(transparent 18%, rgba(255, 231, 67, .85) 18%, rgba(255, 231, 67, .85) 88%, transparent 88%); }
.lang { font-size: 18px; padding: 8px 4px; text-decoration: none; border-bottom: 2px solid currentColor; line-height: 1; }
html[lang="ar"] .lang { font-family: "Patrick Hand", sans-serif; font-size: 20px; }
html[lang="en"] .lang { font-family: "Playpen Sans Arabic", sans-serif; font-size: 16px; }
.stage { flex: 1 0 auto; display: flex; flex-direction: column; gap: 14px; padding-top: 8px; }
.foot { flex: none; padding-top: 22px; text-align: center; font-size: 15px; color: var(--pencil); }
.foot p + p { margin-top: 4px; }
.foot a { color: var(--pencil); }
.foot input { width: 150px; font-size: 16px; padding: 2px 6px; border: 0; border-bottom: 2px dashed var(--ink); background: transparent; border-radius: 0; }
.android .noandroid { display: none; }
.boot, .noscript { text-align: center; color: var(--pencil); padding: 40px 0; }
.center { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-bottom: 20vh; }

/* Pen borders: an SVG drawn to the element's size by game.js (data-rough). */
[data-rough] { position: relative; z-index: 0; border: 0; background: none; }
.rough { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: visible; z-index: -1; pointer-events: none; }
.rough .rs { fill: var(--ink); }
.rough .rf { fill: var(--fill, var(--paper)); }
.rough .rk { fill: none; stroke: var(--line, var(--ink)); stroke-linecap: round; stroke-linejoin: round; }

/* Type */
.title { font: var(--dw) 29px/1.15 var(--display); transform: rotate(-1.2deg); margin: 2px 0 4px; }
html[lang="ar"] .title { font-size: 25px; line-height: 1.4; }
.sub { font: var(--dw) 21px/1.2 var(--display); margin-top: 6px; }
.eyebrow { font-size: 16px; letter-spacing: .04em; color: var(--pencil); }
html[lang="en"] .eyebrow { text-transform: uppercase; }
.quiet { color: var(--pencil); text-align: center; }
mark { display: inline-block; padding: 0 .25em; color: inherit; transform: rotate(-1deg);
  background: linear-gradient(transparent 14%, rgba(255, 231, 67, .9) 14%, rgba(255, 231, 67, .9) 90%, transparent 90%); }
.answer { font: var(--dw) 32px/1.2 var(--display); overflow-wrap: anywhere; }
html[lang="ar"] .answer { font-size: 28px; line-height: 1.5; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 8px 22px; margin: 0 4px 5px 0;
  font-size: 23px; line-height: 1.15; color: var(--ink); text-decoration: none; text-align: center; cursor: pointer;
  --fill: var(--yellow); -webkit-user-select: none; user-select: none; transition: transform .14s cubic-bezier(.3, 1.6, .6, 1); }
html[lang="ar"] .btn { font-size: 19px; font-weight: 700; }
.btn .rs { transition: transform .14s; }
.btn:active { transform: translate(3px, 4px) rotate(-.6deg); }
.btn:active .rs { transform: translate(1px, 1px); }
.btn.big { width: calc(100% - 4px); min-height: 60px; font-size: 26px; }
html[lang="ar"] .btn.big { font-size: 22px; }
.btn.ghost { --fill: #fff; }
.btn.sm { min-height: 42px; padding: 5px 14px; margin: 0 3px 4px 0; font-size: 19px; }
html[lang="ar"] .btn.sm { font-size: 16px; }
.btn.grow { flex: 1; }
.btn[disabled] { opacity: .45; filter: saturate(.2); pointer-events: none; }
.linkbtn { padding: 8px 6px; border: 0; background: none; color: var(--blue); font-size: 18px; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
html[lang="ar"] .linkbtn { font-size: 15.5px; text-underline-offset: 7px; }
.linkbtn.red { color: var(--red); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.minor { display: flex; justify-content: center; flex-wrap: wrap; gap: 2px 18px; }

/* Cards */
.card { padding: 16px 18px; margin: 0 5px 6px 0; display: flex; flex-direction: column; gap: 10px; }
.card.result { align-items: center; text-align: center; gap: 6px; padding-top: 20px; }
.who { display: flex; align-items: center; gap: 10px; }
.who h1 { font: var(--dw) 25px/1.2 var(--display); flex: 1; min-width: 0; overflow-wrap: anywhere; }
html[lang="ar"] .who h1 { font-size: 22px; line-height: 1.45; }
.avatar { flex: none; width: 46px; height: 46px; border: 2.5px solid var(--ink); border-radius: 50%; background: #fff; overflow: hidden; direction: ltr; }
.avatar svg { display: block; width: 100%; height: 100%; }
.sticker { flex: none; padding: 2px 10px; font-size: 16px; --fill: var(--yellow); transform: rotate(4deg); }
.stamp { position: absolute; top: 8px; inset-inline-end: 6px; z-index: 2; padding: 3px 12px; transform: rotate(-9deg); opacity: .92;
  font: var(--dw) 19px/1.2 var(--display); letter-spacing: .05em; color: var(--red); --line: var(--red); }
html[lang="en"] .stamp { text-transform: uppercase; }
html[lang="ar"] .stamp { letter-spacing: 0; font-size: 17px; line-height: 1.5; }
.stamp .rf { fill: rgba(255, 255, 255, .82); }
.stamp.slow { color: var(--orange); --line: var(--orange); }
.pitch { align-items: flex-start; font-size: 18px; margin-top: 6px; }
html[lang="ar"] .pitch { font-size: 16px; }

/* Name */
.namef { display: flex; align-items: center; gap: 10px; font-size: 18px; color: var(--pencil); }
.namef span { flex: none; }
.namef input { flex: 1; min-width: 0; padding: 6px 4px; font-size: 20px; color: var(--ink); border: 0; border-bottom: 2.5px dashed var(--ink);
  border-radius: 0; background: transparent; outline: none; }
.namef input:focus { border-bottom-style: solid; border-color: var(--blue); }

/* Dot */
.dotrow { display: flex; align-items: flex-end; gap: 12px; min-height: 66px; }
.dot { flex: none; width: 62px; height: 62px; transition: transform .35s cubic-bezier(.3, 1.7, .5, 1); }
.dot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.dot[data-mood="confused"] { transform: rotate(8deg); }
.dot[data-mood="wow"] { transform: rotate(-4deg) scale(1.08); }
.dot .eyes { transform-origin: 50px 42px; animation: blink 4.3s infinite; }
.dot .dots circle { animation: think .5s infinite alternate; }
.dot .dots circle:nth-child(2) { animation-delay: .15s; }
.dot .dots circle:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes think { from { opacity: .2; } to { opacity: 1; } }
.bubble { flex: 0 1 auto; min-width: 0; padding: 7px 14px 8px; margin-bottom: 16px; font-size: 19px; line-height: 1.25; }
html[lang="ar"] .bubble { font-size: 16px; line-height: 1.5; }
.bubble::before { content: ""; position: absolute; bottom: 9px; inset-inline-start: -6px; width: 12px; height: 12px; background: var(--paper);
  border: 0 solid var(--ink); border-bottom-width: 2px; border-inline-start-width: 2px; transform: rotate(45deg); }
[dir="rtl"] .bubble::before { transform: rotate(-45deg); }
.bubble.pop { animation: pop .3s cubic-bezier(.3, 1.7, .5, 1); }
@keyframes pop { from { transform: scale(.85); } to { transform: scale(1); } }
.clock { flex: none; align-self: center; margin-inline-start: auto; min-width: 58px; text-align: end; transform: rotate(-4deg);
  font: 400 30px/1 "Permanent Marker", var(--display); color: var(--red); font-variant-numeric: tabular-nums; }

/* The drawing sheet. Drawings never mirror, so the sheet is always left to right. */
.sheet { --fill: #fff; align-self: center; width: 100%; padding: 4px; margin: 0 5px 6px 0; direction: ltr; }
.sheet canvas { display: block; width: 100%; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sheet.pad canvas { cursor: crosshair; }
.sheet .ink { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.sheet.mini { width: min(62%, 210px); margin-bottom: 10px; transform: rotate(-1.5deg); }
.hint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-size: 17px; color: var(--pencil); pointer-events: none; }
[dir="rtl"] .hint { direction: rtl; font-size: 15px; }
[data-s="play"] .sheet { width: min(100%, max(170px, calc(100vh - 372px - var(--extra, 0px)))); width: min(100%, max(170px, calc(100dvh - 372px - var(--extra, 0px)))); }
[data-s="draw"] .sheet, [data-s="look"] .sheet { width: min(100%, max(220px, calc(100vh - 262px))); width: min(100%, max(220px, calc(100dvh - 262px))); }
[data-s="play"] { gap: 10px; }

/* Letter tiles */
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; min-height: 40px;
  --sz: min(42px, calc((var(--col) - 36px - (var(--n) - 1) * 4px) / var(--n))); }
.wordgroup { display: inline-flex; gap: 4px; }
.slot { display: grid; place-items: center; width: var(--sz); height: calc(var(--sz) * 1.1); padding: 0; cursor: pointer;
  font-size: calc(var(--sz) * .64); line-height: 1; --fill: #fff; --line: var(--pencil); }
html[lang="ar"] .slot { font-size: calc(var(--sz) * .56); font-weight: 700; }
.slot.full { --line: var(--ink); }
.slots.wrong { animation: shake .4s; }
.slots.wrong .slot { --line: var(--red); color: var(--red); }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.tiles { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 46px)); justify-content: center; gap: 8px 6px; padding-inline-end: 3px; }
.tile { display: grid; place-items: center; height: 44px; padding: 0; cursor: pointer; font-size: 26px; line-height: 1; --fill: var(--yellow);
  -webkit-user-select: none; user-select: none; transition: transform .12s cubic-bezier(.3, 1.6, .6, 1); }
html[lang="ar"] .tile { font-size: 22px; font-weight: 700; }
.tile:active { transform: translate(2px, 2px); }
.tile.used { visibility: hidden; }

/* Draw screen */
.drawtitle { font: var(--dw) 26px/1.2 var(--display); text-align: center; overflow-wrap: anywhere; }
html[lang="ar"] .drawtitle { font-size: 23px; line-height: 1.5; }
.count { color: var(--red); font: 400 30px/1 "Permanent Marker", var(--display); }
.ptimer { display: flex; align-items: center; gap: 10px; }
.pencil { flex: 1; min-width: 0; display: flex; height: 20px; }
.pencil i { display: block; height: 100%; flex: none; }
.pe { width: 12px; background: var(--pink); border: 2px solid var(--ink); border-inline-end: 0; }
.pf { width: 6px; background: #a8a4a0; border: 0 solid var(--ink); border-top-width: 2px; border-bottom-width: 2px; }
.pb { width: calc((100% - 36px) * var(--p, 1)); min-width: 4px; border: 0 solid var(--ink); border-top-width: 2px; border-bottom-width: 2px;
  background: var(--yellow) repeating-linear-gradient(to bottom, transparent 0, transparent 6px, rgba(27, 24, 22, .14) 6px, rgba(27, 24, 22, .14) 7px); transition: width .1s linear; }
.pp { width: 18px; background: linear-gradient(to right, var(--paper-deep) 0, var(--paper-deep) 60%, var(--ink) 60%); clip-path: polygon(0 0, 100% 50%, 0 100%);
  -webkit-clip-path: polygon(0 0, 100% 50%, 0 100%); }
[dir="rtl"] .pp { transform: scaleX(-1); }
.urgent .pb { background-color: var(--red); }
.psec { flex: none; min-width: 40px; text-align: end; font: 400 26px/1 "Permanent Marker", var(--display); font-variant-numeric: tabular-nums; }
.urgent .psec { color: var(--red); transform: scale(1.15); }
.tools { display: flex; align-items: center; gap: 10px; }

/* Home and word choice */
.choice, .word { display: flex; width: calc(100% - 4px); margin: 0 4px 5px 0; padding: 14px 18px; cursor: pointer; text-align: start;
  transition: transform .14s cubic-bezier(.3, 1.6, .6, 1); }
.choice { flex-direction: column; gap: 2px; --fill: var(--yellow); }
.choice.alt { --fill: var(--mint); }
.choice b { font: var(--dw) 25px/1.2 var(--display); }
html[lang="ar"] .choice b { font-size: 22px; line-height: 1.5; }
.choice small { font-size: 17px; line-height: 1.25; }
html[lang="ar"] .choice small { font-size: 14.5px; line-height: 1.5; font-weight: 500; }
.word { align-items: center; justify-content: space-between; gap: 12px; --fill: #fff; }
.word b { font-size: 27px; font-weight: 400; line-height: 1.15; overflow-wrap: anywhere; }
html[lang="ar"] .word b { font-size: 22px; font-weight: 700; line-height: 1.5; }
.choice:active, .word:active { transform: translate(3px, 4px) rotate(-.6deg); }
.choice:active .rs, .word:active .rs { transform: translate(1px, 1px); }
.lv { flex: none; padding: 1px 10px; font-size: 15px; font-style: normal; border: 2px solid var(--ink); border-radius: 12px 4px 10px 5px; transform: rotate(3deg); }
html[lang="ar"] .lv { font-size: 13px; }
.lv.e { background: #9be0b4; } .lv.m { background: #ffc48f; } .lv.h { background: var(--pink); }
.wordcard { align-items: center; text-align: center; gap: 4px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 19px; }
html[lang="ar"] .stepper { font-size: 16.5px; }
.stepper .btn { min-width: 44px; padding: 0 6px; margin: 0 3px 4px 0; font-size: 24px; }
.stepper b { min-width: 22px; text-align: center; font: 400 26px/1 "Permanent Marker", var(--display); }

/* Share */
.share { display: flex; flex-direction: column; gap: 12px; }
.linkrow { display: flex; align-items: center; gap: 10px; }
.linkrow input { flex: 1; min-width: 0; padding: 8px 4px; font: 16px/1.2 ui-monospace, Menlo, Consolas, monospace; color: var(--pencil);
  border: 0; border-bottom: 2px dashed var(--pencil); border-radius: 0; background: transparent; outline: none; text-overflow: ellipsis; }
.approw { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; margin-top: 4px; }

/* Who guessed */
.plays { list-style: none; display: flex; flex-direction: column; }
.plays li { display: flex; align-items: baseline; gap: 6px; padding: 7px 2px; border-bottom: 1.5px dashed rgba(110, 104, 96, .55); }
.plays .pn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plays .me .pn { font-weight: 700; text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 5px; text-underline-offset: -2px; text-decoration-skip-ink: none; }
.plays b { font: 400 22px/1 "Permanent Marker", var(--display); }
.plays small { font-size: 16px; color: var(--pencil); }
.star { font-style: normal; color: var(--orange); }

/* Memory reveal */
.strip { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; }
.strip li { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.strip li:nth-child(odd) .sheet { transform: rotate(-1.4deg); }
.strip li:nth-child(even) .sheet { transform: rotate(1.2deg); }
.strip .pn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 19px; }
html[lang="ar"] .strip .pn { font-size: 16px; }
.strip .num { position: absolute; top: -8px; left: -4px; z-index: 2; width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid var(--ink);
  border-radius: 50%; background: var(--yellow); font: 400 16px/1 "Permanent Marker", var(--display); transform: rotate(-8deg); }
.dotsays { font-size: 16px; color: var(--red); line-height: 1.2; }
html[lang="ar"] .dotsays { font-size: 13.5px; line-height: 1.5; }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%) rotate(-1deg); z-index: 20; max-width: calc(100vw - 32px);
  padding: 9px 16px; background: var(--ink); color: var(--paper); font-size: 18px; text-align: center; border-radius: 10px 4px 9px 5px; box-shadow: 3px 4px 0 rgba(27, 24, 22, .25); }
html[lang="ar"] .toast { font-size: 15.5px; }

@media (max-height: 620px) {
  .stage { gap: 10px; }
  .dot { width: 54px; height: 54px; }
  .dotrow { min-height: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
