/* ================================================================
   Parts-of-Speech Lab — charts + games widget.
   Loaded by grammar-parts-of-speech.html alongside lq-core.css and
   styled from the same brand tokens (--surface, --border, --module…).
   ================================================================ */

.pl-stack { display: grid; gap: 1rem; }
.pl-panel { border: 1px solid var(--border); border-radius: 18px; padding: 1.1rem 1.2rem; background: var(--surface); }
.pl-lab   { font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
            color: var(--text-muted); margin-bottom: .6rem; }
.pl-row   { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.pl-note  { margin-top: .75rem; color: var(--text-muted); font-size: .9rem; line-height: 1.55; }
.pl-note b { color: var(--text); }

.pl-inp { flex: 1; min-width: 210px; padding: .6rem .85rem; border-radius: 12px; border: 1px solid var(--border);
          background: var(--bg-soft); color: var(--text); font-size: 1rem; font-family: inherit; }
.pl-inp:focus { outline: none; border-color: var(--module); }
.pl-btn { padding: .55rem .95rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
          color: var(--text); font-weight: 600; cursor: pointer; font-size: .9rem; font-family: inherit;
          transition: border-color .15s, background .15s, transform .15s; }
.pl-btn:hover:not(:disabled) { border-color: var(--module); transform: translateY(-1px); }
.pl-btn.go { background: var(--module-grad); color: #fff; border-color: transparent; }
.pl-btn.on { background: color-mix(in srgb, var(--module) 14%, transparent); border-color: var(--module); }
.pl-btn:disabled { opacity: .55; cursor: default; }

/* ---- the word strip ---- */
.pl-strip { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }
.pl-tok { border: 1px solid var(--c); border-bottom-width: 3px; border-radius: 10px; padding: .38rem .6rem .45rem;
          background: color-mix(in srgb, var(--c) 9%, transparent); color: var(--text); font-weight: 600;
          font-size: .95rem; line-height: 1.2; cursor: pointer; font-family: inherit;
          transition: transform .18s, opacity .18s, box-shadow .18s; animation: plPop .28s ease both; }
@keyframes plPop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pl-tok .tg { display: block; font-size: .58rem; font-weight: 800; letter-spacing: .07em; color: var(--c); margin-top: .15rem; }
.pl-tok.guess { border-style: dashed; }
.pl-tok.hot   { transform: translateY(-3px); box-shadow: 0 6px 16px color-mix(in srgb, var(--c) 35%, transparent); }
.pl-tok.mute  { opacity: .22; }

/* ---- donut chart ---- */
.pl-chart { display: grid; grid-template-columns: 210px 1fr; gap: 1.2rem; align-items: center; }
@media (max-width: 640px) { .pl-chart { grid-template-columns: 1fr; } }
.pl-donut { width: 210px; height: 210px; margin: 0 auto; display: block; }
.pl-donut path { cursor: pointer; transition: opacity .2s, transform .2s; transform-origin: 100px 100px; }
.pl-donut path.off { opacity: .16; }
.pl-donut path.up  { transform: scale(1.06); }
.pl-donut .cn { font-size: 2.1rem; font-weight: 800; fill: var(--text); }
.pl-donut .cl { font-size: .62rem; font-weight: 700; letter-spacing: .12em; fill: var(--text-muted); }

.pl-keys { display: flex; flex-wrap: wrap; gap: .4rem; }
.pl-key  { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .7rem; border-radius: 999px;
           border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
           font-size: .85rem; font-weight: 600; font-family: inherit; }
.pl-key i { width: .7rem; height: .7rem; border-radius: 50%; background: var(--c); display: block; }
.pl-key b { color: var(--text-muted); font-weight: 700; }
.pl-key.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.pl-key.on b { color: var(--text); }

/* ---- bar chart ---- */
.pl-bars { display: grid; gap: .45rem; }
.pl-bar  { display: grid; grid-template-columns: 92px 1fr 28px; gap: .6rem; align-items: center; font-size: .85rem; }
.pl-bar span { color: var(--text-muted); }
.pl-bar u { display: block; height: 12px; border-radius: 6px; background: var(--c); text-decoration: none;
            width: 0; transition: width .5s cubic-bezier(.22,1,.36,1); }
.pl-bar b { text-align: right; font-weight: 700; }

/* ---- the 8 families ---- */
.pl-tree { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: .55rem; }
.pl-tb   { text-align: left; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 12px;
           padding: .6rem .75rem; background: var(--surface); cursor: pointer; color: var(--text); font-family: inherit;
           transition: background .15s, border-color .15s, transform .15s; }
.pl-tb:hover { transform: translateY(-2px); }
.pl-tbimg { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 9px; display: block;
            margin-bottom: .45rem; background: var(--bg-soft); }
.pl-infoimg { float: right; width: 132px; aspect-ratio: 1/1; object-fit: cover; border-radius: 14px;
              margin: 0 0 .6rem .8rem; border: 1px solid var(--border); }
@media (max-width: 560px) { .pl-infoimg { float: none; width: 100%; max-width: 220px; margin: 0 auto .7rem; } }
.pl-tb .tn { display: block; font-weight: 700; font-size: .98rem; }
.pl-tb .td { display: block; font-size: .79rem; color: var(--text-muted); margin-top: .12rem; line-height: 1.4; }
.pl-tb.on  { background: color-mix(in srgb, var(--c) 11%, transparent); border-color: var(--c); }

.pl-pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.pl-pill  { padding: .3rem .62rem; border-radius: 999px; border: 1px solid var(--border);
            background: var(--bg-soft); font-size: .82rem; }
.pl-eg    { padding: .55rem .8rem; border-radius: 10px; background: var(--bg-soft); font-size: .98rem; line-height: 1.5; }

/* ---- spot game ---- */
.pl-q     { font-size: 1.08rem; font-weight: 600; margin-bottom: .75rem; line-height: 1.5; }
.pl-q em  { font-style: normal; padding: .1rem .4rem; border-radius: 6px;
            background: color-mix(in srgb, var(--module) 14%, transparent); color: var(--module); font-weight: 700; }
.pl-v     { margin-top: .8rem; font-weight: 600; line-height: 1.55; }
.pl-v .ok { color: #059669; }
.pl-v .no { color: #dc2626; }
.pl-score { font-size: .85rem; color: var(--text-muted); margin-top: .5rem; }

/* ================= mobile ================= */
@media (max-width: 700px) {
  /* comfortable thumb targets */
  .pl-btn, .pl-key, .pl-inp { min-height: 44px; }
  .pl-tok { padding: .45rem .6rem .5rem; }

  /* the family list reads better two-up than as one long stack */
  .pl-tree { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .pl-tb { padding: .55rem .6rem; }
  .pl-tb .td { font-size: .74rem; }

  .pl-panel { padding: .95rem 1rem; }
  .pl-donut { width: 180px; height: 180px; }
}
