/* ===== Base — from news.ycombinator.com/news.css ===== */

body {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 10pt;
  color: #828282;
}

td {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 10pt;
  color: #828282;
}

a:link    { color: #000000; text-decoration: none; }
a:visited { color: #828282; text-decoration: none; }

/* ===== Layout ===== */

#hnmain {
  background-color: #f6f6ef;
  min-width: 796px;
}

/* ===== Header bar ===== */

.pagetop {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 10pt;
  color: #222222;
  line-height: 12px;
}

.pagetop a:link,
.pagetop a:visited { color: #000000; }

.hnname {
  margin-left: 1px;
  margin-right: 5px;
}

.topsel a:link,
.topsel a:visited { color: #ffffff; }

/* ===== Story list ===== */

.rank {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 10pt;
  color: #828282;
  display: inline-block;
  width: 18px;
  text-align: right;
  margin-right: 3px;
  vertical-align: bottom;
  line-height: 16px;
}

.title {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 10pt;
  color: #828282;
  overflow: hidden;
}

.title a { word-break: break-word; }

.subtext {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 7pt;
  color: #828282;
}

.subtext td {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 7pt;
  color: #828282;
}

.subtext a:link,
.subtext a:visited { color: #828282; }

.subtext a:hover { text-decoration: underline; }

.sitebit { font-size: 8pt; }
.sitestr { color: #828282; }

/* ===== Comments — table-based, matching HN exactly ===== */

.comment-tree {
  margin: 0;
  padding: 0;
}

.comtr {
  /* each comment row */
}

.ind {
  /* indentation cell — width set by spacer img */
}

.votelinks {
  vertical-align: top;
}

.votearrow {
  width: 10px;
  height: 10px;
  border: 0px;
  margin: 3px 2px 6px;
  background: url("https://news.ycombinator.com/triangle.svg") no-repeat;
  background-size: 10px;
  cursor: default;
}

.default {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 10pt;
  color: #828282;
}

.default p {
  margin-top: 8px;
  margin-bottom: 0px;
}

.comhead {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 8pt;
  color: #828282;
}

.comhead a:link,
.comhead a:visited { color: #828282; text-decoration: none; }

.comhead a:hover { text-decoration: underline; }

.hnuser { color: #000; text-decoration: none; }
.hnuser:visited { color: #000; }

.togg {
  color: #828282;
  cursor: pointer;
  font-size: 7pt;
}

.commtext {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 9pt;
  color: #000;
  max-width: 1215px;
  overflow-wrap: anywhere;
}

.commtext a:link,
.commtext a:visited { text-decoration: underline; }

.commtext p {
  margin-top: 8px;
  margin-bottom: 0px;
}

.commtext pre {
  overflow: auto;
  padding: 2px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment {
  /* wrapper for commtext */
}

/* Collapse support */
.comtr.collapsed .comment,
.comtr.collapsed .commtext {
  display: none;
}

.nosee {
  visibility: hidden;
  pointer-events: none;
  cursor: default;
}

.yclinks {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 8pt;
  color: #828282;
}

/* ===== Game layer ===== */

.flag-toggle {
  color: #828282 !important;
  cursor: pointer;
  text-decoration: none;
}

.flag-toggle:hover { text-decoration: underline !important; }

/* Flagged state */
.flag-toggle.flagged {
  color: #ff6600 !important;
}

.comtr.flagged .commtext {
  background: rgba(255, 102, 0, 0.06);
  padding-left: 4px;
  border-left: 2px solid #ff6600;
}

/* ===== Reveal states ===== */

.comtr.revealed-correct .commtext {
  background: rgba(0, 128, 0, 0.06);
  padding-left: 4px;
  border-left: 2px solid #3c963c;
}

.comtr.revealed-missed .commtext {
  background: rgba(255, 0, 0, 0.06);
  padding-left: 4px;
  border-left: 2px solid #c00;
}

.comtr.revealed-fp .commtext {
  background: rgba(255, 152, 0, 0.06);
  padding-left: 4px;
  border-left: 2px solid #ff9800;
}

/* Persona/FP badges */
.persona-badge {
  display: inline-block;
  font-size: 7pt;
  padding: 0px 4px;
  margin-left: 4px;
  border-radius: 2px;
  font-weight: normal;
  letter-spacing: 0.3px;
}

.persona-badge.caught { background: #3c963c; color: #fff; }
.persona-badge.missed { background: #c00; color: #fff; }

.fp-badge {
  display: inline-block;
  font-size: 7pt;
  padding: 0px 4px;
  margin-left: 4px;
  background: #ff9800;
  color: #fff;
  border-radius: 2px;
}

/* ===== Challenge banner + nav ===== */

.challenge-banner {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 8pt;
  color: #828282;
  padding: 2px 0;
}

.challenge-nav {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 8pt;
  color: #828282;
  padding: 2px 0;
}

.challenge-nav-link {
  color: #828282 !important;
  text-decoration: none;
  margin-right: 12px;
}

.challenge-nav-link:hover { text-decoration: underline; }

.challenge-nav-disabled {
  color: #ddd;
  margin-right: 12px;
}

/* ===== Comment tree padding for reveal bar ===== */

.comment-tree {
  padding-bottom: 50px;
}

/* ===== Reveal bar ===== */

.reveal-bar {
  position: sticky;
  bottom: 0;
  background: #f6f6ef;
  border-top: 1px solid #ff6600;
  padding: 6px 12px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  z-index: 100;
  font-size: 8pt;
}

.reveal-btn {
  background: #ff6600;
  color: #fff;
  border: none;
  padding: 4px 14px;
  font-size: 8pt;
  cursor: pointer;
  font-family: Verdana, Geneva, sans-serif;
}

.reveal-btn:hover { background: #e55a00; }
.reveal-btn:disabled { opacity: 0.7; cursor: default; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.flagged-count {
  font-size: 8pt;
  color: #000;
  margin-right: 10px;
}

/* ===== Score popup ===== */

.score-overlay {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: #f6f6ef;
  border: 2px solid #ff6600;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.score-overlay.visible { display: block; }

.score-card {
  text-align: center;
  padding: 20px 30px;
}

.grade {
  font-size: 48pt;
  font-weight: bold;
  line-height: 1;
  margin-bottom: 4px;
}

.grade-s { color: #ff6600; }
.grade-a { color: #3c963c; }
.grade-b { color: #36c; }
.grade-c { color: #828282; }
.grade-d { color: #c00; }
.grade-f { color: #ccc; }

.grade-label {
  font-size: 8pt;
  color: #828282;
  margin-bottom: 16px;
  display: block;
}

.score-card h2 { display: none; }

.score-table {
  margin: 0 auto 16px;
  font-size: 9pt;
  color: #000;
}

.score-table td {
  padding: 2px 10px;
  text-align: left;
}

.score-table td:first-child {
  color: #828282;
  text-align: right;
}

.score-actions { margin-top: 12px; }

.share-btn {
  background: #ff6600;
  color: #fff;
  border: none;
  padding: 5px 18px;
  font-size: 8pt;
  cursor: pointer;
  font-family: Verdana, Geneva, sans-serif;
}

.share-btn:hover { background: #e55a00; }

.next-link, .back-link {
  display: inline-block;
  margin: 8px 6px 0;
  color: #828282 !important;
  font-size: 8pt;
  text-decoration: underline;
}

.close-overlay {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 12pt;
  color: #828282;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}

/* ===== Front page thread status + aggregate ===== */

.thread-status { font-size: 7pt; }
.aggregate-score { padding: 0 0 8px; }

/* ===== Accessibility — focus styles ===== */

.flag-toggle:focus-visible,
.togg:focus-visible,
.reveal-btn:focus-visible,
#share-btn:focus-visible {
  outline: 2px solid #ff6600;
  outline-offset: 2px;
}

a:focus-visible {
  outline: 2px solid #ff6600;
  outline-offset: 1px;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #ff6600;
  color: #fff;
  padding: 4px 8px;
  font-size: 8pt;
  z-index: 200;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* ===== Responsive — from HN news.css ===== */

@media only screen and (min-width: 300px) and (max-width: 750px) {
  #hnmain { width: 100% !important; min-width: 0; }
  body { padding: 0; margin: 0; width: 100%; }
  td { height: inherit !important; }
  .title { font-size: 11pt; line-height: 14pt; }
  .subtext { font-size: 9pt; }
  span.pagetop { display: block; margin: 3px 5px; font-size: 12px; line-height: normal; }
  span.pagetop b { display: block; font-size: 15px; }
  .votearrow { transform: scale(1.3, 1.3); margin-right: 6px; }
  .score-card { padding: 16px 10px; }
  .grade { font-size: 60pt; }
}
