/* Shared layout for every page build.py writes (not site/play/). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
a { text-decoration: none; }
/* !important: the 2006 markup sets text-decoration inline on most links */
a:hover { text-decoration: underline !important; }
/* the old pages set no font: Times for Latin, the system CJK face for the rest (lang=zh-Hant alone would change both) */
body { font-family: "Times New Roman", Times, "PingFang TC", "Heiti TC", PMingLiU, serif; }
main { display: block; min-width: 0; overflow-wrap: anywhere; }
main img { max-width: 100%; height: auto; }
main table { max-width: 100%; }
/* the pages were laid out in quirks mode, which drops these margins inside table cells */
main td > :first-child { margin-top: 0; }
main td > :last-child { margin-bottom: 0; }
main img[src$="shim.gif"] { display: block; }

.play { text-align: center; margin: 28px 0; }
.play-button {
  display: inline-block; padding: 14px 40px; border-radius: 999px;
  background: #1c4fd8; color: #fff; font-size: 22px; letter-spacing: .15em;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .15);
}
.play-button:hover { background: #2a5ef0; text-decoration: none !important; }

/* Main site: the old 640px shell table, rebuilt with grid */
body.site { margin: 0; padding: 13px 8px 24px; background: #d4e8fb url(image/background.gif); }
.frame { max-width: 643px; margin: 0 auto; border: 1px solid #000; border-right-width: 2px; background: #ccc; }
.masthead .banner { display: block; background: #eee; border-bottom: 1px solid #000; padding: 2px 0 3px; margin-bottom: 3px; }
.masthead .banner img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.ticker { margin: 0 0 3px; padding: 2px 8px; background: #fff; border-block: 1px solid #000; color: #0066cc; text-align: center; }
.cols { display: grid; grid-template-columns: 149px minmax(0, 1fr); border-top: 1px solid #000; background: #fff; }
.menu { padding: 16px; border-right: 1px solid #000; line-height: 22px; }
.menu h2 { margin: 0; font-size: inherit; color: #0066cc; }
.menu ul { margin: 0; padding: 0 0 0 9px; list-style: none; }
.menu section + section { margin-top: 22px; }
.menu section:first-child { margin-bottom: 44px; }
.menu a { color: #0066cc; }
.site main { padding: 8px 9px 24px; }

@media (max-width: 600px) {
  /* pixel widths sized for the 478px frame; let them fit the phone instead */
  main table:not([width$="%"]), main td:not([width$="%"]) { width: auto; }
  body.site { padding: 6px; }
  .cols { display: block; }
  .menu { padding: 6px 12px; border-right: 0; border-bottom: 1px solid #000; line-height: 30px; }
  .menu section { display: flex; align-items: baseline; gap: 0 10px; margin: 0 !important; }
  .menu h2 { flex: none; width: 4.5em; }
  .menu ul { display: flex; flex-wrap: wrap; gap: 0 14px; padding: 0; }
}

/* 天諜: black, white text nav over a silver rule (was the top frame) */
body.sf { margin: 0; background: #000; color: #fff; }
.sf-head { padding: 8px 8px 0; }
.sf-head nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 1.6em; padding-bottom: 8px; border-bottom: 1px solid silver; }
.sf-head a { color: #fff; }
.sf-head .home { color: #999; }
.sf main { padding: 8px; }
@media (max-width: 600px) {
  /* nested blockquotes indent 160px a side; floated 320px shots leave a sliver for text */
  .sf main blockquote blockquote { margin-inline: 0; }
  .sf main img[align] { float: none; display: block; margin: 8px auto; }
}

/* 三項鐵人: grey button bar + banner (was the menu frame), white page with the watch */
body.te { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: #e6e6e6; }
.te-head { position: relative; padding: 8px 8px 14px; }
.te-head nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 55px; }
.te-head nav img { display: block; }
.te-head nav a:hover { position: relative; top: 1px; left: 1px; }
.bestview { position: absolute; top: 8px; right: 8px; margin: 0; font-size: 9pt; color: #3366cc; }
.te-banner { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.te main { flex: 1; padding: 8px; border: 2px solid #0099ff; background: #fff url(game/te/image/bg_watch.jpg) no-repeat fixed 84% 100%; }
@media (max-width: 1100px) { .bestview { display: none; } }
@media (max-width: 600px) {
  .te-head nav { gap: 6px 12px; }
  .te main { background-size: 150px auto; }
  /* screenshot grid and title art: one per row instead of thumbnails */
  .te main tr:has(img) > td { display: block; width: auto; height: auto; }
  .te main td img { float: none; display: block; margin: 8px auto; }
  .te main table[align] { float: none; width: 100%; }
}

/* 時空方域: dark tiled background, title + nav at the top of every page */
body.sadc { margin: 0; padding: 0 8px 8px; background: #000 url(game/sa-dc/image/background.gif); color: #fff; }
.sadc-head { text-align: center; }
.sadc-head .t1 { margin: 16px 0; font: bold x-large 華康仿宋體, serif; }
.sadc-head .t2 { margin: 16px 0; font-weight: bold; font-size: large; }
.sadc-head nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 1.4em; font-size: small; }
.sadc-head nav a { color: #fff; }
.sadc-head nav strong { font-size: medium; }
.sadc-head .home { color: #bbb; }
