/* Günün Görevi (js/ui/challenge.js) — app.css değişkenlerini kullanır. */

/* Üst çubuk giriş düğmesi */
.ch-open {
  flex: none; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px;
  color: #ffe2b0; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  border-color: rgba(201, 162, 75, .5); background: linear-gradient(180deg, rgba(201, 162, 75, .22), rgba(201, 162, 75, .08)), var(--glass);
}
.ch-open svg { width: 18px; height: 18px; color: #e8c873; }
.ch-open:hover, .ch-open[aria-expanded="true"] { border-color: #e8c873; color: #fff; }

/* Kart: masaüstünde sol üstte (istatistik kartlarının yerinde) */
#challenge {
  position: absolute; z-index: 45; top: var(--gap); left: var(--gap);
  width: 360px; max-height: calc(100% - var(--tl-h) - 3 * var(--gap));
  display: flex; flex-direction: column; overflow: hidden; background: var(--glass2);
  border-color: rgba(201, 162, 75, .35);
}
#challenge:focus { outline: none; }
/* İstatistik kartları kartın altında kalır; tahmin sırasında ise önizleme halkalarını göstermesin diye tamamen gizlenir. */
body.challenge-open #stats { display: none; }

.ch-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px 14px; border-bottom: 1px solid var(--line); flex: none; }
.ch-head .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(201, 162, 75, .16); color: #e8c873; flex: none; }
.ch-head .ico svg { width: 17px; height: 17px; }
.ch-head h2 { flex: 1; min-width: 0; margin: 0; font: 600 15px/1.2 var(--f-disp); letter-spacing: .04em; }
.ch-head h2 small { display: block; font: 400 11.5px/1.3 var(--f-ui); color: var(--muted); letter-spacing: 0; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ch-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); flex: none; }
.ch-tabs [role="tab"] { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 8px 6px 9px; font-size: 12.5px; font-weight: 600; border-bottom: 2px solid transparent; }
.ch-tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: #e8c873; }
.ch-tabs [role="tab"]:hover { color: var(--text); }

.ch-body { padding: 12px 14px 14px; overflow: auto; display: grid; gap: 12px; align-content: start; overscroll-behavior: contain; }
.ch-body .msg { margin: 0; }
.ch-p { margin: 0; color: var(--text2); font-size: 13px; line-height: 1.5; }
.ch-h { margin: 2px 0 0; font: 600 14px/1.25 var(--f-disp); letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.ch-kicker { margin: 0; color: #e8c873; font: 600 11px/1 var(--f-disp); letter-spacing: .14em; text-transform: uppercase; }

.ch-facts { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 12.5px; }
.ch-facts dt { color: var(--muted); }
.ch-facts dd { margin: 0; color: var(--text); font-weight: 500; }
.ch-qlist { margin: 0; padding-left: 18px; color: var(--text2); font-size: 12.5px; display: grid; gap: 3px; }

.ch-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.ch-share { justify-content: flex-start; }

.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c, #fff); box-shadow: 0 0 0 2px rgba(255, 255, 255, .12); flex: none; display: inline-block; }

.ch-progress { display: flex; gap: 6px; }
.ch-progress span { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); }
.ch-progress .done { background: #c9a24b; }
.ch-progress .cur { background: linear-gradient(90deg, #c9a24b, #ffe2b0); }

.ch-guess .v { font-size: 15px; color: #ffe2b0; }
.ch-scale { position: relative; height: 14px; font-size: 10.5px; color: var(--dim); margin: -2px 6px 0; }
.ch-scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ch-scale span:first-child { transform: none; }
.ch-scale span:last-child { transform: translateX(-100%); }

.ch-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ch-rows li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .035); border: 1px solid var(--line); font-size: 13px; }
.ch-rows .lbl { flex: 1; min-width: 0; }
.ch-rows .lbl small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.ch-rows b { font: 700 16px/1 var(--f-disp); }
.tile { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.tile.green { background: #3ddc84; } .tile.yellow { background: #ffc53d; } .tile.red { background: #ff4d4f; }

.ch-score { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(201, 162, 75, .16), rgba(201, 162, 75, .04)); border: 1px solid rgba(201, 162, 75, .4); }
.ch-score .big { font: 700 38px/1 var(--f-disp); }
.ch-score .of { color: var(--muted); font: 500 16px/1 var(--f-disp); margin-left: 6px; }
.ch-score .tiles { font-size: 24px; letter-spacing: 2px; }

.ch-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 6px; }
.ch-stats div { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .035); border: 1px solid var(--line); }
.ch-stats small { display: block; color: var(--muted); font-size: 11px; }
.ch-stats b { font: 700 17px/1.2 var(--f-disp); }

.ch-badges { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ch-badge { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); font-size: 12.5px; }
.ch-badge .bi { font-size: 22px; line-height: 1; }
.ch-badge small { display: block; color: var(--muted); font-size: 11.5px; }
.ch-badge.new, .ch-badge.got { border-color: rgba(201, 162, 75, .55); background: rgba(201, 162, 75, .1); }
.ch-badge.locked { opacity: .5; filter: grayscale(.8); }

.ch-why { border-radius: 10px; border: 1px solid var(--line); padding: 8px 12px; background: rgba(90, 178, 255, .05); }
.ch-why summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--info); }
.ch-why p { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text2); }

.ch-seg { display: grid; grid-template-columns: repeat(4, 1fr); }
.ch-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ch-board li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; font-size: 13px; background: rgba(255, 255, 255, .025); }
.ch-board li.me { background: rgba(201, 162, 75, .16); border: 1px solid rgba(201, 162, 75, .45); }
.ch-board li.sep { background: none; justify-content: center; color: var(--dim); padding: 0; }
.ch-board .rk { width: 28px; color: var(--muted); font-weight: 600; }
.ch-board .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-board .nm small { color: var(--muted); }
.ch-board b { font: 700 14px/1 var(--f-disp); }

.ch-err { color: var(--red) !important; }

/* Orta genişlik: üst çubuk kartın sağından başlasın */
@media (min-width: 821px) and (max-width: 1380px) {
  body.challenge-open #topbar { left: calc(360px + 2 * var(--gap)); }
}
@media (min-width: 821px) {
  body.challenge-open #hints { display: none; }
}

/* Mobil: alttan açılan sayfa (kontrol panelinin üstünde) */
@media (max-width: 820px) {
  .ch-open { height: 42px; padding: 0 10px; }
  .ch-open span { display: none; }
  #challenge {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: min(62vh, calc(100% - 70px));
    border-radius: 18px 18px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); z-index: 55;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .55);
  }
  body.challenge-open #timeline, body.challenge-open #stats { display: none; }
  .ch-score .big { font-size: 30px; }
}
