@font-face { font-family: 'Poppins'; src: url('/fonts/Poppins-Medium.woff') format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/fonts/Poppins-Bold.woff') format('woff'); font-weight: 700; font-display: swap; }
:root { --ink: #2B2D42; --paper: #FFF8EC; --coral: #FF6B6B; --yellow: #FFC93C; --teal: #2EC4B6; --green: #6BCB77; --muted: #6B6E80; --blue: #4D96FF; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; font-weight: 500; color: var(--ink);
  background-color: var(--paper); background-image: radial-gradient(rgba(43, 45, 66, 0.09) 1.5px, transparent 2px); background-size: 22px 22px;
  overscroll-behavior: none;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100%; padding: 10px 14px 40px; padding-top: calc(10px + env(safe-area-inset-top)); }
header { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.logo { font-weight: 700; font-size: 26px; letter-spacing: 0.5px; }
.logo span { display: inline-block; -webkit-text-stroke: 1px var(--ink); text-shadow: 0 2px 0 var(--ink); }
.me { display: flex; align-items: center; font-weight: 700; font-size: 15px; max-width: 50%; }
.me .av { margin-left: 8px; }
.hidden { display: none !important; }
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card { background: #fff; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 5px 0 var(--ink); padding: 20px 18px; margin-top: 12px; }
.center { text-align: center; }
h1 { font-size: 26px; font-weight: 700; margin-bottom: 10px; }
h2 { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
p { font-size: 16px; line-height: 1.45; }
.small { font-size: 14px; color: var(--muted); margin-top: 12px; text-align: center; }
label { display: block; font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 14px 0 6px; }
.inp { width: 100%; font: inherit; font-size: 20px; font-weight: 700; padding: 12px 14px; border: 3px solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--ink); outline: none; -webkit-appearance: none; }
.inp:focus { border-color: var(--blue); background: #fff; }
.inp.code { text-transform: uppercase; letter-spacing: 10px; font-size: 30px; text-align: center; }
.btn { display: block; width: 100%; margin-top: 16px; font: inherit; font-size: 20px; font-weight: 700; padding: 14px 18px; border: 3px solid var(--ink); border-radius: 999px; background: #fff; color: var(--ink); box-shadow: 0 5px 0 var(--ink); cursor: pointer; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn.go { background: var(--green); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); }
.btn.ghost { background: transparent; box-shadow: none; border-width: 2px; font-size: 16px; padding: 10px; width: auto; margin: 18px auto 0; }
.btn:disabled { opacity: 0.5; }
.err { color: var(--coral); font-weight: 700; margin-top: 12px; min-height: 22px; text-align: center; }
.banner { background: var(--coral); color: #fff; font-weight: 700; text-align: center; padding: 8px; border-radius: 12px; margin-top: 6px; }

.av { width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--ink); color: #fff; font-weight: 700; font-size: 16px; line-height: 29px; text-align: center; flex: none; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.chips { margin: 14px 0 4px; }
.chip { display: inline-flex; align-items: center; margin: 4px; padding: 4px 12px 4px 4px; border: 2px solid var(--ink); border-radius: 999px; font-weight: 700; font-size: 15px; background: var(--paper); }
.chip .av { width: 28px; height: 28px; line-height: 23px; font-size: 13px; margin-right: 6px; border-width: 2px; }
.chip.off { opacity: 0.45; }

.topline { display: flex; align-items: center; justify-content: space-between; font-size: 17px; font-weight: 700; margin-top: 4px; min-height: 44px; }
.topline b { color: var(--coral); font-size: 22px; }
.tmr { display: inline-block; min-width: 54px; text-align: center; padding: 6px 10px; border: 3px solid var(--ink); border-radius: 999px; background: #fff; font-weight: 700; }
.tmr.low { background: var(--coral); color: #fff; }

#choices .btn { font-size: 22px; }
#choices .lvl { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }
#choices .btn.l-easy { background: #E8F8EA; }
#choices .btn.l-medium { background: #FFF3CF; }
#choices .btn.l-hard { background: #FFE0E0; }

.canvas-wrap { margin-top: 6px; border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 4px 0 var(--ink); }
#pad { display: block; width: 100%; height: auto; touch-action: none; background: #fff; }
.tools { margin-top: 12px; }
.colors { display: grid; grid-template-columns: repeat(6, 1fr); grid-gap: 8px; }
.sw { height: 38px; border-radius: 12px; border: 3px solid var(--ink); }
.sw.sel { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink); }
.row2 { display: flex; align-items: center; margin-top: 12px; }
.sizes { display: flex; flex: 1; }
.sz { flex: 1; height: 50px; margin-right: 8px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; display: flex; align-items: center; justify-content: center; }
.sz i { display: block; border-radius: 50%; background: var(--ink); }
.sz.sel, .tool.sel { background: var(--yellow); }
.tool { width: 52px; height: 50px; margin-left: 8px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; padding: 5px; }
.tool svg { width: 100%; height: 100%; display: block; }

.hint { font-size: 30px; font-weight: 700; letter-spacing: 6px; margin: 4px 0 6px; word-break: break-all; }
#guess-form { display: flex; margin-top: 14px; }
#guess-form .inp { flex: 1; }
#guess-form .btn { width: auto; margin: 0 0 0 10px; padding: 0 20px; box-shadow: 0 4px 0 var(--ink); }
.fb { min-height: 28px; margin-top: 12px; font-weight: 700; font-size: 18px; }
.fb.no { color: var(--muted); }
.fb.close { color: #E08600; }
.done { margin-top: 10px; padding: 16px; border-radius: 16px; background: #E8F8EA; border: 3px solid var(--green); font-weight: 700; font-size: 20px; }
.word { display: inline-block; font-size: 34px; font-weight: 700; padding: 6px 22px 10px; margin: 8px 0; background: var(--yellow); border: 3px solid var(--ink); border-radius: 16px; transform: rotate(-2deg); }
.pts { font-size: 22px; font-weight: 700; color: #2E8B3A; margin-top: 10px; }
.big-emoji { font-size: 60px; margin-bottom: 6px; }
.wiggle { display: inline-block; animation: wiggle 1.2s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(10deg); } }
.ranklist { text-align: left; margin: 10px 0; }
.rk { display: flex; align-items: center; padding: 8px 4px; border-bottom: 2px dashed #E4E5EC; font-weight: 700; font-size: 17px; }
.rk .pl { width: 30px; }
.rk .av { margin-right: 10px; }
.rk .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk.me { background: #FFF3CF; border-radius: 10px; }
.foot { text-align: center; font-size: 12px; color: #A0A3B1; margin-top: 26px; }
