/* * Font faces */

@font-face {
	font-family: 'CM Sans';
	src: url('../fonts/cmunssdc.otf') format('opentype');
	font-display: swap;
}

@font-face {
	font-family: 'Concrete Roman';
	src: url('../fonts/cmunorm.otf') format('opentype');
	font-display: swap;
}

/* * Variables and reset */

:root {
	--color-bg: #fef9f0;
	--color-surface: #fff8ec;
	--color-primary: #60b8d4;
	--color-primary-dark: #3a9abb;
	--color-accent: #f9a8d4;
	--color-yellow: #fde68a;
	--color-green: #86efac;
	--color-purple: #c4b5fd;
	--color-orange: #fdba74;
	--color-danger: #f87171;
	--color-danger-dark: #dc2626;
	--color-text: #3d3434;
	--color-text-light: #9c8f8f;
	--color-selected-bg: #dbeafe;
	--color-selected-border: #3b82f6;
	--color-border: #3d3434;
	--color-shadow: rgba(61, 52, 52, 0.18);
	--radius: 16px;
	--radius-sm: 10px;
	--shadow: 4px 4px 0 var(--color-border);
	--shadow-sm: 3px 3px 0 var(--color-border);
	--font-display: 'CM Sans', sans-serif;
	--font-body: 'Concrete Roman', serif;
	--min-tap: 44px;
}

*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html, body {
	height: 100%;
}

body {
	background: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

/* * App shell */

#app {
	display: flex;
	flex-direction: column;
	min-height: 100dvh;
	max-width: 600px;
	margin: 0 auto;
	padding: 0 0 100px;
}

/* * Header */

.app-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 16px 8px;
	gap: 12px;
}

.app-title {
	font-family: var(--font-display);
	font-size: 2rem;
	font-weight: 700;
	color: var(--color-text);
	letter-spacing: -0.5px;
	line-height: 1.1;
}

.lang-btn {
	font-family: var(--font-display);
	font-size: 1.1rem;
	font-weight: 700;
	background: var(--color-yellow);
	color: var(--color-text);
	border: 2.5px solid var(--color-border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-sm);
	padding: 6px 14px;
	cursor: pointer;
	min-height: var(--min-tap);
	min-width: var(--min-tap);
	transition: transform 0.1s, box-shadow 0.1s;
}

.lang-btn:active {
	transform: translate(3px, 3px);
	box-shadow: 1px 1px 0 var(--color-border);
}

/* * Toolbar */

.toolbar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px 12px;
	flex-wrap: wrap;
}

.toolbar-spacer {
	flex: 1;
}

/* * Buttons */

.btn {
	font-family: var(--font-display);
	font-size: 1.15rem;
	font-weight: 600;
	background: var(--color-surface);
	color: var(--color-text);
	border: 2.5px solid var(--color-border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-sm);
	padding: 8px 18px;
	cursor: pointer;
	min-height: var(--min-tap);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	transition: transform 0.1s, box-shadow 0.1s;
	text-align: center;
	white-space: nowrap;
}

.btn:active:not(:disabled) {
	transform: translate(3px, 3px);
	box-shadow: 1px 1px 0 var(--color-border);
}

.btn:disabled {
	opacity: 0.38;
	cursor: not-allowed;
	box-shadow: 2px 2px 0 var(--color-border);
}

.btn-primary {
	background: var(--color-primary);
	color: #fff;
}

.btn-primary:active:not(:disabled) {
	background: var(--color-primary-dark);
}

.btn-danger {
	background: var(--color-danger);
	color: #fff;
}

.btn-danger:active:not(:disabled) {
	background: var(--color-danger-dark);
}

.btn-toolbar {
	font-size: 1.05rem;
	padding: 8px 14px;
}

.btn-suggest {
	background: var(--color-accent);
}

.btn-icon {
	padding: 0;
	width: var(--min-tap);
	height: var(--min-tap);
	border-radius: var(--radius-sm);
}

/* * FAB (add button) */

.btn-fab {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	border: 3px solid var(--color-border);
	background: var(--color-green);
	color: var(--color-text);
	font-family: var(--font-display);
	font-size: 2.5rem;
	font-weight: 700;
	line-height: 1;
	box-shadow: 5px 5px 0 var(--color-border);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.1s, box-shadow 0.1s;
	z-index: 50;
}

.btn-fab:active {
	transform: translate(5px, 5px);
	box-shadow: 0 0 0 var(--color-border);
}

/* * Item list */

.item-list {
	list-style: none;
	padding: 4px 16px 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* Item card background colors cycle through 4 pastels */
.item-card:nth-child(4n+1) { background: var(--color-yellow); }
.item-card:nth-child(4n+2) { background: var(--color-green); }
.item-card:nth-child(4n+3) { background: var(--color-accent); }
.item-card:nth-child(4n+0) { background: var(--color-orange); }

.item-card {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 14px 16px;
	border: 2.5px solid var(--color-border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	cursor: pointer;
	user-select: none;
	transition: transform 0.1s, box-shadow 0.1s;
	outline: none;
}

.item-card:focus-visible {
	outline: 3px solid var(--color-primary);
	outline-offset: 2px;
}

.item-card:active {
	transform: translate(4px, 4px);
	box-shadow: 0 0 0 var(--color-border);
}

.item-card.selected {
	background: var(--color-selected-bg) !important;
	border-color: var(--color-selected-border);
	box-shadow: 4px 4px 0 var(--color-selected-border);
}

.item-name {
	font-family: var(--font-display);
	font-size: 1.45rem;
	font-weight: 700;
	line-height: 1.2;
}

.item-date {
	font-family: var(--font-body);
	font-size: 0.85rem;
	color: var(--color-text-light);
}

.item-date.never-played {
	font-style: italic;
}

/* * Modals */

dialog {
	border: none;
	background: transparent;
	padding: 0;
	max-width: 100vw;
	max-height: 100dvh;
}

dialog::backdrop {
	background: rgba(61, 52, 52, 0.45);
}

.modal {
	width: min(480px, calc(100vw - 32px));
}

.modal-inner {
	background: var(--color-surface);
	border: 3px solid var(--color-border);
	border-radius: var(--radius);
	box-shadow: 6px 6px 0 var(--color-border);
	padding: 24px 20px 20px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	max-height: 90dvh;
	overflow-y: auto;
}

.modal-title {
	font-family: var(--font-display);
	font-size: 1.7rem;
	font-weight: 700;
	line-height: 1.2;
}

.modal-subtitle {
	font-family: var(--font-body);
	font-size: 0.95rem;
	color: var(--color-text-light);
	margin-top: -8px;
}

.section-title {
	font-family: var(--font-display);
	font-size: 1.2rem;
	font-weight: 600;
	border-bottom: 2px solid var(--color-border);
	padding-bottom: 4px;
}

/* ** Modal open animation */

dialog[open] .modal-inner {
	animation: modal-in 0.18s ease-out;
}

@keyframes modal-in {
	from { opacity: 0; transform: translateY(10px) scale(0.97); }
	to   { opacity: 1; transform: none; }
}

/* * Form elements */

.date-row {
	display: flex;
	gap: 10px;
}

.date-input {
	font-family: var(--font-body);
	font-size: 1.1rem;
	padding: 10px 12px;
	border: 2.5px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: #fff;
	color: var(--color-text);
	min-height: var(--min-tap);
	flex: 1;
}

.date-input:focus {
	outline: 3px solid var(--color-primary);
	outline-offset: 1px;
}

.text-input {
	font-family: var(--font-display);
	font-size: 1.3rem;
	padding: 10px 14px;
	border: 2.5px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: #fff;
	color: var(--color-text);
	min-height: var(--min-tap);
	width: 100%;
}

.text-input:focus {
	outline: 3px solid var(--color-primary);
	outline-offset: 1px;
}

.btn-row {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.btn-row .btn {
	flex: 1;
}

.error-msg {
	font-family: var(--font-body);
	font-size: 0.9rem;
	color: var(--color-danger-dark);
	font-weight: 600;
}

.error-msg.hidden {
	display: none;
}

.confirm-text {
	font-family: var(--font-display);
	font-size: 1.35rem;
	font-weight: 600;
	text-align: center;
	line-height: 1.3;
}

/* * Dates list (in play-date modal) */

.dates-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.date-entry {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 12px;
	background: var(--color-yellow);
	border: 2px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-family: var(--font-body);
	font-size: 0.95rem;
}

.delete-date-btn {
	font-family: var(--font-body);
	font-size: 1rem;
	font-weight: 700;
	background: var(--color-danger);
	color: #fff;
	border: 2px solid var(--color-border);
	border-radius: var(--radius-sm);
	box-shadow: 2px 2px 0 var(--color-border);
	width: 36px;
	height: 36px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: transform 0.1s, box-shadow 0.1s;
}

.delete-date-btn:active {
	transform: translate(2px, 2px);
	box-shadow: 0 0 0 var(--color-border);
}

.no-dates {
	font-family: var(--font-body);
	font-size: 0.95rem;
	color: var(--color-text-light);
	font-style: italic;
	text-align: center;
	padding: 8px 0;
}

/* * Suggestions list */

.suggestions-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.suggestion-entry {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 12px 14px;
	border: 2.5px solid var(--color-border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
}

.suggestion-entry:nth-child(1) { background: var(--color-purple); }
.suggestion-entry:nth-child(2) { background: var(--color-orange); }
.suggestion-entry:nth-child(3) { background: var(--color-green); }

.suggestion-label {
	font-family: var(--font-body);
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--color-text-light);
}

.suggestion-name {
	font-family: var(--font-display);
	font-size: 1.4rem;
	font-weight: 700;
	line-height: 1.2;
}

/* * Responsive */

@media (max-width: 400px) {
	.app-title { font-size: 1.65rem; }
	.btn-toolbar { font-size: 0.95rem; padding: 8px 10px; }
	.item-name { font-size: 1.25rem; }
}
