/* Shared styles for QuestRoller pages to satisfy CSP (no inline styles) */
.page-body{font-family:system-ui,-apple-system,Roboto,Arial;padding:24px}
/* Color tokens inspired by landing page */
:root{
	--bg:#0f1724; /* dark base */
	--muted:#cbd5e1; /* light muted */
	--border:rgba(255,255,255,0.06);
	--accent:#ffbe0b; /* landing page gold */
	--accent-2:#f72585; /* pink highlight from landing */
	--nav-bg:rgba(0,0,0,0.6);
	--fg:#f1f1f1;
}
body{font-family:Arial,Helvetica,sans-serif;margin:0;padding:10px;color:var(--fg);background:linear-gradient(135deg,#1b1b2f,#3a0ca3,#7209b7)}
.landing header { padding: 1.6em 1em; background: rgba(0,0,0,0.6); text-align:center }
.landing header h1 { font-size:2.4em; margin:0; color:var(--accent); text-shadow:2px 2px 8px #000 }
.landing header p { font-size:1.05em; margin-top:0.2em; color:#ffdd99 }
.landing main { padding: 1.6em 2em }
.landing main h2 { font-size:2em; margin:0.2em 0 1em 0; color:var(--accent-2); vertical-align:top }
.dice-dragon { margin: 2em auto; width:200px; height:200px; background: url('/web/assets/dragon.svg') no-repeat center/contain; filter: drop-shadow(0 0 10px var(--accent)); }
/* CTA styles already exist; add landing helper */
.landing .cta { display:inline-block }

/* oauth_redirect styles */
.oauth-redirect { font-family: 'Trebuchet MS', sans-serif; background: linear-gradient(135deg,#1b1b2f,#3a0ca3,#7209b7); color:var(--fg); text-align:center; padding:5em 2em }
.oauth-redirect h1 { color:var(--accent); text-shadow:2px 2px 6px #000 }
.oauth-redirect p { font-size:1.2em; color:#ffdd99; margin-top:1em }
/* Make the redirect 'click here' link prominent: gold, bold, no underline */
.oauth-redirect #oauth-next a { color: var(--accent); text-decoration: none; font-weight: 800; }
.oauth-redirect #oauth-next a:hover { text-decoration: underline; opacity: 0.95; }

/* legacy simple page */
.qr-legacy { font-family: Arial, sans-serif; text-align:center; margin:2em }
.qr-legacy button { padding:1em 2em; margin:0.5em; font-size:1.2em; border-radius:8px; cursor:pointer }
.qr-navbar{padding:12px 18px;border-bottom:1px solid rgba(0,0,0,0.08);background:linear-gradient(90deg,#3a0ca3,#7209b7);color:var(--fg);margin-bottom:18px;display:flex;align-items:center;justify-content:space-between;flex-wrap:nowrap}
.qr-navbar .left{display:flex;align-items:center;gap:12px}
.qr-navbar .right{margin-left:auto;display:flex;align-items:center;gap:8px}
.qr-navbar a{color:inherit;text-decoration:none}
/* Brand link styling */
.brand .brand-text a{color:var(--accent);text-decoration:none}

/* Navbar button tweaks */
.qr-navbar .btn{background:rgba(255,255,255,0.06);color:var(--fg);border-radius:8px;padding:8px 10px}
.qr-navbar .btn.primary{background:var(--accent);color:#111}
.nav-display{margin-right:1em}
.mt-1{margin-top:1em}
.btn{padding:0.6em 1em;border-radius:6px;border:0;background:rgba(255,255,255,0.06);color:var(--fg);cursor:pointer}
.btn.primary{background:var(--accent);color:#111}
.btn.small{padding:6px 8px}
.qr-input{margin-left:8px;padding:6px;border-radius:4px;border:1px solid #ccc}
.qr-input.small{padding:0.6em;font-size:1em;border-radius:6px;width:160px}
#log{border:1px solid #ccc;padding:8px;height:300px;overflow:auto}
.card{padding:22px;border-radius:12px;box-shadow:0 10px 36px rgba(0,0,0,0.45);background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));max-width:720px;margin:0 auto}
.muted{color:var(--muted)}
.center{text-align:center}
.logo{width:72px;height:72px;vertical-align:middle;border-radius:8px;box-shadow:0 6px 18px rgba(0,0,0,.4);background:#fff;padding:6px}
.brand{display:flex;align-items:center;gap:16px;justify-content:center}
.brand .brand-text{font-weight:700;color:var(--accent);font-size:1.1rem;display:flex;flex-direction:column;align-items:center}
.brand .brand-text h1{margin:0}
.brand .brand-text p{margin:4px 0 0 0}
.displayname-prompt{position:fixed;left:12px;top:12px;z-index:9999;padding:8px 12px;background:#fff;border-radius:8px;color:#000;box-shadow:0 6px 18px rgba(0,0,0,.2)}
.qr-label{font-weight:600;margin-right:8px;font-size:13px}
.visually-hidden{position:absolute!important;height:1px;width:1px;overflow:hidden;clip:rect(1px,1px,1px,1px)}
.cta{display:inline-block;padding:14px 22px;background:#ffbe0b;color:#111;border-radius:8px;text-decoration:none;font-weight:700;box-shadow:0 6px 18px rgba(0,0,0,0.4)}
/* Enhanced CTA for landing page */
.cta{padding:16px 26px;background:linear-gradient(90deg,#ffbe0b,#ffdd99);color:#111;border-radius:12px;text-decoration:none;font-weight:800;font-size:1.05rem;box-shadow:0 10px 30px rgba(255,190,11,0.25),0 4px 10px rgba(0,0,0,0.25) inset;transition:transform .15s ease,box-shadow .15s ease}
.cta:hover{transform:translateY(-3px);box-shadow:0 18px 40px rgba(255,190,11,0.35),0 6px 14px rgba(0,0,0,0.3) inset}
.cta:active{transform:translateY(0);box-shadow:0 8px 24px rgba(0,0,0,0.2) inset}
.cta:focus{outline:3px solid rgba(255,190,11,0.28);outline-offset:3px}

/* QuestRoller Zoom page specific styles (moved from inline in index.html) */
/* QuestRoller zoom page container and rows */
.qr-container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0; display:flex; flex-direction:column; gap:18px; box-sizing:border-box; min-height: calc(100vh - 20px); }
.qr-row { display:flex; align-items:center; gap:12px; width:100%; box-sizing:border-box; margin: 8px 0; }

.qr-header-row { display:flex; justify-content:center; align-items:center; gap:12px; flex-wrap:nowrap; }
.qr-title { margin:0; font-size:clamp(1.1rem, 2.8vw, 2.6rem); display:block; flex:0 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.qr-header-row .logo { width:72px; height:72px; border-radius:8px; flex:0 0 auto; }

/* Ensure the header unit remains side-by-side on narrow screens by reducing sizes */
@media (max-width:360px) {
	.qr-row { flex-direction:column; align-items:stretch; }
	.qr-button-row .btn-large { width:100%; max-width:none; flex:1 1 100%; }
	/* Attempt to keep input and button on the same row in very constrained webviews (e.g. Zoom app)
	   by preventing wrap on the input-row and using percentage widths. If the viewport is extremely
	   narrow and content would overflow, allow horizontal scrolling on the row rather than stacking. */
	.qr-input-row { flex-wrap:nowrap; gap:8px; align-items:center; overflow-x:auto; }
	.qr-input-row .qr-input { flex: 0 0 72%; width:72%; min-width:120px; max-width:72%; box-sizing:border-box; }
	.qr-input-row .btn-large { flex: 0 0 24%; width:24%; min-width:84px; box-sizing:border-box; }
}
@media (min-width:1300px) {
	.qr-header-row .logo { width:112px; height:112px; }
	.qr-title { font-size:2.6rem; }
}

.qr-instructions { justify-content:center; text-align:center; color:var(--muted); padding:0 8px; }

.qr-button-row { justify-content:center; flex-wrap:wrap; gap:12px; }
.qr-button-row .btn-large { padding:10px 14px; font-size:16px; box-sizing:border-box; flex: 0 1 calc((100% - 36px)/4); max-width: calc((100% - 36px)/4); }

.qr-input-row { justify-content:center; flex-wrap:wrap; }
.qr-input-row { justify-content:center; flex-wrap:wrap; align-items:center; }
/* Make the input row split 3/4 input and 1/4 button on wide screens */
.qr-input-row .qr-input { flex: 3 1 60%; min-width:180px; font-size:16px; padding:8px; max-height: calc(2 * 1.2em + 18px); overflow:hidden; box-sizing:border-box; }
.qr-input-row .btn-large { flex: 1 0 24%; min-width:88px; box-sizing:border-box; }

/* Keep the row compact: input should not exceed two lines of text visually */
.qr-input-row .qr-input::-webkit-input-placeholder { opacity:0.7; }
.qr-input-row .qr-input { line-height:1.2em; }

.qr-results-row { flex-direction:column; flex: 1 1 auto; }
.qr-results-row textarea#chatOutput { display:block; width:100%; height:100%; min-height:64px; resize:vertical; padding:10px; border-radius:6px; border:1px solid var(--border); box-sizing:border-box; flex:1 1 auto; }

#active-quest-block { display:flex; align-items:center; justify-content:space-between; gap:8px; }
#active-quest-input { flex:1 1 auto; max-width:none; padding:8px; border-radius:6px; border:1px solid var(--border); background:#fff; }

.qr-debug-row { flex-direction:column; }
.qr-debug-row textarea#logOutput { display:block; width:100%; min-height:10em; resize:vertical; padding:10px; border-radius:6px; border:1px solid var(--border); box-sizing:border-box; }

/* Small utility for the active-quest page connection row */
.connection-row { margin-top:8px; }

.btn-large { background:#111827; color:#fff; border-radius:8px; border:0; padding:10px 14px; cursor:pointer; }

/* Ensure buttons on the active-quest page use the primary gold accent
	 Apply to both .btn and .btn-large when inside the page body for active quest. */
#participantControls .btn, #participantControls .btn-large, .quest-header-row .btn, .quest-header-row .btn-large, #participantControls .btn.small {
	background: var(--accent);
	color: #111;
}

/* Make layout responsive: keep four-per-row until tightened breakpoint,
   then two-per-row, and finally single-column on very small screens. */
@media (max-width:900px) {
	/* two buttons per row */
	.qr-button-row .btn-large { flex: 0 1 calc((100% - 12px)/2); max-width: calc((100% - 12px)/2); }
	.qr-container { padding:10px; }
}

@media (max-width:120px) {
	/* single column of buttons */
	.qr-row { flex-direction:column; align-items:stretch; }
	.qr-button-row .btn-large { width:100%; max-width:none; flex:1 1 100%; }
	.qr-input-row { flex-direction:column; gap:8px; }
	.qr-input-row .qr-input { width:100%; max-width:none; }
	.qr-input-row .btn-large { width:100%; }
}

/* Override narrow-app behavior: when embedded in constrained webviews (like Zoom's app),
   the reported CSS viewport can trigger the single-column rules too aggressively.
   Keep the header row horizontal and centered even at small reported widths so
   the logo and title remain side-by-side and readable. */
@media (max-width:480px) {
	.qr-header-row { flex-direction:row !important; align-items:center !important; justify-content:center !important; }
	.qr-title { white-space:nowrap; text-align:center; overflow:hidden; text-overflow:ellipsis; }
	.qr-header-row .logo { margin-right:8px; }
}

/* Small-screen input-row: prefer keeping the input and button on one line.
   Button receives a firm min-width; input flexes to fill remaining space. If
   space is too small, the row may scroll horizontally rather than stacking. */
@media (max-width:520px) {
	.qr-input-row { flex-wrap:nowrap !important; gap:8px; align-items:center; overflow-x:auto; }
	.qr-input-row .btn-large { flex: 0 0 auto !important; min-width:96px; }
	.qr-input-row .qr-input { flex: 1 1 auto !important; min-width:0; width:auto; }
}

/* Strong override: prefer inline input+button with character-based min-widths.
   This tries to prevent stacking by giving the button a fixed visual width (5ch)
   and letting the input fill remaining space while never shrinking below 5ch. */
.qr-input-row {
	flex-wrap: nowrap !important;
	gap: 8px;
	align-items: center;
	overflow-x: auto;
}
.qr-input-row .qr-input {
	flex: 1 1 auto !important;
	min-width: 5ch !important;
	width: auto !important;
	box-sizing: border-box;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
}
.qr-input-row .btn-large {
	flex: 0 0 auto !important;
	min-width: 5ch !important;
	padding: 8px 10px !important;
	white-space: nowrap;
}

/* Debug area hidden by default; JS will show when ?debug=true.
	Hide based on the container's aria-hidden so descendants are not hidden
	from assistive tech while focused. JS will manage focusing/blur logic. */
.qr-debug-row[aria-hidden="true"] { display: none; }

/* Zoom notice styling (hidden by aria-hidden) */
.zoom-notice { display:block; margin-top:8px; padding:10px 12px; background:rgba(255,255,255,0.03); border-radius:8px; color:var(--fg); }
.zoom-notice[aria-hidden="true"] { display:none; }

/* Ensure rows don't add additional outer margins so body padding (10px) controls window edge gap */
.qr-row { margin-left: 0; margin-right: 0; }

/* Busy cursor utility: applied to body when a roll is in-flight */
body.qr-busy, body.qr-busy * { cursor: progress !important; }

/* Links on purple backgrounds: gold color, no underline */
.landing a, .oauth-redirect a, .qr-legacy a, body.landing a, body.oauth-redirect a { 
	color: var(--accent);
	text-decoration: none;
}
.landing a:hover, .oauth-redirect a:hover, .qr-legacy a:hover, body.landing a:hover, body.oauth-redirect a:hover {
	text-decoration: none;
	opacity: 0.95;
}

/* Start-quest page: make named-quest links gold and remove underline */
#questsList a { color: var(--accent); text-decoration: none; font-weight: 600; }
#questsList a:hover { text-decoration: none; opacity: 0.95; }

/* Active quest header row and share button */
.quest-header-row { display:flex; align-items:center; gap:8px; margin-bottom:12px }
.quest-header-row .quest-name { margin:0; font-size:1.4rem; color:var(--accent); font-weight:700 }
.share-confirm { color:var(--muted); font-size:0.95rem; display: none; margin-left: 8px; }
.btn.small { padding:6px 10px; font-size:0.95rem; border-radius:6px }

/* Uniform control rows for active-quest: make Share, Character Name, and Roll rows
	 visually consistent in height, spacing and alignment. Allow wrapping on very
	 narrow viewports while keeping vertical rhythm. */
.quest-header-row,
#participantControls > div {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 0;
	min-height: 56px; /* consistent row height */
	box-sizing: border-box;
}

/* Make inputs and buttons within participant controls match visually */
#participantControls .qr-input,
#participantControls .btn,
#participantControls .btn.primary,
.quest-header-row .btn {
	height: 40px;
	line-height: 1;
	box-sizing: border-box;
}

#participantControls .qr-input { padding: 8px 10px; }

/* On small screens allow the rows to wrap while maintaining spacing */
@media (max-width:520px) {
	.quest-header-row,
	#participantControls > div { min-height: 48px; padding:6px 0; }
	#participantControls .qr-input { flex: 1 1 auto; min-width: 5ch; }
}