:root {
  --face: #c0c0c0;
  --light: #ffffff;
  --midlight: #dfdfdf;
  --shadow: #808080;
  --dark: #000000;
  --text: #000000;
  --desk: #008080;
  --title-a: #000080;
  --title-b: #1084d0;
  --title-off-a: #808080;
  --title-off-b: #b5b5b5;
  --link: #0000ee;
  --link-visited: #551a8b;
  --page: #ffffff;
  --ui-font: 'Microsoft Sans Serif', 'MS Sans Serif', Tahoma, 'Segoe UI', Arial, sans-serif;
  --page-font: 'Times New Roman', Times, 'Liberation Serif', serif;
  --raised: inset -1px -1px var(--dark), inset 1px 1px var(--light), inset -2px -2px var(--shadow), inset 2px 2px var(--midlight);
  --sunken: inset -1px -1px var(--light), inset 1px 1px var(--shadow), inset -2px -2px var(--midlight), inset 2px 2px var(--dark);
  --pressed: inset -1px -1px var(--light), inset 1px 1px var(--dark), inset -2px -2px var(--midlight), inset 2px 2px var(--shadow);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--desk);
  color: var(--text);
  font: 14px/1.35 var(--ui-font);
  -webkit-text-size-adjust: 100%;
}

img { display: block; }

h1, h2, p, ul { margin: 0; }

a { color: var(--link); -webkit-tap-highlight-color: transparent; }
a:visited { color: var(--link-visited); }
a:hover { color: #ff0000; }

:focus-visible {
  outline: 1px dotted var(--dark);
  outline-offset: -4px;
}

.desk {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding: 16px;
}

.desk-icon {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 96px;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 4px;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}
.desk-icon img { width: 32px; height: 32px; image-rendering: pixelated; }
.desk-icon span { padding: 1px 2px; }
.desk-icon:focus-visible { outline: none; }
.desk-icon:focus-visible span { background: var(--title-a); outline: 1px dotted #ff0; }
.desk-icon[hidden] { display: none; }

.win {
  width: min(900px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 3px;
  background: var(--face);
  box-shadow: var(--raised);
}
.win[hidden] { display: none; }

.win.is-max {
  position: fixed;
  inset: 0;
  width: auto;
  max-height: none;
}
.win.is-max .win-body { align-content: center; }

.title-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 2px 0 3px;
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  color: #fff;
  font-weight: bold;
  user-select: none;
}
.title-icon { width: 16px; height: 16px; image-rendering: pixelated; }
.title-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.title-buttons { display: flex; }

.cap {
  width: 20px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: var(--face);
  box-shadow: var(--raised);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.cap-close { margin-left: 2px; }
.cap:active { box-shadow: var(--pressed); }
.cap:active img { transform: translate(1px, 1px); }
.cap img { image-rendering: pixelated; }
.cap:focus-visible { outline-offset: -3px; }

.win-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "banner banner"
    "win sr"
    "sites sites";
  gap: 14px 12px;
  padding: 12px 10px 10px;
}

.banner {
  grid-area: banner;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--page);
  box-shadow: var(--sunken);
}
.banner-logo { width: 48px; height: 48px; flex: none; image-rendering: pixelated; }

h1 {
  font: bold 30px/1.05 var(--page-font);
  color: var(--title-a);
  letter-spacing: -0.01em;
}

.lede {
  margin-top: 4px;
  font: 16px/1.3 var(--page-font);
  max-width: 62ch;
  text-wrap: pretty;
}

.box {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 16px 10px 10px;
  border: 2px groove var(--light);
}
.box-win { grid-area: win; }
.box-sr { grid-area: sr; }
.box-sites { grid-area: sites; display: block; }

.box-title {
  position: absolute;
  top: -9px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  background: var(--face);
  font: bold 13px/16px var(--ui-font);
}
.box-title img { width: 16px; height: 16px; }

.shot {
  flex: none;
  width: 160px;
  height: 120px;
  border: 1px solid var(--dark);
  box-shadow: 1px 1px 0 var(--light);
  object-fit: cover;
}

.box-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.box-text p { text-wrap: pretty; }

.actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 12px;
  background: var(--face);
  box-shadow: var(--raised);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:visited, .btn:hover { color: var(--text); }
.btn small { font-size: 11px; color: #404040; }
.btn-default {
  font-weight: bold;
  outline: 1px solid var(--dark);
  outline-offset: -1px;
  box-shadow: inset -2px -2px var(--dark), inset 2px 2px var(--light), inset -3px -3px var(--shadow), inset 3px 3px var(--midlight);
}
.btn:active { box-shadow: var(--pressed); padding: 5px 11px 3px 13px; }
.btn-default:active { box-shadow: inset 0 0 0 1px var(--dark), inset 0 0 0 2px var(--shadow); }
.btn:focus-visible { outline: 1px dotted var(--dark); outline-offset: -5px; }

.sites {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 14px;
}
.sites li { display: grid; align-content: start; gap: 2px; min-width: 0; }
.sites a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  font: bold 16px/1.2 var(--page-font);
}
.sites a img { width: 16px; height: 16px; image-rendering: pixelated; }
.sites span { padding-left: 21px; font-size: 12px; color: #303030; }

.status-bar {
  display: flex;
  gap: 2px;
  margin-top: 2px;
  font-size: 12px;
}
.cell {
  padding: 2px 6px;
  box-shadow: inset -1px -1px var(--light), inset 1px 1px var(--shadow);
  white-space: nowrap;
}
.cell-wide { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

@media (max-height: 660px) {
  .shot { width: 112px; height: 84px; }
  .win-body { gap: 12px 10px; padding: 10px 8px 8px; }
}

@media (max-height: 540px) and (min-width: 721px) {
  .win-body {
    grid-template-columns: 1fr 1fr 0.8fr;
    grid-template-areas:
      "banner banner banner"
      "win sr sites";
  }
  .shot { display: none; }
  .sites { grid-template-columns: 1fr; }
  .lede { font-size: 14px; }
  h1 { font-size: 24px; }
}

@media (max-width: 720px), (max-height: 500px) {
  .desk { padding: 0; }
  .win {
    position: fixed;
    inset: 0;
    width: auto;
    max-height: none;
    padding: max(3px, env(safe-area-inset-top)) max(3px, env(safe-area-inset-right)) max(3px, env(safe-area-inset-bottom)) max(3px, env(safe-area-inset-left));
  }
  .cap-max { display: none; }
}

@media (max-height: 500px) and (min-width: 721px) {
  .banner { padding: 6px 12px; }
  .banner-logo { width: 32px; height: 32px; }
  .win-body { gap: 12px 10px; padding: 10px 8px 8px; }
  .box { padding: 14px 8px 8px; }
}

@media (max-width: 720px) {
  .win-body {
    grid-template-columns: 1fr;
    grid-template-areas: "banner" "win" "sr" "sites";
    align-content: start;
  }
  .shot { display: none; }
  .box-win .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .box-win .btn { flex-direction: column; gap: 0; padding: 4px 6px; white-space: normal; line-height: 1.2; }
  .box-win .btn:active { padding: 5px 5px 3px 7px; }
  .sites { grid-template-columns: 1fr; gap: 6px; }
  .sites li { grid-template-columns: auto 1fr; align-items: baseline; column-gap: 8px; }
  .sites span { padding-left: 0; }
  .status-bar .cell-wide { display: none; }
  .status-bar .cell:first-child { flex: 1; }
}

@media (max-width: 720px) and (min-width: 480px) {
  .win-body {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "banner banner" "win sr" "sites sites";
  }
}

@media (max-width: 479px) {
  .banner { padding: 8px 10px; gap: 10px; }
  .banner-logo { width: 32px; height: 32px; }
  h1 { font-size: 24px; }
  .lede { font-size: 14px; }
  .sites li { grid-template-columns: 1fr; }
  .sites span { padding-left: 21px; }
  .btn { flex: 1 1 auto; }
}

@media (max-width: 479px) and (max-height: 640px) {
  body { font-size: 13px; }
  .lede { display: none; }
  .banner { padding: 6px 10px; }
  .win-body { gap: 12px; padding: 10px 6px 6px; }
  .box { padding: 14px 8px 8px; }
  .box-text { gap: 8px; }
  .sites { gap: 4px; }
  .sites a { font-size: 15px; }
}
