/*
 * Offline shell styling: undoes the original "no phones" takeover, makes the
 * three-column desktop layout stack on small screens, and styles the nav.
 */

/* ---------- nav ---------- */

#upcNav {
  position: fixed;
  top: 6px;
  right: 6px;
  z-index: 9999;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #111;
}

#upcBar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 8px;
  background: rgba(245, 245, 245, 0.92);
  border: 1px solid #b4b4b4;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(3px);
}

#upcBar.upcOpen {
  border-radius: 14px 14px 0 0;
  border-bottom-color: transparent;
}

#upcClock {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: 0.02em;
  opacity: 0.85;
}

#upcStage {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.55;
}

#upcClicks {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  opacity: 0.7;
}

#upcToggle {
  border: none;
  background: transparent;
  font-size: 15px;
  line-height: 1;
  padding: 3px 6px;
  cursor: pointer;
  color: #333;
  border-radius: 10px;
}

#upcToggle:active {
  background: #ddd;
}

#upcPanel {
  width: 300px;
  max-width: calc(100vw - 16px);
  max-height: 72vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #f5f5f5;
  border: 1px solid #b4b4b4;
  border-radius: 10px 0 10px 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

#upcTabs {
  display: flex;
  position: sticky;
  top: 0;
  background: #e8e8e8;
  border-bottom: 1px solid #c8c8c8;
}

.upcTab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 4px;
  font-size: 11px;
  cursor: pointer;
  color: #555;
  border-bottom: 2px solid transparent;
}

.upcTab.on {
  color: #000;
  font-weight: 700;
  border-bottom-color: #444;
  background: #f5f5f5;
}

#upcBody {
  padding: 8px;
}

.upcLink {
  display: block;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  color: #111;
  text-decoration: none;
}

.upcLink.on {
  background: #e0e0e0;
  font-weight: 700;
}

.upcMeta {
  margin: 8px 0;
  padding: 6px 8px;
  background: #ededed;
  border-radius: 4px;
  color: #444;
  line-height: 1.5;
  font-size: 11px;
}

.upcRow {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 6px 0;
}

.upcRow input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 6px;
  font-size: 12px;
  border: 1px solid #bbb;
  border-radius: 3px;
  background: #fff;
}

.upcBtn {
  padding: 6px 10px;
  font-size: 11px;
  border: 1px solid #999;
  border-radius: 3px;
  background: #fff;
  color: #111;
  cursor: pointer;
  white-space: nowrap;
}

.upcBtn.ghost {
  background: transparent;
  color: #555;
}

.upcBtn.danger {
  border-color: #a33;
  color: #a33;
}

.upcNote {
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.5;
  color: #888;
}

.upcBtn:active {
  background: #ddd;
}

.upcFile {
  display: none;
}

.upcFooter {
  border-top: 1px solid #ddd;
  padding-top: 8px;
}

.upcEmpty {
  padding: 14px 4px;
  text-align: center;
  color: #888;
  font-style: italic;
}

.upcCp {
  border: 1px solid #d2d2d2;
  border-radius: 4px;
  background: #fff;
  padding: 6px 8px;
  margin-bottom: 6px;
}

.upcCpHead {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-weight: 700;
}

.upcCpName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcCpTime {
  font-variant-numeric: tabular-nums;
  color: #666;
  font-weight: 400;
}

.upcCpStats {
  color: #666;
  font-size: 10px;
  margin: 3px 0;
}

.upcTail {
  border-top: 1px solid #ddd;
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.6;
}

.upcTailRow {
  display: flex;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid #eee;
}

.upcTailT {
  font-variant-numeric: tabular-nums;
  color: #999;
  flex: none;
}

.upcTailA {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcTailRow.k-proj .upcTailA {
  font-weight: 700;
}
.upcTailRow.k-sys .upcTailA {
  color: #06c;
}
.upcTailRow.k-cheat .upcTailA {
  color: #c00;
}

/* ---------- mobile ---------- */

@media only screen and (max-width: 700px) {
  /* The original stylesheet hides the game below 700px. Put it back. */
  #page {
    display: block !important;
  }
  #mobile {
    display: none !important;
  }
}

@media only screen and (max-width: 900px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    margin: 0;
    padding: 6px 8px calc(24px + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }

  button,
  select,
  input {
    touch-action: manipulation;
  }

  #topDiv {
    padding-right: 110px; /* clear the nav pill */
  }

  #leftColumn,
  #middleColumn,
  #rightColumn {
    float: none;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
  }

  .projectButton,
  .projectButton:hover,
  .projectButton:active {
    width: 100%;
    height: auto;
    min-height: 60px;
    padding: 8px;
    text-align: left;
  }

  .button2 {
    font-size: 13px;
    padding: 7px 10px;
    margin: 2px 0;
  }

  #btnMakePaperclip {
    display: block;
    width: 100%;
    font-size: 17px;
    padding: 14px;
    margin-bottom: 8px;
  }

  canvas {
    width: 100%;
    max-width: 310px;
  }

  #swarmSlider {
    width: 45%;
  }

  #sliderLabelThink {
    left: 50%;
  }

  hr.short {
    width: 100%;
  }

  .toolTipText,
  .toolTipText2,
  .toolTipText3 {
    display: none;
  }
}

/* ---------- stages page ---------- */

body.upcPage {
  margin: 0;
  padding: 0 0 60px;
  background: #fafafa;
  color: #111;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.upcWrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px;
}

.upcWrap h1 {
  font-size: 22px;
  margin: 0 0 4px;
}

.upcWrap .sub {
  color: #666;
  font-size: 13px;
  margin: 0 0 20px;
}

.stage {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  margin-bottom: 16px;
  overflow: hidden;
}

.stage.current {
  border-color: #444;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.stage > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  background: #f0f0f0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.stage > summary::-webkit-details-marker {
  display: none;
}

.stage h2 {
  font-size: 15px;
  margin: 0;
}

.stage .blurb {
  color: #666;
  font-size: 12px;
  flex: 1 1 100%;
  margin: 0;
}

.here {
  font-size: 10px;
  font-weight: 700;
  background: #222;
  color: #fff;
  border-radius: 8px;
  padding: 2px 7px;
}

.stageBody {
  padding: 8px 14px 14px;
}

.stageNotes {
  font-size: 13px;
  color: #333;
  margin: 6px 0 14px;
  padding-left: 18px;
}

.stageNotes li {
  margin-bottom: 4px;
}

table.pj {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

table.pj th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  border-bottom: 1px solid #ddd;
  padding: 4px 6px;
}

table.pj td {
  border-bottom: 1px solid #f0f0f0;
  padding: 6px;
  vertical-align: top;
}

table.pj td.t {
  font-weight: 600;
  width: 34%;
}

table.pj td.c {
  color: #777;
  white-space: nowrap;
  width: 22%;
}

table.pj td.d {
  color: #555;
}

@media only screen and (max-width: 620px) {
  table.pj td.c {
    white-space: normal;
  }
  .upcWrap {
    padding: 18px 12px;
  }
}
