:root {
  color-scheme: light;
  --chrome: #f7f8fb;
  --chrome-2: #eef2f8;
  --line: #d9dde5;
  --line-strong: #c7cfdb;
  --text: #172033;
  --muted: #536173;
  --accent: #2473d4;
  --accent-2: #27c39f;
  --surface: #ffffff;
  --soft: #f4f7fb;
  --warn: #ffb454;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  overflow: hidden;
  color: var(--text);
  background: #e9edf5;
  font-family: "Segoe UI", Arial, sans-serif;
}
button, input { font: inherit; }
button {
  border: 1px solid var(--line-strong);
  background: linear-gradient(#fff, #eef2f8);
  color: var(--text);
  border-radius: 6px;
  min-height: 32px;
  padding: 0 12px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); color: #0f4b96; }
button:disabled { opacity: .45; cursor: default; color: var(--muted); }

.browser-shell {
  width: 100vw;
  height: 100vh;
  min-width: 980px;
  display: grid;
  grid-template-rows: auto 38px minmax(0, 1fr) 24px;
  background: var(--surface);
  border: 1px solid #d3d9e5;
}

.toolbar {
  display: grid;
  grid-template-columns: auto auto auto auto minmax(240px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  padding: 8px;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
}
.address-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
#address-box {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(23, 32, 51, .06);
}
#address-box:focus { outline: 2px solid rgba(36, 115, 212, .22); border-color: var(--accent); }

.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  align-items: end;
  padding: 5px 8px 0;
  background: var(--chrome-2);
  border-bottom: 1px solid var(--line);
}
.tab {
  min-width: 172px;
  max-width: 260px;
  height: 33px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  background: #e8edf5;
  color: var(--muted);
  cursor: pointer;
}
.tab.active { background: #fff; color: var(--text); box-shadow: inset 0 3px 0 var(--accent); }
.tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-close {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-weight: 800;
  color: var(--muted);
}
.tab:hover .tab-close { background: rgba(83, 97, 115, .14); color: var(--text); }

.viewport {
  position: relative;
  overflow: auto;
  min-height: 0;
  background:
    radial-gradient(circle at 20% 12%, rgba(36, 115, 212, .1), transparent 28%),
    linear-gradient(145deg, #f8fbff, #edf3fb 48%, #f7fafc);
  padding: 34px;
}
.page-card {
  min-height: calc(100vh - 178px);
  border: 1px solid rgba(199, 207, 219, .95);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(23, 32, 51, .12);
  overflow: hidden;
}
.site-hero {
  padding: 42px;
  background: linear-gradient(135deg, #0c2444, #2473d4 62%, #27c39f);
  color: #fff;
}
.site-hero .kicker { margin: 0 0 10px; text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 800; opacity: .78; }
.site-hero h1 { margin: 0; font-size: clamp(34px, 6vw, 64px); line-height: .96; letter-spacing: -.04em; }
.site-hero p { max-width: 610px; margin: 16px 0 0; line-height: 1.6; color: rgba(255, 255, 255, .86); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-actions span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .24);
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 22px;
  padding: 28px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  background: var(--surface);
}
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.panel p { margin: 0; color: var(--muted); line-height: 1.55; }
.panel-list { display: grid; gap: 12px; margin-top: 16px; }
.panel-item { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; align-items: center; }
.badge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(36, 115, 212, .1);
  color: var(--accent);
  font-weight: 900;
}
.panel-item strong { display: block; }
.panel-item span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

.search-preview {
  display: grid;
  gap: 12px;
}
.result-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #f8fbff;
}
.result-card strong { color: #174d93; }
.result-card p { margin: 5px 0 0; font-size: 13px; }

.permission-dialog {
  position: absolute;
  top: 86px;
  right: 54px;
  width: min(320px, calc(100% - 52px));
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(23, 32, 51, .24);
  z-index: 4;
}
.permission-dialog h2 { margin: 0 0 8px; font-size: 17px; }
.permission-dialog p { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }
.permission-dialog div { display: flex; justify-content: flex-end; gap: 8px; }
.permission-dialog button:last-child { background: var(--accent); color: #fff; border-color: var(--accent); }

.statusbar {
  display: flex;
  align-items: center;
  padding: 0 8px;
  background: var(--chrome);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
#status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 980px) {
  body { overflow: auto; }
  .browser-shell { min-width: 0; height: auto; min-height: 100vh; grid-template-rows: auto auto minmax(0, 1fr) 24px; }
  .toolbar { grid-template-columns: repeat(4, auto); }
  #address-box { grid-column: 1 / -1; order: 2; }
  .toolbar button:nth-last-child(2), .toolbar button:last-child { order: 3; }
  .viewport { padding: 18px; }
  .content-grid { grid-template-columns: 1fr; padding: 18px; }
}

@media (max-width: 560px) {
  .toolbar { grid-template-columns: repeat(2, 1fr); }
  .toolbar button { width: 100%; }
  #address-box { min-width: 0; }
  .tabs { padding-left: 6px; }
  .tab { min-width: 148px; }
  .viewport { padding: 10px; }
  .site-hero { padding: 28px 20px; }
  .panel { padding: 16px; }
  .permission-dialog { top: 70px; right: 16px; }
}