@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@200;300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

.tl { width: min(1600px, calc(100vw - 96px)); margin-left: 50%; transform: translateX(-50%);
      --win: #00A878; --loss: #BB4430; --edit: #009DE0; --band: #f1f2f4; --ink: #222; --mute: #6b7280;
      font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 400; color: var(--ink); outline: none; }

.tl-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; margin-bottom: .8rem; }
.tl-title { display: flex; flex-direction: column; align-items: center; }
.tl-top::before { content: ''; }
@media (max-width: 1100px) { .tl-top { display: flex; flex-direction: column; align-items: center; gap: .4rem; } .tl-top::before { display: none; } }
.tl-heading { font-size: 2rem; text-align: center; white-space: nowrap; }
.tl-legend { align-self: end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 1rem; font-size: .8rem; }
.tl-legend .g { display: flex; flex-direction: column; align-items: center; }
.tl-legend .g > span { font-size: .72rem; color: #444; }
.tl-legend .row { display: flex; gap: .6rem; align-items: center; }
.tl-legend i { display: inline-block; width: 10px; height: 10px; margin-right: .3rem; vertical-align: -1px; }

.tl-line { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tl-line.open { max-height: 65vh; overflow-y: auto; }
.tl-models { display: flex; gap: .4rem; margin-bottom: .6rem; }
.tl-models button { padding: .25rem .9rem; border: 1px solid #d1d5db; border-radius: 999px; color: #444; font-size: .9rem; }
.tl-models button i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .45rem; }
.tl-models button:hover { background: var(--band); }
.tl-models button.on { background: color-mix(in srgb, var(--c) 16%, white); border-color: color-mix(in srgb, var(--c) 55%, white); color: #222; }
.tl-expand { padding: .15rem .6rem; border: 1px solid #cfd5dc; border-radius: 5px; background: #f6f7f9; color: #333; font-size: .75rem;
              box-shadow: 0 1px 0 rgba(0, 0, 0, .04); }
.tl-expand::before { content: ''; display: inline-block; width: 1.05em; height: 1.05em; margin-right: .35rem; vertical-align: -.18em;
                     background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236b7280' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v12M4.5 5.5 8 2l3.5 3.5M4.5 10.5 8 14l3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.tl-expand:hover { background: #eceff3; }
.tl-svg { display: block; user-select: none; }
.tl-svg text { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 400; }
.tl-hit { fill: transparent; cursor: pointer; }
.tl-hit:hover { fill: rgba(40, 70, 120, .08); }
.tl-hit.sel { fill: rgba(40, 70, 120, .16); }
.tl-hint { text-align: center; font-size: .85rem; color: var(--mute); margin: .2rem 0 .5rem; }

.tl-panel { max-width: 1180px; margin: .6rem auto 0; height: min(72vh, 740px); display: flex; flex-direction: column; border: 3px solid #c5ced6; border-radius: 4px; padding: 1rem 1.1rem 0; }
.tl-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .9rem; }
.tl-head .t { flex: 1; font-size: 1.3rem; }
.tl-nav { width: 2rem; height: 2rem; border-radius: 999px; border: 1px solid #d1d5db; color: #444; font-size: 1.1rem; line-height: 1; }
.tl-nav:hover:not(:disabled) { background: var(--band); }
.tl-nav:disabled { opacity: .3; }

.tl-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 450px; }
.tl-body > div:first-child { padding-right: 2.25rem; }
.tl-body > .tl-side { padding-left: 2.25rem; border-left: 1px solid #e3e6ea; }
.tl-body > div { overflow-x: hidden; overflow-y: auto; padding-bottom: 1rem; scrollbar-width: thin; }
@media (max-width: 860px) { .tl-body { display: block; overflow-y: auto; } .tl-body > div { overflow: visible; } .tl-body > div:first-child { padding-right: 0; } .tl-body > .tl-side { padding-left: 0; border-left: 0; border-top: 1px solid #e3e6ea; padding-top: 1rem; } .tl-heading { font-size: 1.4rem; } .tl-panel { padding: .6rem .6rem 0; } }
.tl-label { font-size: 1rem; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); margin-bottom: .45rem; }


.tl-think { background: var(--band); border-radius: 12px; padding: .6rem .8rem; margin-bottom: .55rem;
            font-family: 'IBM Plex Mono', monospace; font-size: .8rem; line-height: 1.5; white-space: pre-wrap; }
.tl-think > div { display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.tl-think.more { cursor: pointer; }
.tl-think.more::after { content: 'show more'; display: block; margin-top: .2rem; font-size: .72rem; color: var(--mute); }
.tl-think.open > div { display: block; }
.tl-think.open::after { content: 'show less'; }
.tl-empty { color: var(--mute); font-size: .9rem; font-style: italic; }
.tl-act { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: 0 0 .55rem; padding: .3rem .4rem; border-radius: 8px; cursor: pointer;
          font-family: 'IBM Plex Mono', monospace; font-size: .8rem; border: 1px solid transparent; }
.tl-act .g { font-weight: 500; font-size: .85rem; }
.tl-act .num { font-size: .7rem; color: #9ca3af; }
.chip { font-family: 'IBM Plex Mono', monospace; font-size: .7rem; line-height: 1.5; border-radius: 4px; padding: 0 6px; white-space: nowrap; border: 1px solid #e5e7eb; color: #6b7280; }
.chip.ver { color: #00739f; background: #e3f4fc; border-color: #a9dcf3; font-weight: 500; }
.chip.score { --k: var(--win); color: var(--k); font-weight: 500; padding: 0 8px;
              background: color-mix(in srgb, var(--k) 13%, transparent); border-color: color-mix(in srgb, var(--k) 38%, transparent); }
.chip.score.loss { --k: var(--loss); }
.tl-act:hover { background: #f7f8fa; }
.tl-act.on { background: #f1f2f4; border-color: #d5dce6; }
.tl-act canvas { flex: none; image-rendering: pixelated; border-radius: 2px; }
.tl-act .a { color: var(--win); } .tl-act .r { color: var(--loss); }
.tl-tag.edit { color: #00739f; background: #e3f4fc; border-color: #a9dcf3; }

.tl-tool { margin: 0 0 .55rem; padding: 0 .4rem; }
.tl-tool > div { min-width: 0; display: flex; align-items: center; gap: .55rem; cursor: pointer; }
.tl-tag { flex: none; font-family: 'IBM Plex Mono', monospace; font-size: .72rem; font-weight: 600; letter-spacing: .04em; color: #d0215f; background: #fde7ef;
          border: 1px solid #f6b9cc; border-radius: 6px; padding: .1rem .45rem; }
.tl-tag.gray { color: #6b7280; background: #f3f4f6; border-color: #e5e7eb; }
.tl-tool code { min-width: 0; font-family: 'IBM Plex Mono', monospace; font-size: .78rem; color: #444; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-tool canvas { flex: none; image-rendering: pixelated; border-radius: 2px; }
.tl-tool pre { display: none; margin: .4rem 0 0; padding: .5rem .7rem; background: #fafafa; border: 1px solid #eee; border-radius: 8px;
               font-family: 'IBM Plex Mono', monospace; font-size: .72rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
               max-height: 260px; overflow-y: auto; }
.tl-tool pre .o { color: var(--mute); }
.tl-tool.open pre { display: block; }

.tl-rp { display: flex; flex-direction: column; align-items: center; }
.tl-who { display: flex; align-items: center; gap: .45rem; font-size: 1.05rem; color: #444; margin-bottom: .5rem; }
.tl-board { border: 5px solid; border-radius: 10px; padding: 4px; background: #fff; }
.tl-board canvas { display: block; image-rendering: pixelated; }
.tl-score { font-family: 'IBM Plex Mono', monospace; font-size: .85rem; margin-top: .35rem; }
.tl-ctrl { display: flex; align-items: center; gap: .6rem; width: 100%; max-width: 360px; margin-top: .6rem; font-size: .8rem; color: #444; }
.tl-ctrl input { flex: 1; accent-color: #6b7280; }
.tl-ctrl button { width: 1.9rem; height: 1.9rem; border-radius: 999px; background: var(--band); flex: none; }
.tl-ctrl .n { white-space: nowrap; min-width: 7.5rem; text-align: right; font-family: 'IBM Plex Mono', monospace; }
.tl-who .chip { font-size: .9rem; padding: 1px 8px; }
.tl-say { width: 100%; max-width: 360px; margin-top: .7rem; font-size: .85rem; line-height: 1.45; color: #444; min-height: 3em; }
.tl-say b { font-weight: 700; }

.tl-file { font-family: 'IBM Plex Mono', monospace; font-size: .82rem; margin-bottom: .3rem; }
.tl-file .a { color: var(--win); } .tl-file .r { color: var(--loss); }
.tl-diff { font-family: 'IBM Plex Mono', monospace; font-size: .74rem; line-height: 1.45; max-height: 520px; overflow-y: auto;
           border: 1px solid #eee; border-radius: 8px; margin-bottom: .8rem; }
.tl-diff div { white-space: pre-wrap; word-break: break-word; padding: 0 .6rem; }
.tl-diff .p { background: #e6f6f0; color: #0b5d44; }
.tl-diff .m { background: #f9e9e6; color: #8a2e20; }
.tl-diff .c { color: #777; }
.tl-diff .h { color: #aaa; text-align: center; background: #fafafa; }
