<?php
$cfg = app_config();
$appName = (string)($cfg['app_name'] ?? '光年验证');
$titleText = (string)($title ?? '卡密查询');
$subtitleText = (string)($subtitle ?? '查询卡密状态、激活情况、到期时间、设备占用与绑定设备');
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title><?= e($titleText) ?> - <?= e($appName) ?></title>
  <style>
    :root {
      --bg-start: #f8fbff;
      --bg-end: #eef4ff;
      --card: rgba(255, 255, 255, 0.92);
      --text: #172033;
      --shadow: 0 20px 50px rgba(37, 99, 235, 0.10);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      color: var(--text);
      font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
      background:
        radial-gradient(860px 420px at 100% -10%, rgba(99, 102, 241, 0.14), transparent 70%),
        radial-gradient(780px 360px at -10% 100%, rgba(59, 130, 246, 0.12), transparent 70%),
        linear-gradient(145deg, var(--bg-start), var(--bg-end));
    }

    .query-shell {
      width: min(1060px, 94vw);
      margin: 34px auto;
    }

    .query-hero {
      margin-bottom: 18px;
      padding: 26px 28px;
      border: 1px solid rgba(255,255,255,0.55);
      border-radius: 26px;
      background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.62));
      box-shadow: var(--shadow);
      backdrop-filter: blur(12px);
    }

    .query-title {
      margin: 0;
      font-size: 30px;
      line-height: 1.18;
      font-weight: 800;
      letter-spacing: .5px;
    }

    .query-subtitle {
      margin: 10px 0 0;
      color: #64748b;
      font-size: 14px;
      line-height: 1.7;
    }

    .query-panel {
      border: 1px solid rgba(255,255,255,0.7);
      border-radius: 24px;
      padding: 24px;
      background: var(--card);
      box-shadow: var(--shadow);
      backdrop-filter: blur(10px);
    }

    .alert {
      margin-bottom: 12px;
      padding: 12px 14px;
      border-radius: 14px;
      border: 1px solid transparent;
      font-size: 14px;
      line-height: 1.6;
    }

    .alert-success {
      color: #166534;
      background: #ecfdf5;
      border-color: #bbf7d0;
    }

    .alert-danger {
      color: #991b1b;
      background: #fef2f2;
      border-color: #fecaca;
    }

    @media (max-width: 768px) {
      .query-shell {
        width: 95vw;
        margin: 18px auto;
      }

      .query-hero {
        padding: 20px;
        border-radius: 20px;
      }

      .query-panel {
        padding: 18px;
        border-radius: 20px;
      }

      .query-title {
        font-size: 24px;
      }
    }
  </style>
</head>
<body>
  <div class="query-shell">
    <section class="query-hero">
      <h1 class="query-title"><?= e($titleText) ?></h1>
      <p class="query-subtitle"><?= e($subtitleText) ?></p>
    </section>

    <section class="query-panel">
      <?php if ($msg = flash('success')): ?>
        <div class="alert alert-success"><?= e((string)$msg) ?></div>
      <?php endif; ?>
      <?php if ($msg = flash('error')): ?>
        <div class="alert alert-danger"><?= e((string)$msg) ?></div>
      <?php endif; ?>

      <?php include __DIR__ . '/../' . $view . '.php'; ?>
    </section>
  </div>
</body>
</html>
