html,body{height:100%;}
body{margin:0;font-family:Arial,"Microsoft JhengHei","PingFang TC","Noto Sans TC",Helvetica,sans-serif;background:linear-gradient(135deg,#eef7f8 0%,#dff0f2 100%);background-attachment:fixed;color:#173b41;min-height:100vh;}
#tt-game{--teal:#00BFC6;--deep:#00616B;--accent:#FF7959;--ink:#173b41;--card:#ffffff;--line:#d6e7e9;position:relative;min-height:100vh;display:flex;flex-direction:column;align-items:center;padding:56px 16px 60px;}
#tt-game *{box-sizing:border-box;}
#tt-game .lang-toggle{position:absolute;top:16px;right:16px;z-index:6;display:flex;background:#fff;border-radius:24px;box-shadow:0 4px 14px rgba(0,97,107,.18);overflow:hidden;font-size:13px;font-weight:bold;}
#tt-game .lang-toggle button{border:none;background:transparent;cursor:pointer;padding:8px 16px;color:#6b8a8e;transition:all .15s;}
#tt-game .lang-toggle button.active{background:var(--teal);color:#fff;}
#tt-game .sound-toggle{position:absolute;top:16px;right:150px;z-index:6;background:#fff;border:none;cursor:pointer;border-radius:24px;box-shadow:0 4px 14px rgba(0,97,107,.18);padding:8px 14px;font-size:15px;}
#tt-game header{text-align:center;margin-bottom:18px;}
#tt-game .title-row{display:flex;align-items:center;justify-content:center;gap:16px;}
#tt-game .logo{height:100px;width:auto;object-fit:contain;flex:none;}
#tt-game header h1{margin:0;font-size:30px;color:var(--deep);letter-spacing:.5px;line-height:1.25;}
#tt-game header .subtitle{display:block;font-size:18px;color:var(--teal);font-weight:bold;margin-top:2px;}
#tt-game header p{margin:10px auto 0;color:#4a6a6e;font-size:14px;max-width:760px;line-height:1.55;}
#tt-game .rulebox{background:#fff;border-left:5px solid var(--accent);border-radius:12px;padding:14px 18px;max-width:760px;width:100%;margin:0 auto 24px;box-shadow:0 6px 18px rgba(0,97,107,.10);font-size:13px;color:#3d5b5f;}
#tt-game .rulebox b{color:var(--deep);}
#tt-game .rulebox ul{margin:8px 0 0;padding-left:20px;}
#tt-game .rulebox li{margin-bottom:6px;line-height:1.5;}
#tt-game .wrap{width:100%;max-width:900px;display:flex;flex-direction:row;align-items:flex-start;justify-content:center;gap:28px;}
@media (max-width:760px){#tt-game .wrap{flex-direction:column;align-items:center;}}
#tt-game .board{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;background:var(--card);padding:16px;border-radius:18px;box-shadow:0 10px 30px rgba(0,97,107,.12);width:min(90vw,460px);aspect-ratio:1/1;flex:none;}
#tt-game .cell{position:relative;border-radius:14px;border:2px solid var(--line);background:#f7fbfc;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:8px;transition:transform .12s ease,box-shadow .12s ease,background .3s,opacity .3s;user-select:none;}
#tt-game .cell:hover:not(.done):not(.locked){transform:translateY(-3px);box-shadow:0 8px 18px rgba(0,191,198,.25);border-color:var(--teal);}
#tt-game .cell.selectable{border-color:var(--teal);animation:tt-breathe 1.7s ease-in-out infinite;}
@keyframes tt-breathe{0%,100%{box-shadow:0 0 0 2px rgba(0,191,198,.18);}50%{box-shadow:0 0 0 6px rgba(0,191,198,.32);}}
#tt-game .cell .num{font-size:34px;font-weight:bold;color:var(--deep);}
#tt-game .cell .cat{font-size:11px;margin-top:4px;color:#6b8a8e;line-height:1.25;}
#tt-game .cell.done.correct{background:linear-gradient(135deg,var(--teal),var(--deep));border-color:var(--deep);color:#fff;cursor:default;animation:tt-popIn .35s ease;}
@keyframes tt-popIn{0%{transform:scale(.85);}60%{transform:scale(1.06);}100%{transform:scale(1);}}
#tt-game .cell.done.correct .num,#tt-game .cell.done.correct .cat{color:#fff;}
#tt-game .cell.done.correct::after{content:"✓";position:absolute;top:8px;right:12px;font-size:20px;font-weight:bold;}
#tt-game .cell.locked{cursor:not-allowed;background:#eef1f2;border-color:#e2e8e9;opacity:.55;}
#tt-game .cell.locked .num{color:#a9bcbe;}
#tt-game .cell.locked .cat{color:#b9c9cb;}
#tt-game .cell.locked::after{content:"🔒";position:absolute;top:8px;right:10px;font-size:16px;}
#tt-game .cell.winline{box-shadow:0 0 0 4px var(--accent),0 8px 20px rgba(255,121,89,.4);animation:tt-pulse 1s infinite alternate;}
@keyframes tt-pulse{from{transform:scale(1);}to{transform:scale(1.04);}}
#tt-game .ttpanel{width:300px;flex:none;background:var(--card);border-radius:18px;padding:20px;box-shadow:0 10px 30px rgba(0,97,107,.12);}
@media (max-width:760px){#tt-game .ttpanel{width:min(90vw,460px);}}
#tt-game .ttpanel h2{margin:0 0 12px;font-size:18px;color:var(--deep);text-align:center;}
#tt-game .progress-track{display:flex;align-items:center;justify-content:center;gap:6px;margin:0 0 14px;}
#tt-game .progress-track .pdot{width:20px;height:20px;border-radius:50%;background:#e2eef0;border:2px solid #cfe2e4;display:flex;align-items:center;justify-content:center;font-size:11px;color:#9db6b9;transition:all .3s;}
#tt-game .progress-track .pdot.filled{background:linear-gradient(135deg,var(--teal),var(--deep));border-color:var(--deep);color:#fff;transform:scale(1.1);}
#tt-game .progress-track .pline{width:22px;height:3px;background:#cfe2e4;transition:all .3s;}
#tt-game .progress-track .pline.filled{background:var(--teal);}
#tt-game .legend{list-style:none;padding:0;margin:0 0 16px;font-size:13px;display:flex;flex-direction:column;gap:10px;}
#tt-game .legend li{display:flex;align-items:center;gap:8px;}
#tt-game .dot{width:14px;height:14px;border-radius:4px;flex:none;}
#tt-game .stats-row{display:flex;flex-direction:column;gap:10px;}
#tt-game .stat{background:#f2fafb;border-radius:10px;padding:10px 14px;font-size:14px;text-align:center;}
#tt-game .stat span{display:block;color:#6b8a8e;font-size:12px;margin-bottom:2px;}
#tt-game .stat b{color:var(--deep);font-size:16px;}
#tt-game .ttbtn{display:inline-block;width:100%;border:none;cursor:pointer;background:var(--accent);color:#fff;font-size:15px;font-weight:bold;padding:12px;border-radius:10px;margin-top:14px;transition:opacity .2s;}
#tt-game .ttbtn:hover{opacity:.9;}
#tt-game .ttbtn.secondary{background:var(--deep);}
#tt-game footer{text-align:center;margin-top:26px;font-size:12px;color:#7a9599;}
.tt-overlay{position:fixed;inset:0;background:rgba(10,40,44,.55);display:none;align-items:center;justify-content:center;padding:20px;z-index:2147483000;font-family:Arial,"Microsoft JhengHei","Noto Sans TC",Helvetica,sans-serif;}
.tt-overlay.show{display:flex;}
.tt-overlay .ttmodal{position:relative;background:#fff;border-radius:18px;max-width:520px;width:100%;padding:26px;box-shadow:0 20px 60px rgba(0,0,0,.3);animation:tt-pop .2s ease;color:#173b41;}
@keyframes tt-pop{from{transform:scale(.9);opacity:0;}to{transform:scale(1);opacity:1;}}
.tt-overlay .ttmodal-close{position:absolute;top:12px;right:14px;width:34px;height:34px;border:none;cursor:pointer;background:#f2fafb;color:#6b8a8e;border-radius:50%;font-size:18px;line-height:1;font-weight:bold;display:flex;align-items:center;justify-content:center;transition:all .15s;}
.tt-overlay .ttmodal-close:hover{background:#FF7959;color:#fff;transform:rotate(90deg);}
.tt-overlay .timer-wrap{display:flex;align-items:center;gap:10px;margin-bottom:14px;}
.tt-overlay .timer-bar{flex:1;height:8px;background:#eef1f2;border-radius:6px;overflow:hidden;}
.tt-overlay .timer-fill{height:100%;width:100%;background:#00BFC6;border-radius:6px;transition:width 1s linear,background .3s;}
.tt-overlay .timer-fill.low{background:#FF7959;}
.tt-overlay .timer-secs{font-size:13px;font-weight:bold;color:#00616B;min-width:42px;text-align:right;}
.tt-overlay .ttbadge{display:inline-block;font-size:12px;font-weight:bold;color:#fff;background:#00BFC6;padding:4px 12px;border-radius:20px;margin-bottom:14px;}
.tt-overlay .ttmodal h3{margin:0 0 18px;font-size:20px;color:#173b41;line-height:1.4;padding-right:30px;}
.tt-overlay .choices{display:flex;flex-direction:column;gap:10px;}
.tt-overlay .choice{text-align:left;border:2px solid #d6e7e9;background:#f7fbfc;padding:13px 16px;border-radius:10px;cursor:pointer;font-size:15px;transition:all .15s;color:#173b41;width:100%;}
.tt-overlay .choice:hover{border-color:#00BFC6;background:#eafafb;}
.tt-overlay .choice.correct{background:#d6f5f0;border-color:#00BFC6;color:#00616B;font-weight:bold;}
.tt-overlay .choice.wrong{background:#ffe1d8;border-color:#FF7959;color:#a83a1f;}
.tt-overlay .choice:disabled{cursor:default;}
.tt-overlay .feedback{margin-top:16px;font-size:15px;font-weight:bold;min-height:22px;}
.tt-overlay .feedback.ok{color:#00616B;}
.tt-overlay .feedback.no{color:#FF7959;}
.tt-overlay .ttbtn{display:inline-block;width:100%;border:none;cursor:pointer;background:#FF7959;color:#fff;font-size:15px;font-weight:bold;padding:12px;border-radius:10px;margin-top:18px;}
.tt-overlay .ttbtn:hover{opacity:.9;}
.tt-overlay .ttbtn.secondary{background:#00616B;}
.tt-overlay .win-ttmodal{text-align:center;}
.tt-overlay .win-ttmodal .gift{font-size:64px;margin-bottom:8px;}
.tt-overlay .win-ttmodal h3{font-size:26px;color:#00616B;padding-right:0;}
.tt-overlay .tt-input{width:100%;padding:12px 14px;margin:6px 0;border:2px solid #d6e7e9;border-radius:10px;font-size:15px;font-family:inherit;color:#173b41;box-sizing:border-box;}
.tt-overlay .tt-input:focus{outline:none;border-color:#00BFC6;background:#f2fafb;}
.tt-overlay .tt-formmsg{min-height:20px;font-size:13px;font-weight:bold;margin:6px 0 2px;text-align:left;}
