﻿:root { --topbar-h: 50px; --pad: clamp(16px, 3vw, 28px); }

/********** Main Body Styles ***********/
html, body {
	height: 100%;
}

body {
	overflow: hidden;
	overscroll-behavior: none;
}

html.allowscroll,
body.allowscroll {
	overflow-y: auto;
	overscroll-behavior: auto;
	-webkit-overflow-scrolling: touch;
}

body{
	min-height: 100svh;
/*	display: grid; */
	font-family:ui-rounded,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
	margin:0;
	background:#f9fafb;
	color:#0f172a;
	-webkit-tap-highlight-color: transparent;
}

.bg{
	z-index: 0; 
	position:fixed;
	inset:0;
	background:#f9fafb center/cover no-repeat;
	filter:saturate(1.05) contrast(1.03);
	z-index:0;
}

.stage{
	position: relative;
	height: calc(100vh  - var(--topbar-h, 0px));
	height: calc(100svh - var(--topbar-h, 0px));
	min-height: calc(100vh  - var(--topbar-h, 0px));
	min-height: calc(100svh - var(--topbar-h, 0px));
	padding: 10px;
	overflow: hidden;
	touch-action: none;
	user-select: none;
}

/* disable text selection + long-press callout everywhere */
html, body, #stage, canvas, .tile, .btn, .topbar, .grid, .piece, .placedImg {
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;          /* blocks iOS long-press menu */
	-webkit-tap-highlight-color: transparent; /* removes gray tap flash */
}

/* but allow selection where you actually want it (inputs etc.) */
input, textarea, [contenteditable], .allow-select {
	-webkit-user-select: text;
	user-select: text;
	-webkit-touch-callout: default;
}

.hud{
	position:absolute; 
	left:12px; 
	bottom:12px;
	font:600 16px system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	background:rgba(0,0,0,.35);
	color:#fff; 
	padding:6px 10px; 
	border-radius:999px;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	user-select:none; 
	pointer-events:none;
}

.wrap{
	position:relative;
	z-index:1;
	display:grid;
	place-items:center;
	min-height:100svh;
	padding:24px
}

.grid{
	display:grid;
	gap:16px;
	grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
	width:min(100%,900px)
}

.tile{
	background:white;
	border-radius:18px;
	padding:22px 18px;
	box-shadow:0 2px 10px rgba(0,0,0,.08);
	text-align:center;
	text-decoration: none; 
	color: inherit;
	touch-action:manipulation;
}

.tile:active{
	transform:scale(.985)
}

.tile:focus-visible { 
	outline: 3px solid #60a5fa; 
	outline-offset: 4px; 
	border-radius: 16px; 
}

.thumb{
	border-radius:12px;
	aspect-ratio: 16/10; 
	width:100%; 
	object-fit:cover; 
	display:block
}

.emoji{
	font-size:56px;
	line-height:1;
	margin-bottom:8px
}

.title{
	font-size:20px;
	font-weight:700;
	margin:6px 0 4px
}

.sub{
	font-size:14px;
	color:#475569;
	margin:0
}

.brand{
	position:fixed;
	inset:auto 12px 12px auto;
	font-size:12px;
	color:#64748b
}

.bar{
	position:sticky;
	top:0;
	background:linear-gradient(#f9fafb,#f9fafb00);
	height:16px
}

.label{
	left:12px;
	bottom:12px;
	background:#ffffffd9;
	padding:6px 10px;
	border-radius:12px;
	font-weight:700;
	box-shadow:0 2px 8px rgba(0,0,0,.12)
}

.count{
	font-size:12px;
	color:#475569;
	margin-left:6px;
	font-weight:600
}

.back{
	position:fixed;
	left:16px;
	top:16px;
	font-size:18px;
	text-decoration:none
}

* { box-sizing: border-box; }
.back{
  position:fixed; left:16px; top:16px; z-index:1000;
  background:#ffffffcc; padding:8px 12px; border-radius:12px;
  text-decoration:none; color:#111;
}

/******* TOP BAR STYLES ********/
.topbar .btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.topbar .btn .i{
  font-size:1.05em;   /* slightly larger for balance */
  line-height:1;
  transform:translateY(-1px); /* subtle optical tweak */
}

.home-link .i{ font-size:1.05em; line-height:1; transform:translateY(-1px); }


/* Fixed top bar with iOS safe area padding */
#topbar, .topbar {
  height:50px;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 10px;
  display: flex; align-items: center; gap: 8px;
  /* optional backdrop polish */
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.06);             /* tiny tint so backdrop-filter shows */
  backdrop-filter: blur(8px);
}

/* Make Home always win space; other actions compress first */
#topbar .btn--home { margin-right: auto; order: -1; flex: 0 0 auto; }
#topbar .actions { display: flex; gap: 8px; min-width: 0; overflow: hidden; }
#topbar .actions .btn { flex: 0 0 auto; }
#topbar .status-pill{background:#fff;border-radius:999px;padding:8px 12px;box-shadow:var(--shadow);font-weight:700;color:#475569}

/* Don’t let the status line wrap; keeps other buttons from growing */
#topbar .status-pill { white-space: nowrap; }

/* On small phones, hide the text labels for Restart/Theme first */
@media (max-width: 430px) {
  #topbar .actions .btn .txt { display:none; }
  #topbar .actions .btn { padding-inline:10px; }
}
/* Generic pill button */
.btn{
  display:inline-flex; align-items:center; gap:.5rem;
  padding:.55rem .9rem; border-radius:14px;
  background:rgba(255,255,255,.9);
  box-shadow:0 2px 8px rgba(0,0,0,.10);
  font-weight:600; color:#111; text-decoration:none;
}

/* fireworks */
.fx-canvas {
	z-index: 2000;
	pointer-events: none;
	position: fixed;
	inset: 0;
}

/* win modal */
#gc-win {
	z-index: 3000;
}
