.lotto-lab {
	--card-bg: var(--paper);
	--text: var(--ink);
	--muted: #52665b;
	--border: var(--line);
	--primary: var(--green);
	--primary-dark: #183f33;
	--surface: #eef3e9;
	--radius: 16px;
	margin: 0 auto;
	padding: clamp(22px, 4vw, 46px) 0 52px;
	color: var(--text);
}

.lotto-lab a { color: var(--primary); text-decoration: none; }
.lotto-lab a:hover { text-decoration: underline; }

.lotto-lab h1 { font-size: clamp(29px, 5vw, 48px); line-height: 1.2; letter-spacing: -.045em; margin: 24px 0 10px; }
.lotto-lab .sub { color: var(--muted); max-width: 54ch; margin: 0 0 26px; }
.lotto-lab .lotto-controls { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
.lotto-lab .lotto-controls label { display: block; font-weight: 700; margin: 12px 0 6px; }
.lotto-lab .lotto-controls label small { font-weight: 400; color: var(--muted); }
.lotto-lab .lotto-feedback { color: #8b3430; margin: 8px 0 0; }
.lotto-lab .lotto-feedback:empty, .lotto-lab .search-result:empty { display: none; }

.lotto-lab .card {
	background: var(--card-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: clamp(14px, 3vw, 26px);
	margin-bottom: 20px;
	text-align: left;
}
.lotto-lab .card h2 { font-size: 18px; margin: 0 0 6px; }
.lotto-lab .card h3 { font-size: 14px; margin: 0 0 10px; color: var(--muted); }

.lotto-lab .section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lotto-lab .section-head h2 { margin: 0; }
.lotto-lab .hint { color: var(--muted); font-size: 13px; margin: 4px 0 14px; }

.lotto-lab .generator-card { background: var(--surface); }
.lotto-lab #generated-balls { min-height: 76px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.lotto-lab .balls-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.lotto-lab .balls-row.small { gap: 5px; }
.lotto-lab .placeholder { color: var(--muted); font-size: 14px; padding: 10px 0; }

.lotto-lab .ball {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px; height: 40px;
	border-radius: 50%;
	color: #203a35;
	font-weight: 700;
	font-size: 15px;
	border: 1px solid #203a351f;
}
.lotto-lab .balls-row.small .ball { width: 28px; height: 28px; font-size: 12px; }
.lotto-lab .ball-y { background: #eee2ae; }
.lotto-lab .ball-b { background: #d3e6e1; }
.lotto-lab .ball-r { background: #edd8cb; }
.lotto-lab .ball-g { background: #e2e7dc; }
.lotto-lab .ball-p { background: var(--accent); }
.lotto-lab .ball-bonus { outline: 1px dashed var(--green); outline-offset: 2px; }
.lotto-lab .ball-plus { font-weight: 700; color: var(--muted); }

.lotto-lab .generator-form { display: flex; gap: 8px; flex-wrap: wrap; }
.lotto-lab .generator-form input, .lotto-lab .search-form input {
	flex: 1; min-width: 0;
	padding: 10px 14px;
	border: 1px solid var(--border);
	border-radius: 8px;
	font-size: 14px;
	min-height: 44px;
}
.lotto-lab .search-form { display: flex; gap: 8px; }

.lotto-lab .btn {
	display: inline-block;
	padding: 10px 18px;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: #fff;
	color: var(--text);
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	min-height: 44px;
	white-space: nowrap;
}
.lotto-lab .btn:hover { background: var(--surface); text-decoration: none; }
.lotto-lab .btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.lotto-lab .btn-primary:hover { background: var(--primary-dark); }
.lotto-lab .btn-small { padding: 6px 12px; font-size: 12px; }
.lotto-lab .btn[disabled] { opacity: 0.6; cursor: default; }

.lotto-lab .search-result { margin-top: 14px; }
.lotto-lab .search-result .sr-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; flex-wrap: wrap; }
.lotto-lab .search-result .sr-rank { font-weight: 700; color: var(--primary); }
.lotto-lab .search-result .sr-empty, .lotto-lab .empty { color: var(--muted); text-align: center; padding: 16px 0; }

.lotto-lab .log-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.lotto-lab .log-list li { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 13px; flex-wrap: wrap; }
.lotto-lab .log-list .nickname { min-width: 64px; font-weight: 600; color: var(--muted); }
.lotto-lab .log-list .time { margin-left: auto; color: var(--muted); font-size: 12px; }

.lotto-lab .draw-result { text-align: center; }
.lotto-lab .draw-meta { margin-bottom: 12px; font-size: 15px; }
.lotto-lab .draw-meta .date { color: var(--muted); font-size: 13px; }
.lotto-lab .prize-box, .lotto-lab .totals-row, .lotto-lab .stat-row { display: flex; justify-content: center; gap: 32px; margin-top: 18px; flex-wrap: wrap; }
.lotto-lab .prize-box div, .lotto-lab .totals-row div, .lotto-lab .stat-row div { text-align: center; }
.lotto-lab .prize-box .num, .lotto-lab .totals-row .num, .lotto-lab .stat-row .num { display: block; font-size: 20px; font-weight: 700; color: var(--primary); }
.lotto-lab .prize-box .label, .lotto-lab .totals-row .label, .lotto-lab .stat-row .label { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

.lotto-lab .countdown-box { text-align: center; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); font-size: 13px; color: var(--muted); }
.lotto-lab .dday { font-size: 22px; font-weight: 800; color: var(--primary); margin: 6px 0; }
.lotto-lab .collect-period { font-size: 12px; }

.lotto-lab .hof-round { padding: 14px 0; border-bottom: 1px solid var(--border); }
.lotto-lab .hof-round:last-of-type { border-bottom: none; }
.lotto-lab .hof-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.lotto-lab .hof-head .date { color: var(--muted); font-size: 12px; }
.lotto-lab .hof-ranks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; text-align: center; }
.lotto-lab .hof-rank-cell { background: var(--surface); border-radius: 8px; padding: 8px 4px; }
.lotto-lab .hof-rank-cell .rank-label { display: block; font-size: 12px; color: var(--muted); }
.lotto-lab .hof-rank-cell .rank-count { display: block; font-weight: 700; }
.lotto-lab .hof-rank-cell .rank-pct { display: block; font-size: 11px; color: var(--muted); }
.lotto-lab .hof-detail { margin-top: 10px; padding: 10px; background: var(--surface); border-radius: 8px; }
.lotto-lab .hof-detail-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; flex-wrap: wrap; font-size: 12px; }
.lotto-lab .rank-badge { background: var(--primary); color: #fff; border-radius: 6px; padding: 2px 6px; font-size: 11px; }

.lotto-lab .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 16px; }
.lotto-lab .freq-list { display: flex; flex-direction: column; gap: 8px; }
.lotto-lab .freq-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.lotto-lab .freq-item span { color: var(--muted); }

.lotto-lab .zodiac-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.lotto-lab .zodiac-item { background: var(--surface); border-radius: 10px; padding: 12px; }
.lotto-lab .zodiac-name { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.lotto-lab .zodiac-name small { color: var(--muted); font-weight: 400; margin-left: 4px; }

.lotto-lab .table-wrap { overflow-x: auto; }
.lotto-lab .draw-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.lotto-lab .draw-table th, .lotto-lab .draw-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.lotto-lab .draw-table th { color: var(--muted); font-weight: 600; }
.lotto-lab .td-balls { white-space: nowrap; }

.lotto-lab .pagination { display: flex; justify-content: center; gap: 4px; margin: 18px 0 0; padding: 0; flex-wrap: wrap; }
.lotto-lab .pagination, .lotto-lab .pagination > li { list-style: none; }
.lotto-lab .pagination a, .lotto-lab .pagination span.cur { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.lotto-lab .pagination span.cur { background: var(--primary); color: #fff; border-color: var(--primary); }

.lotto-lab .center-link { text-align: center; margin-top: 8px; }

@media (max-width: 760px) {
	.lotto-lab .lotto-controls { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 640px) {
	.lotto-lab #generated-balls { gap: 5px; }
	.lotto-lab #generated-balls .ball { width: clamp(27px, 8vw, 36px); height: clamp(27px, 8vw, 36px); }
	.lotto-lab .grid-2 { grid-template-columns: 1fr; }
	.lotto-lab .zodiac-grid { grid-template-columns: repeat(2, 1fr); }
	.lotto-lab .hof-ranks { grid-template-columns: repeat(5, 1fr); font-size: 11px; }
	.lotto-lab .prize-box, .lotto-lab .totals-row, .lotto-lab .stat-row { gap: 18px; }
}
