:root {
  --ink: #0E2A47;
  --muted: #3D5A78;
  --soft: #4A6480;
  --line: #B9D6EE;
  --pale: #EAF5FF;
  --pink: #FF4D8D;
  --lime: #C6F432;
  --coin: #FFC83D;
  --blue: #0B5CAD;
  --shadow: 0 6px 18px rgba(14, 42, 71, 0.14);
  --head: 'Bricolage Grotesque', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
  background-color: #CFEAFF;
  background-image:
    radial-gradient(ellipse 90px 30px at 18% 9%, rgba(255,255,255,.9) 60%, transparent 62%),
    radial-gradient(ellipse 55px 34px at 26% 6%, rgba(255,255,255,.9) 60%, transparent 62%),
    radial-gradient(ellipse 110px 34px at 82% 34%, rgba(255,255,255,.75) 60%, transparent 62%),
    radial-gradient(ellipse 60px 38px at 74% 31%, rgba(255,255,255,.75) 60%, transparent 62%),
    radial-gradient(ellipse 100px 30px at 12% 64%, rgba(255,255,255,.7) 60%, transparent 62%),
    radial-gradient(ellipse 120px 36px at 88% 92%, rgba(255,255,255,.8) 60%, transparent 62%),
    linear-gradient(180deg, #B9E1FF 0%, #E4F4FF 100%);
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.5; cursor: default; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.loading { margin: 40vh auto 0; color: var(--muted); }

h1, h2, .title { font-family: var(--head); font-weight: 800; margin: 0; line-height: 1.05; }
h1 { font-size: 34px; }
h2 { font-size: 24px; }
.sub { font-size: 14px; color: var(--muted); }
.small { font-size: 12px; color: var(--soft); }
.label { font-size: 12px; letter-spacing: 1px; font-weight: 700; color: #2F5A85; text-transform: uppercase; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grow { flex: 1; }
.center { text-align: center; }

.card {
  background: #FFFFFF;
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 16px;
}

.btn {
  min-height: 50px;
  padding: 0 16px;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  background: #FFFFFF;
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn.big { min-height: 56px; font-size: 18px; font-weight: 800; box-shadow: var(--shadow); }
.btn.pink { background: var(--pink); }
.btn.lime { background: var(--lime); }
.btn.coin { background: var(--coin); }
.btn.dark { background: var(--ink); color: #FFFFFF; }
.btn.ghost { background: rgba(255,255,255,0.55); border-style: dashed; }
.btn.block { width: 100%; }
.icon-btn {
  width: 44px; height: 44px;
  border: 1.5px solid var(--ink); border-radius: 12px; background: #FFFFFF;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn svg { width: 20px; height: 20px; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; }
.field input, .search input {
  height: 48px; border: 1.5px solid var(--ink); border-radius: 12px; padding: 0 12px;
  font-size: 16px; background: #FFFFFF; outline: none;
}
.field input:focus, .search input:focus { box-shadow: 0 0 0 3px rgba(255, 77, 141, 0.35); }
.hint-ok { color: #2E7D32; font-size: 12px; }
.hint-bad { color: #C62828; font-size: 12px; }
.error { color: #C62828; font-size: 14px; font-weight: 600; }

.coins {
  height: 36px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: 18px;
  background: var(--coin); font-weight: 800; font-size: 15px;
  display: inline-flex; align-items: center; gap: 6px;
}
.coins::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  background: #E8A400; border: 1.5px solid var(--ink);
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--ink);
  background: var(--lime); font-weight: 800; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.avatar.lg { width: 72px; height: 72px; font-size: 30px; font-family: var(--head); border-width: 2px; }

.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; }

.game-row {
  display: flex; align-items: center; gap: 12px;
  background: #FFFFFF; border: 1.5px solid var(--ink); border-radius: 16px; padding: 12px;
  box-shadow: var(--shadow);
}
.game-row.wait { border-color: var(--line); box-shadow: none; }
.tag { padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--ink); font-weight: 800; font-size: 13px; }
.empty { padding: 14px; text-align: center; color: var(--soft); font-size: 14px; }

.word-card {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 16px 18px; border: 1.5px solid var(--ink); border-radius: 18px;
  background: #FFFFFF; box-shadow: var(--shadow); text-align: left;
}
.word-card .w { font-family: var(--head); font-size: 28px; font-weight: 800; margin-top: 2px; }
.word-card .lvl { font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.word-card .reward { padding: 8px 12px; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--coin); font-weight: 800; }

.pad {
  width: 100%; aspect-ratio: 1 / 1; display: block;
  background: #FFFFFF; border: 2px solid var(--ink); border-radius: 20px; box-shadow: var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.tools { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--ink); padding: 0;
}
.swatch.on { box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 5px var(--pink); }
.brush { width: 44px; height: 44px; border: 1.5px solid var(--line); border-radius: 12px; background: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; }
.brush.on { border-color: var(--ink); background: var(--pale); }
.brush span { background: var(--ink); border-radius: 50%; display: block; }

.progress { flex: 1; height: 8px; border-radius: 4px; background: #E3F1FC; overflow: hidden; }
.progress div { height: 100%; background: var(--pink); width: 0; }

.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.slot {
  width: 38px; height: 46px; border-radius: 10px; border: 1.5px solid var(--ink);
  background: #A9CFEE; font-family: var(--head); font-size: 24px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.slot.filled { background: #FFFFFF; }
.slot.hinted { background: var(--coin); }
.slot.right { background: var(--lime); }
.slot.gap { width: 14px; border: 0; background: transparent; }
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.tile {
  height: 50px; border-radius: 12px; border: 1.5px solid var(--ink); background: #FFFFFF;
  font-family: var(--head); font-size: 22px; font-weight: 800; box-shadow: var(--shadow); padding: 0;
}
.tile.used { background: #A9CFEE; color: #A9CFEE; box-shadow: none; }
.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.stat { background: #FFFFFF; border: 1.5px solid var(--ink); border-radius: 14px; padding: 10px; text-align: center; }
.stat b { display: block; font-family: var(--head); font-size: 24px; font-weight: 800; }
.stat span { font-size: 11px; color: var(--soft); }
.stat.gold { background: var(--coin); }
.stat.gold span { color: var(--ink); }

.pack { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #E3F1FC; }
.pack:last-child { border-bottom: 0; }
.pack .dots { display: flex; gap: 4px; flex: 1; }
.pack .dots i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--ink); display: block; }

.banner { background: var(--lime); border: 1.5px solid var(--ink); border-radius: 16px; padding: 14px; text-align: center; box-shadow: var(--shadow); }
.banner.blue { background: #FFFFFF; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px);
  background: var(--ink); color: #FFFFFF; padding: 12px 18px; border-radius: 14px;
  font-weight: 600; font-size: 14px; max-width: 90vw; transition: transform 0.25s; z-index: 10;
}
.toast.show { transform: translateX(-50%) translateY(0); }

.logo { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 12px; text-align: center; }
.logo .tag2 { font-size: 15px; font-weight: 700; color: var(--blue); letter-spacing: 1px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #8DB8DD; }
.linkish { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 700; text-decoration: underline; }

.shade-row { display: flex; align-items: center; gap: 8px; }
.shade-row input[type=range] {
  -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 14px;
  border-radius: 7px; border: 1.5px solid var(--ink); margin: 0;
}
.shade-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%;
  background: #FFFFFF; border: 2px solid var(--ink); box-shadow: var(--shadow);
}
.shade-row input[type=range]::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%; background: #FFFFFF; border: 2px solid var(--ink);
}
.shade-dot { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--ink); flex: none; }

.legal h2 { font-size: 18px; margin: 18px 0 6px; }
.legal p, .legal li { font-size: 14px; line-height: 1.5; color: var(--muted); margin: 0 0 8px; }
.legal ul { padding-left: 20px; margin: 0 0 8px; }
