/* Halaman Latihan (latihan.html) */
body {
    background: radial-gradient(ellipse at center, #3a3a3a 0%, #1e1e1e 100%) !important;
    color: #e8e8e8;
    margin: 0;
}

.hidden { display: none !important; }
.muted { color: #9a9a9a; font-size: 13px; }

.tr-page {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 16px;
    box-sizing: border-box;
}
.tr-page h1 { margin: 0; font-size: 22px; }

.tr-card {
    background: #2b2b2b;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 14px;
}
.tr-card h2 { margin: 6px 0 2px; font-size: 18px; }
.tr-card h3 { margin: 0 0 10px; font-size: 15px; }

.tr-btn {
    display: inline-flex; align-items: center; gap: 4px;
    background: #444; color: #e8e8e8;
    border: 1px solid #555; border-radius: 4px;
    padding: 7px 12px; font-size: 13px;
    cursor: pointer; text-decoration: none;
}
.tr-btn:hover:not(:disabled) { background: #555; }
.tr-btn:disabled { opacity: 0.5; cursor: default; }
.tr-btn.primary { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.tr-btn.primary:hover:not(:disabled) { background: #388e3c; }

/* ---------- Pilih jenis latihan ---------- */
.tr-home-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.tr-home-card {
    display: flex; flex-direction: column; gap: 8px;
    background: #2b2b2b; border: 1px solid #444; border-radius: 8px;
    padding: 20px; color: #e8e8e8; text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}
.tr-home-card:hover { border-color: #38bdf8; transform: translateY(-2px); }
.tr-home-card strong { font-size: 18px; }
.tr-home-icon { font-size: 34px; line-height: 1; }
.tr-home-progress { color: #22c55e; font-size: 13px; font-weight: 600; }

/* ---------- Daftar ---------- */
.tr-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tr-group-title { margin: 22px 0 10px; font-size: 15px; color: #bbb; text-transform: uppercase; letter-spacing: 0.5px; }
.tr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}
.tr-item {
    background: #2b2b2b; border: 1px solid #444; border-radius: 6px;
    padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.tr-item.done { border-color: #2e7d32; }
.tr-item-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tr-item-head strong { font-size: 16px; }
.tr-tag {
    font-size: 11px; padding: 1px 7px; border-radius: 10px;
    background: #3a3a3a; border: 1px solid #555; color: #ccc; white-space: nowrap;
}
.tr-tag.w { background: #eee; color: #222; border-color: #bbb; }
.tr-tag.b { background: #111; color: #eee; border-color: #555; }
.tr-tag.ok { background: #1f3a1f; border-color: #2e7d32; color: #8fe39a; }
.tr-item p { margin: 0; font-size: 13px; color: #bbb; line-height: 1.45; }
.tr-lines { display: flex; flex-direction: column; gap: 4px; }
.tr-line {
    display: flex; align-items: center; gap: 8px;
    color: #e8e8e8; text-decoration: none; font-size: 14px;
    padding: 6px 8px; border-radius: 4px; background: #333;
}
.tr-line:hover { background: #3d3d3d; }
.tr-line .mark { width: 16px; text-align: center; color: #666; flex-shrink: 0; }
.tr-line.done .mark { color: #22c55e; }
.tr-line .go { margin-left: auto; color: #888; }
/* main.css memaksa .cg-wrap 100% x 100%, jadi papan mini diberi pembungkus berukuran tetap */
.tr-mini {
    width: 120px; height: 120px; flex-shrink: 0; pointer-events: none;
}
.tr-item-row { display: flex; gap: 12px; align-items: flex-start; }
.tr-item-row .tr-item-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tr-item-row .tr-btn { align-self: flex-start; }

/* ---------- Berlatih ---------- */
.tr-layout {
    display: grid;
    grid-template-columns: minmax(0, 600px) 340px;
    gap: 16px;
    justify-content: center;
    align-items: start;
}
.tr-board-col { min-width: 0; }
.tr-board {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.tr-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tr-crumb a { color: #38bdf8; text-decoration: none; font-size: 13px; }
.tr-desc { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: #ccc; }

.tr-feedback {
    margin-top: 12px; padding: 10px 12px; border-radius: 4px;
    background: #262421; border: 1px solid #444; font-size: 14px; line-height: 1.45;
    min-height: 20px;
}
.tr-feedback.ok   { background: #1f3a1f; border-color: #2e7d32; }
.tr-feedback.bad  { background: #3a1f1f; border-color: #a33; }
.tr-feedback.info { background: #1f2a3a; border-color: #38bdf8; }
.tr-feedback.win  { background: #1f3a1f; border-color: #22c55e; font-weight: 600; }

.tr-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tr-check { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: #ccc; cursor: pointer; }

.tr-moves {
    display: grid;
    grid-template-columns: 36px 1fr 1fr;
    gap: 2px 6px;
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 14px;
}
.tr-moves .no { color: #777; text-align: right; }
.tr-moves .mv { padding: 1px 4px; border-radius: 3px; }
.tr-moves .mv.last { background: #3a6ea5; color: #fff; }

/* Pilih promosi */
.tr-promo {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0, 0, 0, 0.55);
    display: flex; align-items: center; justify-content: center;
}
.tr-promo-box { background: #2b2b2b; border: 1px solid #555; border-radius: 8px; padding: 16px; text-align: center; }
.tr-promo-row { display: flex; gap: 8px; margin-top: 10px; }
.tr-promo-row button {
    font-size: 36px; width: 60px; height: 60px; line-height: 1;
    background: #444; color: #fff; border: 1px solid #666; border-radius: 6px; cursor: pointer;
}
.tr-promo-row button:hover { background: #555; }

@media (max-width: 900px) {
    .tr-layout { grid-template-columns: 1fr; }
    .tr-board-col { max-width: 600px; width: 100%; margin: 0 auto; }
    .tr-moves { max-height: 180px; }
}
@media (max-width: 480px) {
    .tr-page { margin: 10px auto; padding: 0 8px; }
    .tr-mini { width: 90px; height: 90px; }
}

/* ---------- Pembukaan lain (database ECO) ---------- */
.tr-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tr-modal {
    position: fixed; inset: 0; z-index: 1500;
    background: rgba(0, 0, 0, 0.55);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 60px 12px 12px; box-sizing: border-box;
}
.tr-modal-box {
    background: #2b2b2b; border: 1px solid #555; border-radius: 8px;
    width: 100%; max-width: 560px; max-height: calc(100vh - 80px);
    display: flex; flex-direction: column; gap: 10px; padding: 14px; box-sizing: border-box;
}
.tr-modal-head { display: flex; align-items: center; justify-content: space-between; }
.tr-input {
    background: #1f1d1b; color: #e8e8e8; border: 1px solid #555; border-radius: 4px;
    padding: 9px 10px; font-size: 15px; width: 100%; box-sizing: border-box;
}
.tr-input:focus { outline: none; border-color: #38bdf8; }
.eco-free { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: #ccc; }
.eco-results { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.eco-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; border-radius: 4px; background: #333;
}
.eco-row .eco-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.eco-row .eco-name { font-size: 14px; }
.eco-row .eco-moves { font-size: 12px; color: #9a9a9a; font-family: monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eco-row .tr-btn { padding: 4px 8px; font-size: 12px; }
