.tah-twl { margin: 1.2em 0; font-size: 16px; line-height: 1.6; }
.tah-twl-card { border: 1px solid #dcdcde; border-radius: 8px; padding: 14px 16px; margin: 0 0 14px; background: #fff; }
.tah-twl-title { margin: 0 0 4px; font-size: 1.15em; }
.tah-twl-meta { margin: 0 0 8px; color: #50575e; font-size: .9em; }
.tah-twl-balls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tah-twl-ball { display: inline-flex; align-items: center; justify-content: center; min-width: 2.2em; height: 2.2em; padding: 0 .2em; border-radius: 50%; background: #c0392b; color: #fff; font-weight: 700; font-size: .95em; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); box-sizing: border-box; }
.tah-twl-ball--special { background: #1f5fae; }
.tah-twl-ball--small { min-width: 1.8em; height: 1.8em; font-size: .85em; }
.tah-twl-plus { font-weight: 700; color: #50575e; }
.tah-twl-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .92em; }
.tah-twl-table th, .tah-twl-table td { border: 1px solid #dcdcde; padding: 6px 8px; text-align: left; vertical-align: middle; }
.tah-twl-table thead th { background: #f6f7f7; }
.tah-twl-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.tah-twl-form input[type="text"], .tah-twl-form input[type="date"] { max-width: 11em; }
.tah-twl-pager { margin: 8px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tah-twl-statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tah-twl-statgrid h4 { margin: 4px 0; }
.tah-twl-statlist { list-style: none; margin: 0; padding: 0; }
.tah-twl-statlist li { margin: 4px 0; }
.tah-twl-statmeta, .tah-twl-meta { color: #50575e; }
.tah-twl-empty { color: #50575e; }
.tah-twl-notice { margin-top: 12px; padding: 8px 12px; border-left: 4px solid #dba617; background: #fcf9e8; font-size: .85em; }
.tah-twl-notice p { margin: 2px 0; }
.tah-twl-error { color: #8a2424; }
@media (max-width: 480px) { .tah-twl-ball { min-width: 2em; height: 2em; font-size: .85em; } }

/* ---- 1.0.1 開獎文章版型 ---- */
.tah-twl-a { font-size: 16px; line-height: 1.6; color: var(--twl-text, #1c2540); }
.tah-twl-a-card { background: #fff; border-radius: 14px; padding: 18px 22px; margin: 0 0 16px; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.tah-twl-a-hero { background: var(--twl-primary, #0b1f45); color: #fff; border: 3px solid var(--twl-secondary, #e6b84a); }
.tah-twl-a-herohead { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.tah-twl-a-sub { color: #c9d6f2; font-size: .9em; margin: 6px 0 0; }
.tah-twl-a-herohead .tah-twl-a-sub { margin: 0; }
.tah-twl-a-toggle { display: none; gap: 6px; }
.tah-js .tah-twl-a-toggle { display: flex; }
.tah-twl-a-toggle button { border: 0; border-radius: 20px; padding: 3px 12px; font-size: 13px; background: var(--twl-primary-2, #123a8c); color: #fff; cursor: pointer; }
.tah-twl-a-toggle button.on { background: var(--twl-secondary, #e6b84a); color: var(--twl-primary, #0b1f45); }
.tah-twl-a-balls { background: var(--twl-primary-2, #123a8c); border-radius: 10px; padding: 14px; margin: 14px 0 8px; display: flex; justify-content: center; }
.tah-twl-a-balls[hidden] { display: none; }
.tah-twl-a-balls .tah-twl-balls { justify-content: center; gap: 10px; }
.tah-twl-a-balls .tah-twl-ball { min-width: 2.8em; height: 2.8em; background: radial-gradient(circle at 35% 30%, #ffe08a, #f2a516 60%); color: var(--twl-primary, #0b1f45); box-shadow: none; font-size: 1.05em; }
.tah-twl-a-balls .tah-twl-ball--special { background: radial-gradient(circle at 35% 30%, #ff8f86, #d0342c 65%); color: #fff; }
.tah-twl-a-balls .tah-twl-plus { color: #c9d6f2; }
.tah-twl-a-h2 { font-size: 18px; margin: 0 0 12px; border-left: 5px solid var(--twl-secondary, #e6b84a); padding-left: 10px; }
.tah-twl-a-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tah-twl-a-k { background: #f4f6fb; border-radius: 10px; padding: 10px; text-align: center; }
.tah-twl-a-k b { display: block; font-size: 20px; color: var(--twl-primary-2, #123a8c); }
.tah-twl-a-k span { font-size: 13px; color: #5a6480; }
.tah-twl-a-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tah-twl-a-table th { background: var(--twl-primary, #0b1f45); color: #fff; padding: 8px; }
.tah-twl-a-table td { padding: 8px; border-bottom: 1px solid #e5e9f2; text-align: center; }
.tah-twl-a-table tr:nth-child(even) td { background: #f8f9fc; }
.tah-twl-a-table .hot { color: #d0342c; font-weight: 700; }
.tah-twl-a-table .cold { color: var(--twl-primary-2, #123a8c); font-weight: 700; }
.tah-twl-a-fine { font-size: 12px; color: #5a6480; margin: 8px 0 0; }
.tah-twl-a-nav { display: flex; justify-content: space-between; margin-top: 12px; }
.tah-twl-a-nav a { color: var(--twl-primary-2, #123a8c); text-decoration: none; font-weight: 700; }
.tah-twl-a-mini { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.tah-twl-a-mini i { width: 26px; height: 26px; border-radius: 50%; background: #f2a516; font: bold 12px sans-serif; font-style: normal; display: inline-flex; align-items: center; justify-content: center; color: var(--twl-primary, #0b1f45); }
.tah-twl-a-mini i.sp { background: #d0342c; color: #fff; }
.tah-twl-a-links a { display: inline-block; margin: 4px 6px 4px 0; padding: 6px 12px; border: 1px solid var(--twl-primary-2, #123a8c); border-radius: 20px; color: var(--twl-primary-2, #123a8c); text-decoration: none; font-size: 14px; }
@media (max-width: 600px) { .tah-twl-a-grid { grid-template-columns: repeat(2, 1fr); } .tah-twl-a-card { padding: 14px; } }

/* ---- 選號工具 ---- */
.tah-twl-pk { background: #fff; border: 1px solid #dcdcde; border-radius: 12px; padding: 14px 18px; margin: 16px 0; }
.tah-twl-pk-title { margin: 0 0 6px; font-size: 1.1em; }
.tah-twl-pk-note { font-size: .88em; color: #50575e; margin: 6px 0; }
.tah-twl-pk-form { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.tah-twl-pk-form label { display: flex; flex-direction: column; font-size: .88em; gap: 2px; }
.tah-twl-pk-form input.s { width: 5em; }
.tah-twl-pk-pos { border: 1px solid #dcdcde; border-radius: 8px; display: flex; gap: 10px; }
.tah-twl-pk-go { padding: 6px 18px; border: 0; border-radius: 20px; background: var(--twl-primary-2, #123a8c); color: #fff; cursor: pointer; }
.tah-twl-pk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.tah-twl-pk-idx { min-width: 4.5em; font-size: .85em; color: #50575e; }
.tah-twl-pk-err { color: #8a2424; }
.tah-twl-pk-warn { color: #7a5a00; font-size: .88em; }

/* 1.0.2：首段與工具頁說明段落 */
.tah-twl-a-lead,.tah-twl-lead{margin:12px 0;line-height:1.8;color:#334155}
.tah-twl-pk-tabs{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}
.tah-twl-pk-tabs button{padding:6px 12px;border:1px solid #c9d3e6;background:#fff;border-radius:16px;cursor:pointer}
.tah-twl-pk-tabs button.on{background:var(--twl-primary, #0b1f45);color:#fff;border-color:var(--twl-primary, #0b1f45)}
.tah-twl-pk-extra{font-size:.9em;color:#475569}

/* ---- 1.0.6：表格與文字顏色不受主題影響（表頭底色＋字色成對指定、表身字色與底色也明確指定；只用 !important 鎖顏色） ---- */
html body table.tah-twl-table.tah-twl-table.tah-twl-table thead tr th,
html body table.tah-twl-a-table.tah-twl-a-table.tah-twl-a-table thead tr th,
html body .tah-twl table.tah-twl-table thead tr th,
html body .tah-twl-a table.tah-twl-a-table thead tr th {
	background: var(--twl-primary, #0b1f45) !important;
	background-color: var(--twl-primary, #0b1f45) !important;
	color: #fff !important;
	border-color: var(--twl-primary, #0b1f45) !important;
	text-shadow: none !important;
}
html body table.tah-twl-table.tah-twl-table.tah-twl-table tbody tr th {
	background-color: #e9edf7 !important;
	color: var(--twl-text, #1c2540) !important;
	text-shadow: none !important;
}
html body table.tah-twl-table.tah-twl-table.tah-twl-table tbody tr td,
html body table.tah-twl-a-table.tah-twl-a-table.tah-twl-a-table tbody tr td {
	background-color: #fff !important;
	color: var(--twl-text, #1c2540) !important;
}
html body table.tah-twl-a-table.tah-twl-a-table.tah-twl-a-table tbody tr:nth-child(even) td {
	background-color: #f8f9fc !important;
}
html body table.tah-twl-a-table.tah-twl-a-table.tah-twl-a-table tbody tr td.hot { color: #d0342c !important; }
html body table.tah-twl-a-table.tah-twl-a-table.tah-twl-a-table tbody tr td.cold { color: var(--twl-primary-2, #123a8c) !important; }
.tah-twl-card, .tah-twl-pk, .tah-twl-stats { color: var(--twl-text, #1c2540); }
.tah-twl-card .tah-twl-title, .tah-twl-pk .tah-twl-pk-title { color: var(--twl-text, #1c2540); }
.tah-twl-a-card:not(.tah-twl-a-hero) { color: var(--twl-text, #1c2540); }
.tah-twl-a-card:not(.tah-twl-a-hero) .tah-twl-a-h2 { color: var(--twl-text, #1c2540); }
.tah-twl-notice { color: #3c434a; }
.tah-twl-pk-tabs button { color: var(--twl-text, #1c2540); }
.tah-twl-pk-tabs button.on { color: #fff; }

/* 1.1.0 區塊版面編輯器：只有使用者改過版面時才會用到的樣式（預設版面的 HTML 不含這些 class） */
.tah-twl-a-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; margin: 0 0 16px; }
.tah-twl-a-row > * { flex: 1 1 320px; min-width: 0; margin-bottom: 0; }
.tah-twl-a-grid--c { grid-template-columns: repeat(var(--twl-cols, 4), 1fr); }
.tah-twl-latest--row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.tah-twl-latest--row .tah-twl-notice { grid-column: 1 / -1; }
@media (max-width: 600px) {
	.tah-twl-a-row { display: block; }
	.tah-twl-a-row > * { margin-bottom: 16px; }
	.tah-twl-a-grid--c { grid-template-columns: repeat(2, 1fr); }
	.tah-twl-m-hide { display: none; }
	.tah-twl-latest--row { display: block; }
}