<?php /** @var string $title @var string $content @var ?array $player @var array $flashes */ ?><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<?php
  $pageTitle = $title !== config('app_name') ? $title . ' · ' . config('app_name') : $title;
  $desc = $description ?? (config('description') ?: 'A free, shared text adventure in your browser. Explore Hollowmere, solve puzzles and help other explorers find the door under the hill.');
?>
<title><?= e($pageTitle) ?></title>
<?php if ($desc): ?><meta name="description" content="<?= e($desc) ?>"><?php endif; ?>
<?php if (!empty($noindex)): ?>
<meta name="robots" content="noindex">
<?php elseif (isset($canonical)): ?>
<link rel="canonical" href="<?= e(abs_url($canonical)) ?>">
<meta property="og:type" content="website">
<meta property="og:site_name" content="<?= e(config('app_name')) ?>">
<meta property="og:title" content="<?= e($pageTitle) ?>">
<meta property="og:description" content="<?= e($desc) ?>">
<meta property="og:url" content="<?= e(abs_url($canonical)) ?>">
<meta property="og:image" content="<?= e(abs_url('/assets/og-image.png')) ?>">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
<?php endif; ?>
<?php if (config('google_site_verification')): ?><meta name="google-site-verification" content="<?= e(config('google_site_verification')) ?>"><?php endif; ?>
<?php if (config('bing_site_verification')): ?><meta name="msvalidate.01" content="<?= e(config('bing_site_verification')) ?>"><?php endif; ?>
<link rel="icon" href="<?= e(url('/assets/favicon.svg')) ?>" type="image/svg+xml">
<link rel="icon" href="<?= e(url('/assets/favicon.png')) ?>" type="image/png" sizes="96x96">
<link rel="apple-touch-icon" href="<?= e(url('/assets/apple-touch-icon.png')) ?>">
<script src="<?= e(url('/assets/theme.js')) ?>"></script>
<link rel="stylesheet" href="<?= e(url('/assets/app.css')) ?>">
<script src="<?= e(url('/assets/app.js')) ?>" defer></script>
</head>
<body>
<header class="top">
  <a class="brand" href="<?= e(url('/')) ?>">NERGmud <span>Two</span></a>
  <div class="top-right">
    <?php if ($player !== null): ?>
      <form method="post" action="<?= e(url('/logout')) ?>" class="logout">
        <?= csrf_field() ?>
        <span class="who"><?= e($player['name']) ?></span>
        <button type="submit" class="link">Log out</button>
      </form>
    <?php endif; ?>
    <button type="button" class="theme-toggle" id="theme-toggle" aria-label="Switch theme">
      <svg class="icon-moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>
      <svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="12" cy="12" r="4.5"/><path d="M12 2v2.5M12 19.5V22M2 12h2.5M19.5 12H22M4.9 4.9l1.8 1.8M17.3 17.3l1.8 1.8M4.9 19.1l1.8-1.8M17.3 6.7l1.8-1.8"/></svg>
    </button>
  </div>
</header>
<main>
  <?php foreach ($flashes as $f): ?>
    <p class="flash flash-<?= e($f['type']) ?>" role="status"><?= e($f['msg']) ?></p>
  <?php endforeach; ?>
  <?= $content ?>
</main>
</body>
</html>
