/* Onboarding: one-time introductions (spotlight + coach bubble), help centre, "Yenilikler" and
   the grouped "Sen yokken" summary. Uses the shared tokens and parchment card from style.css. */
:root { --z-tip-spot: 14; --z-tip: 15; }

/* Spotlight: a soft ring around the thing being introduced; the dimmed rest stays tappable
   (pointer-events: none) so a new player can never get stuck behind it. */
#tip-spot { position: fixed; z-index: var(--z-tip-spot); pointer-events: none; border-radius: var(--radius-lg);
  border: 3px solid #f5a524; box-shadow: 0 0 0 4px rgba(245, 165, 36, .35);
  transition: left var(--duration-normal) var(--ease-out), top var(--duration-normal) var(--ease-out), width var(--duration-normal), height var(--duration-normal);
  animation: tipPulse 1.6s ease-in-out infinite; }
@keyframes tipPulse { 50% { box-shadow: 0 0 0 9px rgba(245, 165, 36, .18); } }
/* The dim is its own full-screen layer with a hole cut out (clip-path, set in JS): a 200vmax
   box-shadow is skipped by some mobile GPUs at high device-pixel ratios. */
#tip-dim { position: fixed; inset: 0; z-index: var(--z-tip-spot); pointer-events: none; background: rgba(24, 16, 8, .42); }

#tip { position: fixed; z-index: var(--z-tip); width: min(340px, calc(100vw - 16px)); max-height: calc(var(--visible-h, 100dvh) - 24px); overflow-y: auto;
  padding: var(--space-3) var(--space-3) var(--space-2); border: 2px solid #f5a524; border-radius: var(--radius-lg);
  background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow-modal);
  font: var(--text-sm)/1.45 var(--font-body); animation: tipIn var(--duration-normal) var(--ease-out); }
@keyframes tipIn { from { opacity: 0; transform: translateY(6px); } }
#tip .tip-kicker { margin: 0 36px 2px 0; font-size: var(--text-xs); font-weight: 700; letter-spacing: .02em; color: var(--even); text-transform: uppercase; }
#tip h3 { margin: 0 36px 6px 0; font: 700 var(--text-lg)/1.25 var(--font-display); color: var(--ink); }
#tip .tip-text { margin: 0 0 var(--space-3); }
#tip .tip-text:has(+ .tip-more) { margin-bottom: var(--space-1); }
#tip .tip-more { margin: 0 0 var(--space-3); }
#tip .tip-more summary { display: flex; align-items: center; gap: var(--space-1); cursor: var(--cursor-pointer, pointer); color: var(--ink); font-weight: 600; list-style: none; }
#tip .tip-more summary::-webkit-details-marker { display: none; }
#tip .tip-more summary::before { content: '▸'; }
#tip .tip-more[open] summary::before { content: '▾'; }
#tip .tip-more p { margin: var(--space-1) 0 0; }
#tip .tip-close { position: absolute; top: 4px; right: 4px; width: var(--touch-target); height: var(--touch-target); border: 0; background: transparent; font-size: 18px; color: var(--muted); }
#tip .tip-actions { display: flex; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; }
#tip .tip-actions button { min-height: var(--touch-target); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  font: 600 var(--text-sm)/1.2 var(--font-body); color: var(--ink); border: 1px solid var(--border); background: var(--surface); }
#tip .tip-actions button.primary { flex: 1 1 auto; border: 3px double var(--border); background: var(--btn-beige); box-shadow: 0 0 0 3px var(--decoration-glow), var(--shadow-sm); font-weight: 700; }
#tip .tip-actions button small { display: block; font-weight: 400; font-size: var(--text-xs); color: var(--btn-muted); }

/* The suggested-spot bubble on the map: the job on its own line under the call to action. */
#labels .lbl.coach-bubble:has(small) { display: flex; flex-direction: column; align-items: center; }
#labels .lbl.coach-bubble small { font-weight: 600; }

/* The guide card's "Önerilen yere kur": long translations (DE) wrap onto two lines instead of ellipsizing. */
#quest-tracker .ui-quest-actions > button[data-act="build-suggested"] { white-space: normal; text-overflow: clip; line-height: 1.15; padding-inline: 8px; }

/* Help centre and "Yenilikler": same full-screen parchment modal as the intro/away cards. */
#help, #whats-new { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; background: rgba(20, 12, 5, .45); }
:where(#help, #whats-new, #tip) :is(button, input, summary) { min-height: var(--touch-target); min-width: var(--touch-target); }
.help-card, .news-card { width: min(560px, calc(100vw - 24px)); text-align: left; padding-top: 44px; }
/* Opaque: the translucent --glass let the panel text behind the modal show between the cards (same on main). Doubled class beats .glass in style.css. */
.glass.help-card, .glass.news-card { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
.help-card h3, .news-card h3 { text-align: center; }
.help-card h4 { margin: 0 0 var(--space-2); font: 700 var(--text-md)/1.3 var(--font-display); color: var(--ink); }
.help-next { margin-bottom: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: var(--warning-surface); }
.help-next ol { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.help-next li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--ink); font-size: var(--text-sm); }
.help-next .grow { flex: 1 1 11em; min-width: 0; }
.help-next-icon { font-size: 20px; }
.intro-card .help-next button { padding: 4px 10px; flex: 0 0 auto; }
.intro-card .help-next button[data-primary] { font-weight: 700; box-shadow: 0 0 0 3px var(--decoration-glow); }
.help-keys { margin: var(--space-3) 0; }
.help-keys p { margin: 0; color: var(--ink); font-size: var(--text-sm); line-height: 1.9; }
.help-key { white-space: nowrap; }
.help-key kbd { display: inline-block; min-width: 1.6em; padding: 0 5px; border: 1px solid var(--border-soft); border-bottom-width: 2px; border-radius: 4px; background: var(--surface, #fff); font: 600 12px/1.5 ui-monospace, monospace; text-align: center; }
.help-search { display: grid; gap: 4px; margin-bottom: var(--space-2); font-weight: 600; color: var(--ink); font-size: var(--text-sm); }
.help-search input { width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-raised); color: var(--ink); font: var(--text-md) var(--font-body); }
.help-list { display: grid; gap: var(--space-2); }
.help-item { border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: var(--surface); }
.help-item summary { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); cursor: var(--cursor-pointer, pointer); color: var(--ink); font-size: var(--text-sm); }
.help-item summary .ui-badge { margin-left: auto; }
.help-item[open] summary { border-bottom: 1px solid var(--border-soft); }
.help-item dl { margin: 0; padding: var(--space-2) var(--space-3); display: grid; gap: 2px; font-size: var(--text-sm); }
.help-item dt { font-weight: 700; color: var(--even); margin-top: 4px; }
.help-item dd { margin: 0; color: var(--ink); line-height: 1.45; }
.intro-card .help-item > button { margin: 0 var(--space-3) var(--space-3); padding: 4px 12px; }
.help-empty { text-align: center; }
.help-more { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.intro-card .help-more button { flex: 1 1 160px; }
.news-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: grid; gap: 6px; font-size: var(--text-sm); color: var(--ink); line-height: 1.4; }
.news-list li { display: flex; gap: var(--space-2); }
.news-card > p { text-align: center; }

/* "Sen yokken" grouped summary */
.away-production { text-align: center; color: var(--muted); font-size: var(--text-sm); line-height: 1.4; }
.away-details { margin-bottom: var(--space-2); }
.away-details summary { cursor: var(--cursor-pointer, pointer); color: var(--muted); font-weight: 600; font-size: var(--text-sm); padding: 6px 0; }
.away-next { display: flex; gap: 6px; padding: var(--space-2); border-radius: var(--radius-md); background: var(--warning-surface); color: var(--ink); }
.intro-card p.away-next { margin-bottom: var(--space-2); }

/* The same return report is used by the browser and native mobile shells. */
.intro-card.away-card { padding-top: 16px; }
.away-hero-wrap { position: relative; margin-bottom: 12px; overflow: hidden; border-radius: var(--radius-md); background: #243d35; }
.away-hero { display: block; width: 100%; height: 112px; object-fit: cover; object-position: center; }
.away-village { position: absolute; inset: auto 0 0; padding: 20px 12px 9px; background: linear-gradient(transparent, #102c23ed); color: #fff5d8; font: 700 16px/1.3 var(--font-display); overflow-wrap: anywhere; }
.away-resources, .away-count-chart { margin-bottom: 12px; }
.away-card h4 { margin: 0 0 8px; font: 700 13px/1.3 var(--font-display); color: var(--ink); }
.away-resource-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.away-resource { min-width: 0; padding: 8px 3px; border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: var(--success-surface); text-align: center; }
.away-resource .ui-res-icon { display: block; width: 28px; height: 28px; margin: 0 auto 4px; image-rendering: pixelated; }
.away-resource small { display: block; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.away-resource b { display: block; margin-top: 3px; color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.away-count-chart ul { display: grid; gap: 9px; list-style: none; margin: 0; padding: 0; }
.away-chart-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; font-size: 12px; color: var(--ink); }
.away-count-label { overflow-wrap: anywhere; }
.away-count-track { grid-column: 1 / -1; display: block; height: 8px; overflow: hidden; border-radius: var(--radius-pill); background: var(--surface-inset); }
.away-count-bar { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3a7862, #73a96e); }
.away-chart-row.bad .away-count-bar { background: linear-gradient(90deg, #a75539, #d59355); }
.intro-card .away-chart-note { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.away-card .row2 { position: sticky; bottom: -16px; padding: 8px 0 12px; background: var(--glass); }
.away-card .row2 button { border: 1px solid var(--border); border-image: none; border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); min-height: 44px; }
@media (hover: hover) { .away-card .row2 button:hover:enabled { background: var(--surface-selected); filter: none; } }
.away-card .row2 button[data-primary] { background: #3b6550; color: #fff5d8; border-color: #254e3b; }
@media (hover: hover) { .away-card .row2 button[data-primary]:hover:enabled { background: #4a7860; } }

@media (max-width: 760px), (pointer: coarse) and (max-width: 1100px) {
  #tip, #help, #whats-new { --text-xs: 14px; --text-sm: 15px; --text-md: 16px; }
  .help-card, .news-card { width: calc(100vw - 16px); }
}
@media (prefers-reduced-motion: reduce) {
  #tip-spot { animation: none; transition: none; }
  #tip { animation: none; }
}
#help .panel-close, #whats-new .panel-close { width: var(--touch-target); height: var(--touch-target); }
