/* style.css */
*, *::before, *::after
{
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root
{
	--bg: #0f0f0f;
	--bg2: #1a1a1a;
	--border: #2a2a2a;
	--border2: #383838;
	--card: #1e1e1e;
	--card-hover: #252525;
	--text: #f0f0f0;
	--text-sub: #bbbbbb;
	--text-dim: #cccccc;
	--accent: #00c896;
	--accent-gold: #C89601;
	--red: #ff4757;
	--red-dim: rgba(255,71,87,0.12);
	--sans: 'IBM Plex Sans', sans-serif;
	--display: 'Syne', sans-serif;
	--radius: 12px;
	--card-h: 92px;
	--slot-gap: 14px;
}

html, body
{
	height: 100dvh;
	overflow: hidden;
}

body
{
	background: var(--bg);
	font-family: var(--sans);
	display: flex;
	flex-direction: column;
	align-items: center;
	color: var(--text);
	padding-top: env(safe-area-inset-top);
	padding-bottom: env(safe-area-inset-bottom);
}

/* ====================== SPLASH ====================== */
.splash
{
	position: fixed;
	inset: 0;
	background: var(--bg);
	z-index: 500;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 32px 24px 48px;
}

/* ====================== ARCHIVE PREVIEW ====================== */
.archive-preview
{
	position: fixed;
	inset: 0;
	background: var(--bg);
	z-index: 500;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 32px 24px 48px;
	gap: 32px;
}

.splash-title
{
	font-family: var(--display);
	font-size: 52px;
	font-weight: 800;
	letter-spacing: -0.03em;
	margin-bottom: 8px;
	text-align: center;
	line-height: 0.8;
}

.splash-tagline
{
	font-family: var(--display);
	font-size: 17px;
	font-weight: 600;
	color: var(--accent-gold);
	margin: 6px 0 28px 0;
	text-align: center;
}

.splash-rules
{
	width: 100%;
	max-width: 340px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 28px;
}

.rule
{
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 16px;
	padding: 14px 18px 14px 34px;
	background: var(--bg2);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	min-height: 54px;
}

.rule-icon
{
	color: var(--accent-gold);
	width: 32px;
	height: 32px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.rule-icon svg
{
	width: 28px;
	height: 28px;
	fill: currentColor;
}

.rule-text
{
	font-size: 15.5px;
	color: #ddd;
	line-height: 1.45;
}

.rule-text strong
{
	color: var(--text);
	font-weight: 600;
}

.splash-theme-section
{
	margin: 0 0 20px 0;
	text-align: center;
}

.splash-theme-label
{
	font-family: var(--display);
	font-size: 16px;
	font-weight: 700;
	color: var(--accent);
	text-transform: uppercase;
	margin-bottom: 6px;
}

.splash-theme-clue
{
	font-size: 16.5px;
	color: var(--text-sub);
	font-style: italic;
}

.splash-date-game
{
	font-size: 13.5px;
	color: var(--text-dim);
}

.splash-archive-link
{
	margin-top: 35px;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 10px;
}

.end-content .splash-archive-link
{
	margin-top: 16px;
}

.splash-archive-link a
{
	color: #00c896;
	font-size: 16px;
	font-weight: 500;
	text-decoration: none;
	padding: 10px 24px;
	border: 1px solid rgba(0, 200, 150, 0.3);
	border-radius: 9999px;
	transition: all 0.2s ease;
}

.splash-archive-link a:hover
{
	background: rgba(0, 200, 150, 0.15);
	border-color: #00c896;
	color: white;
}

.btn-start
{
	width: 100%;
	max-width: 340px;
	padding: 18px;
	border-radius: var(--radius);
	background: var(--accent);
	color: #000;
	font-family: var(--display);
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	border: none;
	cursor: pointer;
	position: relative;
	overflow: hidden;
	margin-top: 8px;
	margin-bottom: 20px;
}

.btn-start::before
{
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 60%;
	height: 100%;
	background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,0.35) 50%, transparent 80%);
	animation: btnShimmer 2.2s ease-in-out infinite;
}

@keyframes btnShimmer { 0% { left: -100%; } 40% { left: 140%; } 100% { left: 140%; } }

.btn-start::after
{
	content: '';
	position: absolute;
	inset: -2px;
	border-radius: calc(var(--radius) + 2px);
	box-shadow: 0 0 18px 4px rgba(0,200,150,0.45);
	animation: btnPulse 2.2s ease-in-out infinite;
}

@keyframes btnPulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

.btn-start:active
{
	transform: scale(0.98);
	opacity: 0.9;
}

/* ====================== HEADER ====================== */
.header
{
	width: 100%;
	max-width: 560px;
	padding: 14px 16px 8px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.center-group
{
	display: flex;
	align-items: center;
	gap: 8px;
}

.timer-wrap
{
	display: flex;
	align-items: center;
	gap: 7px;
	background: var(--bg2);
	border: 1px solid var(--border2);
	border-radius: 8px;
	padding: 5px 10px;
}

.timer-ring
{
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.timer-ring circle
{
	fill: none;
	stroke-width: 2.5;
	stroke-linecap: round;
}

.ring-bg { stroke: var(--border2); }

.ring-fill
{
	stroke: var(--accent);
	stroke-dasharray: 47.1;
	stroke-dashoffset: 0;
	transform: rotate(-90deg);
	transform-origin: 50% 50%;
	transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer-val
{
	font-family: 'IBM Plex Sans', monospace;
	font-size: 19px;
	font-weight: 600;
	color: var(--text);
	min-width: 42px;
}

.icon-btn
{
	width: 36px;
	height: 36px;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--bg2);
	color: var(--text-sub);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	transition: color 0.15s, border-color 0.15s;
}

.icon-btn svg
{
	width: 20px;
	height: 20px;
	fill: currentColor;
}

.icon-btn:hover
{
	color: var(--accent-gold);
	border-color: var(--border2);
}

.back-btn, .help-btn
{
	font-size: 22px;
	font-weight: 700;
}

.header-right
{
	display: flex;
	align-items: center;
	gap: 6px;
}

/* ====================== PROGRESS ====================== */
.progress-wrap
{
	width: 100%;
	max-width: 560px;
	padding: 8px 16px 4px;
}

.progress-row
{
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 5px;
}

.progress-label
{
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-dim);
}

.progress-count
{
	font-size: 11px;
	color: var(--text-sub);
	font-family: 'IBM Plex Sans', monospace;
}

.progress-track
{
	height: 6px;
	background: var(--border);
	border-radius: 3px;
	overflow: hidden;
}

.progress-fill
{
	height: 100%;
	background: var(--accent);
	border-radius: 3px;
	transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
	width: 0%;
}

/* ====================== BOARD ====================== */
.board-wrap
{
	width: 100%;
	max-width: 560px;
	padding: 8px 16px 40px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--slot-gap);
	flex: 1 1 auto;
	align-content: start;
	overflow-y: auto;
}

.slot
{
	height: var(--card-h);
	position: relative;
	border-radius: var(--radius);
	overflow: hidden;
}

.card
{
	height: var(--card-h);
	position: absolute;
	inset: 0;
	background: var(--card);
	border: 1.5px solid var(--border2);
	border-radius: var(--radius);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px 18px;
	cursor: pointer;
	text-align: center;
}

.card-text
{
	font-size: 16px;
	font-weight: 500;
	color: var(--text);
}

.emoji { font-size: 42px; }

/* ====================== CARD ANIMATIONS ====================== */
.card.slide-in { animation: slideUp 0.3s cubic-bezier(0.22,1,0.36,1) forwards; }
@keyframes slideUp { from { transform: translateY(110%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.card.slide-out
{
	animation: slideOut 0.24s cubic-bezier(0.4,0,1,1) forwards;
	pointer-events: none;
}
@keyframes slideOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-115%); opacity: 0; } }

.card.cycle-out
{
	animation: cycleOut 0.24s cubic-bezier(0.4,0,1,1) forwards;
	pointer-events: none;
}
@keyframes cycleOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(115%); opacity: 0; } }

.card.selected
{
	background: rgba(0,200,150,0.10);
	border-color: var(--accent);
	box-shadow: 0 0 0 2px rgba(0,200,150,0.25);
}

.card.selected .card-text { color: var(--accent); }

.card.matched
{
	background: rgba(0,200,150,0.13);
	border-color: var(--accent);
	pointer-events: none;
}

.card.matched .card-text { color: var(--accent); }

.card.wrong
{
	animation: wrongFlash 0.38s ease forwards;
	pointer-events: none;
}

@keyframes wrongFlash {
  0%,100% { background: var(--card); border-color: var(--border2); }
  15% { background: var(--red-dim); border-color: var(--red); }
}

/* ====================== PAUSE OVERLAY ====================== */
.pause-overlay
{
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
	z-index: 450;
	align-items: center;
	justify-content: center;
}

.pause-overlay.show { display: flex; }

.pause-content
{
	background: #1a1a1a;
	border: 1px solid #383838;
	border-radius: 16px;
	padding: 32px 40px;
	text-align: center;
	max-width: 280px;
	box-shadow: 0 10px 40px rgba(0,0,0,0.7);
}

.pause-glyph
{
	font-size: 48px;
	margin-bottom: 16px;
	opacity: 0.8;
}

.pause-title
{
	font-family: var(--display);
	font-size: 32px;
	font-weight: 800;
	letter-spacing: 0.02em;
	color: #ffffff;
	margin-bottom: 8px;
}

.pause-sub
{
	font-size: 15px;
	color: #bbbbbb;
	margin-bottom: 28px;
}

.btn-resume
{
	padding: 16px 56px;
	border-radius: 12px;
	background: #00c896;
	color: #000;
	font-family: var(--display);
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	border: none;
	cursor: pointer;
}

.btn-resume:hover { opacity: 0.9; }

/* ====================== SUCCESS SCREEN ====================== */
.end-screen
{
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.95);
	z-index: 600;
	align-items: center;
	justify-content: center;
	padding: 20px;
	overflow-y: auto;
}

.end-screen.show { display: flex; }

.end-content
{
	text-align: center;
	padding: 24px 24px 32px;
	max-width: 380px;
	margin: auto;
	width: 100%;
}

.end-glyph
{
	font-size: 68px;
	margin-bottom: 10px;
	display: block;
}

.end-title
{
    font-family: var(--display);
    font-size: min(42px, 10.5vw);
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.05;
}

.end-subtitle
{
	font-size: 15.5px;
	color: #aaa;
	margin-bottom: 16px;
	display: none;
}

.end-theme-wrap
{
	margin-bottom: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: center;
}

.end-theme-clue
{
	font-family: var(--sans);
	font-size: 16px;
	font-weight: 400;
	color: var(--text-sub);
	font-style: italic;
	letter-spacing: 0;
	line-height: 1.4;
}

.end-theme-event
{
	font-size: 15.5px;
	font-weight: 600;
	color: var(--accent-gold);
	letter-spacing: 0.01em;
}

.end-stats
{
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 8px;
}

.end-stat
{
	background: #1a1a1a;
	border: 1px solid #383838;
	border-radius: 12px;
	padding: 11px 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.end-stat-label
{
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.05em;
	color: #888;
	text-transform: uppercase;
}

.end-stat-value
{
	font-size: 19px;
	font-weight: 700;
	color: #fff;
}

.new-record
{
	background: #f5c518;
	color: #000;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 4px;
	margin-left: 8px;
	text-transform: uppercase;
}

.btn-play-again
{
	width: 100%;
	max-width: 340px;
	padding: 18px;
	background: var(--accent);
	color: #000;
	font-family: var(--display);
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	border: none;
	border-radius: var(--radius);
	cursor: pointer;
	margin-bottom: 12px;
}

/* ====================== PAIRS ACCORDION ====================== */
.pairs-accordion
{
	width: 100%;
	max-width: 340px;
	margin: 0 auto 20px;
	border: 1px solid var(--border2);
	border-radius: var(--radius);
	overflow: hidden;
}

.pairs-accordion-toggle
{
	width: 100%;
	background: var(--bg2);
	border: none;
	color: var(--text-sub);
	font-family: var(--sans);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	padding: 12px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	transition: color 0.2s;
	text-transform: uppercase;
    letter-spacing: 0.08em;

}

.pairs-accordion-toggle:hover { color: var(--text); }

.pairs-accordion-chevron
{
	font-size: 11px;
	transition: transform 0.25s ease;
	color: var(--text-dim);
}

.pairs-accordion.open .pairs-accordion-chevron
{
	transform: rotate(180deg);
}

.pairs-accordion-body
{
	display: none;
	background: var(--bg2);
	border-top: 1px solid var(--border);
	padding: 12px 16px;
}

.pairs-accordion.open .pairs-accordion-body
{
	display: block;
}

.pairs-accordion-row
{
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 5px 0;
	font-size: 14px;
	color: var(--text-sub);
	border-bottom: 1px solid var(--border);
}

.pairs-accordion-row:last-child { border-bottom: none; }

.pairs-accordion-left,
.pairs-accordion-right
{
	flex: 1;
	text-align: center;
	font-weight: 500;
	color: var(--text);
}

.pairs-accordion-sep
{
	color: var(--border2);
	font-size: 16px;
	flex-shrink: 0;
}







#btnShare
{
	width: 100%;
	max-width: 340px;
	padding: 16px;
	background: transparent;
	color: var(--accent);
	font-size: 15px;
	font-weight: 600;
	border: 1px solid rgba(0, 200, 150, 0.35);
	border-radius: 12px;
	cursor: pointer;
	transition: all 0.2s ease;
	margin-bottom: 10px;
}

#btnShare:hover
{
	background: rgba(0, 200, 150, 0.08);
	border-color: var(--accent);
}

/* ====================== DIFFICULTY LEVELS ====================== */
.difficulty-levels
{
	display: flex;
	gap: 12px;
	font-size: 20px;
	align-items: center;
}

.difficulty-levels span
{
	opacity: 0.15;
	transition: opacity 0.3s;
	line-height: 1;
}

.difficulty-levels span.active
{
	opacity: 1;
}

/* ====================== HELP MODAL ====================== */
.help-modal
{
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.95);
	z-index: 800;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.help-modal.show { display: flex !important; }

.help-content
{
	background: var(--bg2);
	border-radius: 16px;
	width: 90%;
	max-width: 420px;
	padding: 24px;
	border: 1px solid var(--border);
}

.help-header
{
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--border2);
}

.help-header h2
{
	margin: 0;
	font-family: var(--display);
	font-size: 24px;
	color: var(--text);
}

.help-body a
{
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.help-body a:hover
{
    color: #fff;
    text-decoration: underline;
}

.close-btn
{
	background: none;
	border: none;
	font-size: 28px;
	color: var(--text-sub);
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 6px;
}

.close-btn:hover
{
	color: var(--text);
	background: rgba(255,255,255,0.08);
}

.help-body
{
	padding: 0 24px 24px;
	overflow-y: auto;
	max-height: calc(85vh - 160px);
	-webkit-overflow-scrolling: touch;
	line-height: 1.55;
}

.help-body h3
{
	margin: 24px 0 12px;
	color: var(--accent);
	font-size: 17px;
}

.help-body h4
{
	margin: 24px 0 8px 0;
	color: var(--accent);
	font-size: 17px;
	font-weight: 600;
}

.help-body h3 + h4 { margin-top: 32px; }

.help-body ul
{
	padding-left: 20px;
	margin: 12px 0 20px;
}

.help-body li
{
	margin-bottom: 10px;
	color: var(--text-sub);
	line-height: 1.5;
}

.help-body p
{
	color: #bbbbbb;
	margin-bottom: 16px;
}

#helpArchiveLink
{
	color: #00c896;
	font-weight: 500;
	text-decoration: none;
	transition: all 0.2s ease;
}

#helpArchiveLink:hover
{
	text-decoration: underline;
	color: white;
}

/* ====================== ARCHIVE MODAL ====================== */
.archive-modal
{
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.95);
	z-index: 800;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.archive-modal.show { display: flex !important; }

.archive-content
{
	background: #1a1a1a;
	border: 1px solid #383838;
	border-radius: 16px;
	width: 100%;
	max-width: 420px;
	max-height: 92vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.archive-header
{
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px 24px 16px;
	border-bottom: 1px solid #383838;
}

.archive-header h2
{
	margin: 0;
	font-family: var(--display);
	font-size: 26px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: #ffffff;
}

.month-nav
{
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 24px;
	background: #252525;
	border-bottom: 1px solid #383838;
}

.nav-btn
{
	background: none;
	border: none;
	font-size: 28px;
	color: #888;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border-radius: 8px;
	transition: all 0.2s;
}

.nav-btn:hover
{
	background: rgba(255,255,255,0.08);
	color: #ddd;
}

.current-month
{
	font-family: var(--sans);
	font-size: 18px;
	font-weight: 700;
	color: #ffffff;
}

.calendar-grid
{
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 6px;
	padding: 16px 10px 24px;
	overflow-y: auto;
	flex: 1;
}

.calendar-day
{
	width: 44px !important;
	height: 62px !important;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	border-radius: 9px;
	background: #252525;
	cursor: pointer;
	padding: 6px;
	box-sizing: border-box;
}

.calendar-day .archive-icon
{
	width: 22px;
	height: 28px;
}

.calendar-day .date-num
{
	font-size: 13.5px;
	font-weight: 600;
	color: #ddd;
	transition: color 0.2s;
}

.calendar-day.today
{
	border: 2px solid var(--accent);
	background: rgba(0, 200, 150, 0.12);
}

.calendar-day.today.played
{
	border: 2px solid var(--accent);
	background: rgba(0, 200, 150, 0.12);
}

.calendar-day.played .date-num,
.calendar-day.played.played .date-num
{
	color: #C89601 !important;
	font-weight: 700;
}

.calendar-day.played,
.calendar-day.before-launch
{
	cursor: default !important;
}

.calendar-day.before-launch { opacity: 0.45; }
.calendar-day.before-launch .date-num { color: #777; }

.calendar-day.future
{
	opacity: 0.55;
	cursor: default;
}

.calendar-day.future:hover { background: #252525; }

.archive-empty
{
	padding: 80px 24px;
	text-align: center;
	color: #888;
	font-size: 15px;
	line-height: 1.5;
}

/* ====================== BETA NOTICE ====================== */
.splash-date-game.beta-notice
{
	font-size: 13.5px;
	color: var(--text-dim);
	font-weight: 400;
	letter-spacing: 0.01em;
	text-align: center;
	margin-top: 12px;
	line-height: 1.4;
}

#splashDate,
#splashGameNo { display: none; }
