/* KI-Adventkalender - Interaktionskomponenten (WP2). Nutzt die --ak-* Tokens aus base.css;
   Fallbackwerte, damit die Datei auch allein funktioniert. Erwartet hellen Kartenhintergrund. */

.ak-ix {
  --ix-ink: var(--ak-ink, #1B2A41);
  --ix-card: var(--ak-card, #FFFFFF);
  --ix-ok: var(--ak-ok, #3BA66B);
  --ix-warn: var(--ak-warn, #E0A526);
  --ix-line: rgba(27, 42, 65, .18);
  --ix-soft: #EEF3F9;
  --ix-sel: var(--ak-night-2, #16305C);
  color: var(--ix-ink);
  font-family: var(--ak-font, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
  font-size: 1rem;
  line-height: 1.45;
  max-width: 100%;
}
.ak-ix *, .ak-ix *::before, .ak-ix *::after { box-sizing: border-box; }
.ak-ix p, .ak-ix h3 { margin: 0; }
:where(.ak-ix button) { font: inherit; color: inherit; cursor: pointer; }
.ak-ix button:disabled { cursor: default; opacity: 1; }
.ak-ix :focus-visible { outline: 3px solid var(--ak-night-2, #16305C); outline-offset: 2px; box-shadow: 0 0 0 6px rgba(110, 193, 228, .65); }
.ak-ix strong { font-weight: 700; }

.ak-prompt { font-size: 1.1rem; font-weight: 600; margin-bottom: 14px; max-width: 70ch; }
.ak-sub { font-size: 1rem; font-weight: 700; margin: 12px 0 8px; }
.ak-progress { font-size: 1rem; opacity: .7; margin-bottom: 8px; }
.ak-count { font-weight: 600; margin-bottom: 8px; }
.ak-hint { min-height: 1.4em; font-size: 1rem; opacity: .75; margin: 8px 0; }
.ak-error { padding: 12px 14px; border-radius: 10px; background: #FDECEC; border: 2px solid #B3263B; }
.ak-tail { margin-top: 12px; }
.ak-tail:empty, .ak-findings:empty, .ak-reveal:empty, .ak-hint:empty { display: none; }

/* Rueckmeldung */
.ak-fb { margin-top: 12px; padding: 10px 14px; border-radius: 10px; border-left: 6px solid transparent; background: var(--ix-soft); max-width: 70ch; }
.ak-fb:empty { display: none; }
.ak-fb.ok { background: #E4F5EB; border-color: var(--ix-ok); }
.ak-fb.warn { background: #FFF3D6; border-color: var(--ix-warn); }
.ak-fb-h { margin-right: 2px; }
.ak-fb.ok .ak-fb-h { color: #1F7A48; }
.ak-fb.warn .ak-fb-h { color: #8A5E00; }

/* Ergebnisleiste */
.ak-result {
  display: inline-block; padding: 8px 18px; border-radius: 999px; font-weight: 700;
  background: var(--ak-night-2, #16305C); color: var(--ak-snow, #F4F7FB);
  animation: ak-pop .35s ease-out;
}

/* Buttons */
.ak-btn, .ak-option, .ak-item, .ak-bucket-btn, .ak-omain, .ak-omove, .ak-cookie, .ak-light {
  border: 2px solid var(--ix-line); background: var(--ix-card); border-radius: 12px; padding: 10px 14px; text-align: left;
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.ak-btn { background: var(--ak-night-2, #16305C); color: var(--ak-snow, #F4F7FB); border-color: var(--ak-night-2, #16305C); font-weight: 700; text-align: center; margin-top: 12px; min-height: 44px; padding: 10px 22px; }
.ak-btn:hover:not(:disabled) { background: var(--ak-night, #0B1D3A); }
.ak-ix .ak-btn:disabled { background: #8E9BB0; border-color: #8E9BB0; color: #fff; }
.ak-next { margin-left: 0; background: var(--ak-w1, #2E7D4F); border-color: var(--ak-w1, #2E7D4F); }
.ak-option:hover:not(:disabled), .ak-item:hover:not(:disabled), .ak-bucket-btn:hover { border-color: var(--ak-night-2, #16305C); background: var(--ix-soft); }
.ak-option.sel, .ak-item.sel, .ak-omain[aria-pressed="true"] { border-color: var(--ak-night-2, #16305C); background: #DCE8F7; box-shadow: 0 0 0 2px var(--ak-night-2, #16305C) inset; }
.ak-option.ok, .ak-item.ok, .ak-oitem.ok .ak-omain { border-color: var(--ix-ok); background: #E4F5EB; opacity: 1; }
.ak-option.warn, .ak-item.warn, .ak-oitem.warn .ak-omain { border-color: var(--ix-warn); background: #FFF3D6; opacity: 1; }
.ak-ix .ak-option:disabled:not(.ok):not(.warn):not(.sel) { opacity: .55; }

/* sort */
.ak-pool { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; min-height: 48px; }
.ak-item { padding: 8px 14px; user-select: none; }
.ak-drag { touch-action: none; }
.ak-dragging { opacity: .35; }
.ak-ghost { position: fixed; z-index: 9999; transform: translate(-50%, -50%) rotate(-3deg); pointer-events: none; box-shadow: 0 8px 22px rgba(0, 0, 0, .3); opacity: .95; }
.ak-buckets { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 12px; }
.ak-bucket { border: 2px dashed var(--ix-line); border-radius: 14px; padding: 8px; background: var(--ix-soft); min-height: 120px; }
.ak-armed .ak-bucket { border-color: var(--ak-night-2, #16305C); animation: ak-pulse 1.2s ease-in-out infinite; }
.ak-bucket-btn { width: 100%; font-weight: 700; text-align: center; background: var(--ix-card); }
.ak-bucket-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ak-bucket-list .ak-item { font-size: 1rem; padding: 6px 10px; }
.ak-mark { margin-left: 8px; font-weight: 800; }
.ak-item.ok .ak-mark { color: #1F7A48; }
.ak-item.warn .ak-mark { color: #8A5E00; }

/* truefalse */
.ak-tfcard {
  background: var(--ix-card); border: 2px solid var(--ix-line); border-radius: 18px; padding: 28px 22px; font-size: 1.15rem; text-align: center;
  box-shadow: 0 6px 18px rgba(27, 42, 65, .12); touch-action: pan-y; user-select: none; min-height: 120px; display: flex; align-items: center; justify-content: center;
  transition: transform .25s ease, border-color .2s; max-width: 70ch; margin: 0 auto;
}
.ak-tfcard.ok { border-color: var(--ix-ok); background: #F1FAF5; }
.ak-tfcard.warn { border-color: var(--ix-warn); background: #FFF9E9; }
.ak-tfrow { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }
.ak-tf { min-width: 130px; margin-top: 0; }
.ak-tf-false { background: var(--ak-w2, #B3263B); border-color: var(--ak-w2, #B3263B); }
.ak-tf-true { background: var(--ak-w1, #2E7D4F); border-color: var(--ak-w1, #2E7D4F); }
.ak-ix-truefalse .ak-fb { margin-left: auto; margin-right: auto; }

/* hotspots */
.ak-hs-text { font-size: 1.1rem; line-height: 1.9; max-width: 70ch; padding: 14px 16px; background: var(--ix-soft); border-radius: 12px; }
.ak-seg { cursor: pointer; border-radius: 3px; background-clip: content-box; }
@media (pointer: coarse) {
  /* gleiche Zeilenhoehe fuer den ganzen Absatz; Tippflaeche je Segment >= 36 px ohne optische Aenderung */
  .ak-hs-text { line-height: 2.1; }
  .ak-seg { padding: 8px 0; }
}
.ak-seg:hover { background-color: rgba(224, 165, 38, .18); }
.ak-seg.found { background-color: #FFE9A8; text-decoration: underline; text-decoration-color: var(--ix-warn); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.ak-seg.miss { background-color: #F0F0F0; text-decoration: line-through; text-decoration-color: rgba(27, 42, 65, .4); }
.ak-findings { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; max-width: 70ch; }
.ak-finding { padding: 8px 12px; border-left: 6px solid var(--ix-ok); background: #E4F5EB; border-radius: 8px; }
.ak-hs-img { position: relative; display: block; border-radius: 12px; overflow: hidden; border: 2px solid var(--ix-line); background: var(--ix-soft); line-height: 0; cursor: crosshair; max-width: 760px; }
.ak-hs-img img { display: block; width: 100%; height: auto; user-select: none; }
.ak-hs-img.ak-noimg { min-height: 220px; }
.ak-spot { position: absolute; padding: 0; border: 2px solid transparent; border-radius: 8px; background: transparent; }
.ak-spot:focus-visible { border: 2px dashed var(--ak-gold, #FFC857); outline-offset: 0; }
.ak-spot.found { border: 3px solid var(--ak-w2, #B3263B); background: rgba(179, 38, 59, .15); }

/* choice */
.ak-card { background: var(--ix-card); border: 2px solid var(--ix-line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; max-width: 760px; }
.ak-card-text { font-weight: 600; margin-bottom: 10px; }
.ak-options { display: grid; gap: 8px; }
.ak-tablewrap { overflow-x: auto; margin-bottom: 14px; border: 2px solid var(--ix-line); border-radius: 12px; }
.ak-table { border-collapse: collapse; width: 100%; font-size: 1rem; }
.ak-table th, .ak-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--ix-line); }
.ak-table th { background: var(--ix-soft); }
.ak-table tr:last-child td { border-bottom: 0; }

/* traffic */
.ak-traffic { display: grid; gap: 12px; max-width: 760px; }
.ak-trow { background: var(--ix-card); border: 2px solid var(--ix-line); border-radius: 14px; padding: 12px 14px; }
.ak-trow.ok { border-color: var(--ix-ok); }
.ak-trow.warn { border-color: var(--ix-warn); }
.ak-trow-text { font-weight: 600; margin-bottom: 8px; }
.ak-lights { display: flex; gap: 10px; }
.ak-light { flex: 1 1 0; text-align: center; font-weight: 700; color: #fff; border-radius: 999px; min-height: 44px; border-color: transparent; }
.ak-light.red { background: #C0392B; } .ak-light.yellow { background: #E0A526; color: var(--ak-ink, #1B2A41); } .ak-light.green { background: #2E9C5F; }
.ak-light:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0, 0, 0, .2); }
.ak-ix .ak-light:disabled { opacity: .35; }
.ak-ix .ak-light:disabled.right, .ak-ix .ak-light:disabled.chosen { opacity: 1; }
.ak-light.chosen { box-shadow: 0 0 0 3px var(--ak-ink, #1B2A41); }
.ak-light.right::after { content: " \2713"; }

/* order */
.ak-order { list-style: none; padding: 0; margin: 0 0 4px; display: grid; gap: 8px; max-width: 760px; }
.ak-oitem { display: flex; gap: 6px; align-items: stretch; }
.ak-onum { flex: 0 0 34px; display: flex; align-items: center; justify-content: center; font-weight: 800; border-radius: 10px; background: var(--ix-soft); }
.ak-omain { flex: 1 1 auto; user-select: none; }
.ak-omove { flex: 0 0 44px; text-align: center; padding: 6px; }
.ak-ix .ak-omove:disabled { opacity: .3; }

/* builder */
.ak-slots { display: grid; gap: 12px; }
.ak-slot { border: 2px solid var(--ix-line); border-radius: 14px; padding: 8px 12px 12px; margin: 0; min-width: 0; display: grid; gap: 8px; background: var(--ix-card); }
.ak-slot legend { font-weight: 800; padding: 0 6px; }
.ak-preview { margin-top: 14px; padding: 12px 16px; border-radius: 12px; background: var(--ix-soft); border: 2px dashed var(--ix-line); max-width: 760px; }
.ak-preview-text { font-style: italic; }
.ak-reply { margin-top: 12px; max-width: 760px; }
.ak-reply:empty { display: none; }

/* chat */
.ak-chat { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.ak-bubble { max-width: 85%; padding: 10px 14px; border-radius: 18px; position: relative; animation: ak-pop .25s ease-out; }
.ak-bubble, .ak-btext, .ak-fb-t { white-space: pre-line; }
.ak-tag { display: inline-block; margin-top: 4px; font-size: 1rem; font-weight: 700; padding: 0 8px; border-radius: 999px; background: rgba(255,255,255,.85); color: var(--ak-ink, #1B2A41); }
.ak-bubble.best .ak-tag { background: #E4F5EB; color: #1F7A48; }
.ak-bubble.other .ak-tag { opacity: .85; }
.ak-who { display: block; font-size: 1rem; font-weight: 700; opacity: .75; margin-bottom: 2px; letter-spacing: .02em; }
.ak-bubble.ai { align-self: flex-start; border-bottom-left-radius: 4px; color: #0B1D3A; border: 2px solid rgba(110, 193, 228, .6);
  background: linear-gradient(135deg, #E3F4FB 0%, #EDE6FA 55%, #DDF3F6 100%); box-shadow: 0 0 14px rgba(110, 193, 228, .45); }
.ak-bubble.you { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--ak-night-2, #16305C); color: var(--ak-snow, #F4F7FB); }
.ak-choices { margin-top: 14px; max-width: 720px; }
.ak-pick { font-weight: 700; margin-bottom: 8px; }
.ak-pickbtns { display: grid; gap: 8px; }

/* slider */
.ak-sliderwrap { max-width: 640px; margin: 8px 0; }
.ak-value { display: block; font-size: 1.6rem; font-weight: 800; text-align: center; margin-bottom: 4px; }
.ak-range { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; margin: 0; background: transparent; accent-color: var(--ak-night-2, #16305C); }
.ak-range::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--ak-w4, #6EC1E4), var(--ak-w2, #B3263B)); }
.ak-range::-moz-range-track { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--ak-w4, #6EC1E4), var(--ak-w2, #B3263B)); }
.ak-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: var(--ak-gold, #FFC857); border: 3px solid var(--ak-night-2, #16305C); }
.ak-range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--ak-gold, #FFC857); border: 3px solid var(--ak-night-2, #16305C); }
.ak-track { position: relative; height: 12px; margin: 2px 14px 0; border-radius: 6px; background: transparent; }
.ak-track.shown { background: var(--ix-soft); }
.ak-zone { position: absolute; top: 0; bottom: 0; border-radius: 6px; opacity: 0; }
.ak-track.shown .ak-zone { opacity: 1; background: rgba(59, 166, 107, .45); }
.ak-track.warn .ak-zone { background: rgba(224, 165, 38, .55); }
.ak-mark-answer { position: absolute; top: -4px; width: 4px; height: 20px; margin-left: -2px; border-radius: 2px; background: var(--ak-ink, #1B2A41); opacity: 0; }
.ak-track.shown .ak-mark-answer { opacity: 1; }
.ak-ends { display: flex; justify-content: space-between; font-weight: 700; font-size: 1rem; margin-top: 4px; }

/* reflect */
.ak-reflect { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; max-width: 900px; }
.ak-label { display: block; font-weight: 600; margin: 14px 0 6px; }
.ak-textarea, .ak-input { width: 100%; max-width: 560px; font: inherit; padding: 10px 12px; border: 2px solid var(--ix-line); border-radius: 10px; background: var(--ix-card); color: var(--ix-ink); }
.ak-textarea { resize: vertical; }

/* train */
.ak-cookies { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.ak-cookie { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 10px; min-width: 96px; text-align: center; position: relative; }
.ak-testcell { cursor: default; }
.ak-testcell.ok { border-color: var(--ix-ok); background: #E4F5EB; }
.ak-testcell.warn { border-color: var(--ix-warn); background: #FFF3D6; }
.ak-testcell .ak-mark { position: absolute; top: 2px; right: 8px; margin: 0; }
.ak-chip { font-size: 1rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--ix-soft); }
.ak-chip.none { opacity: .6; }
.ak-chip.c0 { background: #D9EBDD; } .ak-chip.c1 { background: #F4D6DB; }
.ak-cookie-svg { overflow: visible; }
.ak-trainresult { margin-top: 10px; font-weight: 700; font-size: 1.1rem; }
.ak-trainout { margin-top: 10px; }

/* predict */
.ak-prefix { font-size: 1.4rem; margin-bottom: 10px; }
.ak-predict { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; }
.ak-predict .ak-label { flex: 0 0 100%; margin: 0; }
.ak-predict .ak-input { flex: 1 1 200px; width: auto; }
.ak-predict .ak-btn { margin-top: 0; }
.ak-bars { margin-top: 12px; max-width: 640px; }
.ak-bar { display: grid; grid-template-columns: 110px 1fr 56px auto; gap: 10px; align-items: center; padding: 4px 8px; border-radius: 8px; }
.ak-bar.mine { background: #FFF3D6; }
.ak-bar-word { font-weight: 600; overflow-wrap: anywhere; }
.ak-bar-track { height: 16px; border-radius: 8px; background: var(--ix-soft); overflow: hidden; }
.ak-bar-fill { display: block; height: 100%; border-radius: 8px; background: var(--ak-night-2, #16305C); animation: ak-grow .6s ease-out; transform-origin: left; }
.ak-bar.mine .ak-bar-fill { background: var(--ak-w3, #D4A017); }
.ak-bar-p { text-align: right; font-weight: 700; }
.ak-badge { font-size: 1rem; font-weight: 700; background: var(--ak-w3, #D4A017); color: var(--ak-ink, #1B2A41); padding: 2px 8px; border-radius: 999px; }

/* memory */
.ak-balls { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; max-width: 900px; }
.ak-ball {
  aspect-ratio: 1; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .7); color: #fff; font-weight: 700; font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 14px; line-height: 1.15; overflow: hidden; overflow-wrap: anywhere;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .25), inset -6px -8px 14px rgba(0, 0, 0, .2), inset 6px 6px 12px rgba(255, 255, 255, .25);
  transition: transform .3s ease, background .2s;
}
.ak-ball.w1 { background: var(--ak-w1, #2E7D4F); } .ak-ball.w2 { background: var(--ak-w2, #B3263B); }
.ak-ball.w3 { background: var(--ak-w3, #D4A017); color: var(--ak-ink, #1B2A41); } .ak-ball.w4 { background: var(--ak-w4, #6EC1E4); color: var(--ak-ink, #1B2A41); }
.ak-ball:hover:not(:disabled) { transform: translateY(-3px); }
.ak-ball.open { background: var(--ak-snow, #F4F7FB); color: var(--ak-ink, #1B2A41); border-color: var(--ak-night-2, #16305C); font-size: .95rem; transform: rotateY(0) scale(1.03); }
.ak-ball.open.long { font-size: .875rem; padding: 10px; }
.ak-ball.open, .ak-ball.matched { hyphens: auto; overflow-wrap: break-word; padding: 8px; }
.ak-ball.matched { background: #E4F5EB; border-color: var(--ix-ok); color: var(--ak-ink, #1B2A41); opacity: 1; box-shadow: 0 0 12px rgba(59, 166, 107, .6); }
.ak-reveal { min-height: 3.2em; margin-top: 12px; max-width: 900px; position: sticky; bottom: 0; background: var(--ix-card); border-top: 2px solid var(--ix-line); padding: 6px 4px; z-index: 2; }
.ak-reveal-line { padding: 4px 0; }

@keyframes ak-pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes ak-pulse { 50% { background: #DCE8F7; } }
@keyframes ak-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 699px) {
  .ak-buckets { grid-template-columns: 1fr; }
  .ak-reflect { grid-template-columns: 1fr; }
  .ak-bubble { max-width: 94%; }
  .ak-bar { grid-template-columns: 84px 1fr 48px; }
  .ak-bar .ak-badge { grid-column: 1 / -1; justify-self: start; }
  .ak-tf { min-width: 0; flex: 1 1 0; }
  .ak-balls { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ak-ball { padding: 8px; font-size: 1.3rem; }
  .ak-ball.open { font-size: .875rem; }
  .ak-ball.open.long { font-size: .875rem; padding: 8px; }
  .ak-prefix { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ak-ix *, .ak-ix *::before, .ak-ix *::after { animation: none !important; transition: none !important; }
}
