/* =========================================================
   YH Event Entry  /  event-entry.css
   全セレクタを .yh-ee 配下に閉じてテーマCSSとの衝突を避ける
   ========================================================= */

.yh-ee {
	/* カラートークン（ライト） */
	--yh-bg:          #ffffff;
	--yh-card-bg:     #ffffff;
	--yh-card-bg-hov: #fafbff;
	--yh-border:      #e3e6ee;
	--yh-border-hov:  #cdd3e6;
	--yh-text:        #1f2330;
	--yh-muted:       #6b7180;
	--yh-accent:      #4f63d2;
	--yh-accent-weak: #eef1fc;
	--yh-accent-ink:  #ffffff;
	--yh-danger:      #b3261e;
	--yh-radius:      10px;
	--yh-shadow:      0 1px 2px rgba(20, 24, 40, .06), 0 2px 8px rgba(20, 24, 40, .05);
	--yh-shadow-sel:  0 0 0 2px var(--yh-accent), 0 6px 18px rgba(79, 99, 210, .22);

	max-width: 920px;
	margin: 0 auto;
	color: var(--yh-text);
	font-size: 15px;
	line-height: 1.45;
	-webkit-text-size-adjust: 100%;
}

.yh-ee *,
.yh-ee *::before,
.yh-ee *::after {
	box-sizing: border-box;
}

/* テーマが本文の見出し・段落に付けがちな背景色を、プラグイン内全体で打ち消す。
   余白・行間は各クラスを「.yh-ee + クラス」+ !important で個別に制御している。 */
.yh-ee h2,
.yh-ee h3,
.yh-ee p {
	background: none !important;
	border: 0;
}

/* ---- ヘッダー ---- */
.yh-ee-head {
	margin-bottom: 8px;
}
.yh-ee .yh-ee-title {
	margin: 0 0 2px !important;
	padding: 0 !important;
	font-size: 1.3rem;
	font-weight: 700;
	letter-spacing: .01em;
	line-height: 1.25 !important;
}
.yh-ee .yh-ee-lead {
	margin: 0 0 4px !important;
	padding: 0 !important;
	color: var(--yh-text);
}
.yh-ee .yh-ee-deadline {
	display: inline-flex;
	align-items: center;
	gap: .5em;
	margin: 2px 0 0 !important;
	padding: .25em .75em !important;
	border-radius: 999px;
	background: var(--yh-accent-weak) !important;
	font-size: .85rem;
}
.yh-ee-deadline-label {
	font-weight: 700;
	color: var(--yh-accent);
	letter-spacing: .04em;
}
.yh-ee-deadline-value {
	font-weight: 600;
}

/* ---- グリッド（横長カードを縦に積む） ---- */
.yh-ee-grid {
	display: grid;
	grid-template-columns: 1fr; /* 1カード＝全幅の横長 */
	gap: 8px;
	margin: 0 0 12px;
}

/* ---- カード（横長・コンパクト） ---- */
.yh-ee-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: auto; /* 内容なりの高さ */
	min-width: 0;
	padding: 9px 14px 9px 12px;
	border: 1px solid var(--yh-border);
	border-left: 4px solid var(--yh-border);
	border-radius: var(--yh-radius);
	background: var(--yh-card-bg);
	box-shadow: var(--yh-shadow);
	cursor: pointer;
	user-select: none;
	transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.yh-ee-card:hover {
	background: var(--yh-card-bg-hov);
	transform: translateY(-2px);
	border-color: var(--yh-border-hov);
}
.yh-ee-card:focus-visible {
	outline: 3px solid var(--yh-accent);
	outline-offset: 2px;
}
.yh-ee-card[aria-pressed="true"] {
	border-color: var(--yh-accent);
	background: var(--yh-accent-weak);
	box-shadow: var(--yh-shadow-sel);
}

/* チェックバッジ（選択時のみ表示） */
.yh-ee-check {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--yh-accent);
	color: var(--yh-accent-ink);
	opacity: 0;
	transform: scale(.6);
	transition: opacity .15s ease, transform .15s ease;
	pointer-events: none;
}
.yh-ee-card[aria-pressed="true"] .yh-ee-check {
	opacity: 1;
	transform: scale(1);
}

.yh-ee-card .yh-ee-card-head {
	display: flex;
	align-items: baseline;
	gap: .5em;
	margin: 0 0 .2em !important;
	padding: 0 32px 0 0 !important; /* 右上のチェックバッジ分を空ける */
}
.yh-ee-card-num {
	flex: 0 0 auto;
	font-size: .76rem;
	font-weight: 700;
	letter-spacing: .1em;
	color: var(--yh-accent);
}
.yh-ee-card .yh-ee-card-name {
	margin: 0 !important;
	padding: 0 !important;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.25 !important;
	overflow-wrap: anywhere;
	word-break: break-word;
}

/* メタ情報は dl/ul/li を使わず div/span で構成し、テーマ本文の装飾を回避する */
.yh-ee-card .yh-ee-card-meta {
	margin: 0 !important;
	font-size: .85rem;
	text-align: left !important;
}
.yh-ee-card .yh-ee-row {
	display: flex;
	gap: .5em;
	margin: 0 0 .15em !important;
	padding: 0 !important;
	align-items: baseline;
	text-align: left !important;
}
.yh-ee-card .yh-ee-row:last-child {
	margin-bottom: 0 !important;
}
.yh-ee-card .yh-ee-k {
	flex: 0 0 auto;
	min-width: 3.4em;
	font-weight: 700;
	color: var(--yh-muted);
}
.yh-ee-card .yh-ee-v {
	flex: 1 1 auto;
	min-width: 0;            /* flex内で縮めて折り返せるように */
	overflow-wrap: anywhere; /* 長い文字列を強制的に折り返す */
	word-break: break-word;
	text-align: left !important;
}
/* お題の値だけは flex 横並び。テーマの span 装飾や寄せに左右されず、必ず左から並ぶ */
.yh-ee-card .yh-ee-row-odai .yh-ee-v {
	display: flex !important;
	flex-wrap: wrap;
	justify-content: flex-start !important;
	align-items: baseline;
	gap: .15em .9em;
}
.yh-ee-card .yh-ee-odai-item {
	display: inline-block !important;
	float: none !important;
	position: relative;
	margin: 0 !important;
	padding: 0 0 0 1.05em !important;
	overflow-wrap: anywhere;
	word-break: break-word;
}
.yh-ee-card .yh-ee-odai-item::before {
	content: "・";
	position: absolute;
	left: 0;
	color: var(--yh-muted);
}

.yh-ee-card .yh-ee-card-note {
	margin: .35em 0 0 !important;
	padding: .35em 0 0 !important;
	border-top: 1px dashed var(--yh-border);
	font-size: .8rem;
	color: var(--yh-muted);
	overflow-wrap: anywhere;
	word-break: break-word;
}

/* ---- 選択バー ---- */
.yh-ee-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 14px;
	border: 1px solid var(--yh-border);
	border-radius: var(--yh-radius);
	background: var(--yh-bg);
}
.yh-ee .yh-ee-status {
	margin: 0 !important;
	padding: 0 !important;
	font-weight: 600;
}
.yh-ee-status.is-selected {
	color: var(--yh-accent);
}
.yh-ee-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.yh-ee-clear,
.yh-ee-submit {
	font: inherit;
	font-weight: 700;
	padding: .45em 1.2em;
	border-radius: 999px;
	cursor: pointer;
	transition: background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease, transform .1s ease;
}
.yh-ee-clear {
	border: 1px solid var(--yh-border);
	background: transparent;
	color: var(--yh-text);
}
.yh-ee-clear:hover:not(:disabled) {
	border-color: var(--yh-danger);
	color: var(--yh-danger);
}
.yh-ee-submit {
	border: 1px solid var(--yh-accent);
	background: var(--yh-accent);
	color: var(--yh-accent-ink);
}
.yh-ee-submit:hover:not(:disabled) {
	transform: translateY(-1px);
	filter: brightness(1.05);
}
.yh-ee-clear:focus-visible,
.yh-ee-submit:focus-visible {
	outline: 3px solid var(--yh-accent);
	outline-offset: 2px;
}
.yh-ee-clear:disabled,
.yh-ee-submit:disabled {
	opacity: .45;
	cursor: not-allowed;
}

/* バー内の投票メッセージ（エラー等） */
.yh-ee .yh-ee-vote-msg {
	flex-basis: 100%;
	margin: 0 !important;
	padding: 0 !important;
	font-weight: 600;
	font-size: .86rem;
	min-height: 0;
}
.yh-ee .yh-ee-vote-msg:empty {
	display: none;
}
.yh-ee-vote-msg.is-error {
	color: var(--yh-danger);
}
.yh-ee-vote-msg.is-ok {
	color: var(--yh-accent);
}

/* ---- 回答結果（投票結果風） ---- */
.yh-ee-results {
	margin-top: 12px;
	padding: 12px 14px;
	border: 1px solid var(--yh-border);
	border-radius: var(--yh-radius);
	background: var(--yh-bg);
}
.yh-ee .yh-ee-results-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: .6em;
	margin: 0 0 10px !important;
	padding: 0 !important;
	flex-wrap: wrap;
}
.yh-ee-results-title {
	font-weight: 700;
	font-size: .95rem;
}
.yh-ee-results-total {
	font-size: .82rem;
	color: var(--yh-muted);
}
.yh-ee-ritem {
	margin: 0 0 8px;
}
.yh-ee-ritem:last-child {
	margin-bottom: 0;
}
.yh-ee-ritem-top {
	display: flex;
	justify-content: space-between;
	gap: .6em;
	margin-bottom: 3px;
	font-size: .85rem;
}
.yh-ee-ritem-name {
	font-weight: 600;
	overflow-wrap: anywhere;
	word-break: break-word;
}
.yh-ee-ritem-val {
	flex: 0 0 auto;
	color: var(--yh-muted);
	white-space: nowrap;
}
.yh-ee-rbar {
	height: 12px;
	border-radius: 6px;
	background: var(--yh-accent-weak);
	overflow: hidden;
}
.yh-ee-rbar-fill {
	height: 100%;
	border-radius: 6px;
	background: var(--yh-border-hov);
	transition: width .5s ease;
}
.yh-ee-ritem.is-mine .yh-ee-ritem-name {
	color: var(--yh-accent);
}
.yh-ee-ritem.is-mine .yh-ee-rbar-fill {
	background: var(--yh-accent);
}
.yh-ee .yh-ee-results-note {
	margin: 10px 0 0 !important;
	padding: 0 !important;
	font-weight: 600;
	font-size: .85rem;
	color: var(--yh-accent);
}
.yh-ee .yh-ee-results-note:empty {
	display: none;
}
.yh-ee-redo {
	font: inherit;
	font-weight: 700;
	margin-top: 12px;
	padding: .4em 1.1em;
	border: 1px solid var(--yh-border);
	border-radius: 999px;
	background: transparent;
	color: var(--yh-text);
	cursor: pointer;
	transition: border-color .15s ease, color .15s ease;
}
.yh-ee-redo:hover {
	border-color: var(--yh-accent);
	color: var(--yh-accent);
}
.yh-ee-redo:focus-visible {
	outline: 3px solid var(--yh-accent);
	outline-offset: 2px;
}


/* ---- 準備中 / 注意事項 ---- */
.yh-ee .yh-ee-empty {
	margin: 6px 0 0 !important;
	padding: 20px 14px !important;
	border: 1px dashed var(--yh-border);
	border-radius: var(--yh-radius);
	text-align: center;
	color: var(--yh-muted);
}
.yh-ee-notes {
	margin-top: 12px;
	padding: 10px 13px;
	border-left: 4px solid var(--yh-accent);
	border-radius: 6px;
	background: var(--yh-accent-weak);
	font-size: .85rem;
}
.yh-ee .yh-ee-notes-title {
	margin: 0 0 .2em !important;
	padding: 0 !important;
	font-weight: 700;
	color: var(--yh-accent);
}
.yh-ee .yh-ee-notes-body {
	margin: 0 !important;
	padding: 0 !important;
}

/* ---- スマホ ---- */
@media (max-width: 480px) {
	.yh-ee-grid {
		gap: 10px;
	}
	.yh-ee-card {
		padding: 12px 14px 12px 12px;
	}
	.yh-ee-card .yh-ee-card-name {
		font-size: 1.02rem;
	}
	.yh-ee-card .yh-ee-row {
		flex-direction: column;
		gap: .1em;
	}
	.yh-ee-bar {
		flex-direction: column;
		align-items: stretch;
	}
	.yh-ee-actions {
		justify-content: stretch;
	}
	.yh-ee-clear,
	.yh-ee-submit {
		flex: 1 1 auto;
		text-align: center;
	}
}

/* ---- 動きを抑える設定への配慮 ---- */
@media (prefers-reduced-motion: reduce) {
	.yh-ee-card,
	.yh-ee-check,
	.yh-ee-submit,
	.yh-ee-clear {
		transition: none;
	}
}

/* ---- ダークモード ---- */
@media (prefers-color-scheme: dark) {
	.yh-ee {
		--yh-bg:          #161922;
		--yh-card-bg:     #1c2030;
		--yh-card-bg-hov: #222740;
		--yh-border:      #2e3347;
		--yh-border-hov:  #3c4258;
		--yh-text:        #e7eaf3;
		--yh-muted:       #9aa1b4;
		--yh-accent:      #8b9cf5;
		--yh-accent-weak: #232842;
		--yh-accent-ink:  #11141d;
		--yh-danger:      #f08a84;
		--yh-shadow:      0 1px 2px rgba(0, 0, 0, .3), 0 2px 10px rgba(0, 0, 0, .35);
		--yh-shadow-sel:  0 0 0 2px var(--yh-accent), 0 6px 20px rgba(139, 156, 245, .25);
	}
}
