/* Centre the Competition column; the underline follows only the tab buttons. */
/*
 * The strip starts where every other subtab strip starts, at the panel's own
 * left edge. The cards below it keep their 58rem column and stay centred, as
 * the Account form card does under its own strip: what is held to a reading
 * width is the content, not the controls over it.
 */
.competition-tabs-wrap { display: flow-root; }
#competition-tabs { width: fit-content; max-width: 100%; }
#panel-competition .card { margin-top: 1rem; }
/* Tab rows own the gap; their first card or text must not add another. */
#panel-competition [role="tabpanel"] > .card:first-child,
#panel-competition-submissions > .card:first-child,
#panel-competition [id^="panel-competition-question-round-"] > .card:first-child { margin-top: 0; }
#panel-competition h2 { margin-top: 0; }
#panel-competition .card, #competition-status, #competition-retry-wrap,
#competition-leaderboard-note, #competition-rank-status { max-width: 58rem; margin-inline: auto; }
#competition-rounds-area:not([hidden]) { display: grid; grid-template-columns: minmax(0, min(44%, 28rem)) minmax(0, 1fr); gap: 1rem; align-items: start; }
#competition-chart { min-width: 0; margin: 0 0 1rem; }
.competition-round-work { min-width: 0; }
.competition-chart-drawing { width: 85.5%; max-width: 23.94rem; margin-inline: auto; }
.competition-chart-drawing svg { display: block; width: 100%; height: auto; }
@media (max-width: 800px) {
  #competition-rounds-area:not([hidden]) { grid-template-columns: 1fr; gap: 0; }
}
/*
 * The prizes as a band rather than three labels in a row.
 *
 * Sixty thousand rupees is the reason anybody reads the rest of this
 * page, and it was set in body colour with no rule around it, occupying
 * the left third of a very wide card. Equal thirds inside a tinted strip
 * give the three a shape, and the ordinals sit above the amounts so the
 * podium reads first, second, third in one pass.
 */
.competition-prizes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line, #dcdcdc);
  border-radius: .6rem;
  background: var(--surface-soft, rgba(0, 0, 0, .02));
}
.competition-prizes p { margin: 0; min-width: 0; }
.competition-prizes span, .competition-prizes strong { display: block; }
.competition-prizes span {
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft, #666);
}
.competition-prizes strong { font-size: 1.7rem; line-height: 1.15; margin-top: .15rem; }
/* The first prize leads, so it is the one that carries the accent. */
.competition-prizes p:first-child strong { color: var(--green-deep, #1b5e20); }
.competition-scroll { overflow-x: auto; }
#competition-leaderboard-note { margin: 1rem auto .35rem; }
/* The phase strip leads the board as the round strip leads a round. */
#panel-competition-leaderboard > :first-child { margin-top: 0; }
/*
 * The table's own `text-align: left` never took effect and is gone:
 * styles.css centres every cell with `th, td { text-align: center }`,
 * which is set on the cell and so beats anything inherited from the
 * table, whatever the specificity. Left-aligning these two tables to
 * honour the dead declaration was the wrong way round - the whole app
 * centres table values, a rule test-browser-tables.py holds over 65
 * tables, and the competition is not the place to be the exception.
 */
#panel-competition table { width: 100%; border-collapse: collapse; }
/* A long public name held the whole board open on a phone: nowrap made
   the participant column as wide as the longest name, and the scores
   scrolled off behind it. */
#competition-leaderboard td:nth-child(2) { white-space: normal; min-width: 8rem; text-transform: capitalize; }
#panel-competition th, #panel-competition td { padding: .7rem .8rem; white-space: nowrap; border-bottom: 1px solid var(--border, #ddd); }
.competition-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0; }
.competition-toolbar h2, .competition-toolbar h3 { margin: 0; }
.competition-form { display: grid; gap: 1rem; margin-top: 1rem; }
.competition-form label { display: grid; gap: .35rem; }
.competition-form input, .competition-form textarea, .competition-form select { width: 100%; box-sizing: border-box; }
.competition-form textarea { min-height: 7rem; resize: vertical; font: inherit; }
.competition-form button { justify-self: end; }
.competition-form input[type=checkbox] { width: auto; }
.competition-form .competition-check { display: flex; align-items: center; }
.competition-birth-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.competition-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.competition-diagrams { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.competition-diagrams figure { margin: 0; min-width: 0; }
.competition-diagrams svg { width: 100%; height: auto; }
.competition-round-status { font-weight: 600; }
.competition-entry { padding: 1rem 0; }
.competition-entry-heading { display: grid; grid-template-columns: minmax(0, 1fr) 9rem; gap: 1rem; align-items: center; }
.competition-entry-heading h4 { margin: 0; overflow-wrap: anywhere; }
.competition-entry-heading .field-note { text-align: right; }
.competition-entry-content h4 { margin: 0 0 .5rem; }
.competition-entry-content p { margin: 0 0 1.25rem; }
.competition-entry-content p:last-child { margin-bottom: 0; }
/*
 * The round area's status line is the one piece of this tab that speaks
 * outside a card - the round cards are built by the script and there is
 * nothing to hold a message when no round has rendered. It gets the
 * card's own surface rather than sitting on the page gradient with its
 * first character against the left edge.
 */
#competition-status {
  margin: 1rem 0;
  padding: .85rem 1.1rem;
  border: 1px solid var(--line, #dcdcdc);
  border-radius: .6rem;
  background: var(--surface, #fff);
}
#competition-status:empty { display: none; }
@media (max-width: 600px) {
 .competition-birth-fields, .competition-diagrams { grid-template-columns: 1fr; }
 /*
  * One prize a line on a narrow screen. Three columns put ₹30,000 in
  * about a hundred pixels, and wrapping two-then-one broke the podium
  * into an orphaned third.
  */
 .competition-prizes { grid-template-columns: 1fr; gap: .9rem; padding: 1rem; }
 .competition-prizes strong { font-size: 1.5rem; }
 .competition-prizes p { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
 .competition-prizes span, .competition-prizes strong { display: inline-block; margin-top: 0; }
}

.competition-dates { display: grid; grid-template-columns: auto 1fr; gap: .65rem 1.5rem; }
.competition-dates dt { font-weight: 600; }
.competition-dates dd { margin: 0; }
@media (max-width: 600px) {
 .competition-dates { grid-template-columns: 1fr; gap: .3rem; }
 .competition-dates dd { margin-bottom: .65rem; }
}


/*
 * The display rule has to yield to [hidden], which the script sets once
 * there is only one page. A bare class with display:flex outranks the
 * browser's own [hidden] { display: none }, so the bar stayed on screen
 * reading "Page 1 of 1" with every control in it disabled - the fix was
 * in the script all along and the stylesheet was quietly undoing it.
 */
.competition-pagination { display: flex; justify-content: center; align-items: center; gap: .4rem; margin-top: 1.25rem; }
.competition-pagination[hidden] { display: none; }
.competition-pagination button { width: 2.25rem; min-width: 2.25rem; height: 2.25rem; padding: 0; font-size: 1.3rem; }
.competition-pagination label { display: flex; align-items: center; gap: .35rem; margin: 0; }
.competition-pagination input { width: 3.5rem; min-width: 0; margin: 0; padding: .4rem; text-align: center; }
.competition-pagination > span { white-space: nowrap; }
.competition-page-count { text-align: center; color: var(--ink-soft); font-size: .9rem; }
/* A column of form fields reads at 48rem however wide the window is. The
   invoices table is the exception and lifts the cap for itself. */
.account-card { margin-top: 0; max-width: 48rem; margin-inline: auto; }
.account-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; }
.account-heading h2, .account-heading p { margin: 0; }
.account-heading p { font-size: .9rem; }
.account-card fieldset { border: 0; padding: 0; margin: 1.5rem 0 0; min-width: 0; }
.account-card label { display: block; margin-top: 1rem; margin-bottom: .35rem; }
.account-card input { width: 100%; box-sizing: border-box; }
#account-name, #account-nickname { text-transform: capitalize; }

.account-card #account-email[readonly] { color: var(--ink-soft); background: var(--paper); border-color: var(--line); }
.account-social-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1.25rem; }
.account-social-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr) 2.5rem; align-items: center; gap: .5rem; margin-top: .65rem; }
.account-social-row select, .account-social-row input { width: 100%; min-width: 0; margin: 0; }
.account-social-row button { padding: .4rem; font-size: 1.2rem; }
@media (max-width: 500px) {
 .account-social-row { grid-template-columns: minmax(0, 1fr) 2.5rem; }
 .account-social-row select { grid-column: 1; grid-row: 1; }
 .account-social-row input { grid-column: 1; grid-row: 2; }
 .account-social-row button { grid-column: 2; grid-row: 1 / 3; }
}

/* Keep the opening notice prominent and the question card compact. */
.competition-question { font-size: 1.1rem; line-height: 1.5; margin: .9rem 0 1.25rem; }
.competition-round.card { padding: 1rem 1.25rem; }
.competition-round.card .competition-question { font-size: 1rem; margin: 0; }
/*
 * The state as a badge rather than bold text. "Open for answers" was
 * font-weight 600, exactly what the Opens and Closes labels an inch
 * above it are set in, so it read as a fourth date label whose value
 * had gone missing.
 */
.competition-round-status {
  display: inline-block;
  margin: 1.1rem 0 0;
  padding: .3rem .75rem;
  border: 1px solid var(--line, #dcdcdc);
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  background: var(--surface-soft, rgba(0, 0, 0, .03));
  color: var(--ink-soft, #555);
}
.competition-round-status[data-state="open"] {
  border-color: var(--green-deep, #1b5e20);
  color: var(--green-deep, #1b5e20);
  background: rgba(27, 94, 32, .07);
}
.competition-round-status[data-state="published"] {
  border-color: var(--green-deep, #1b5e20);
  color: var(--green-deep, #1b5e20);
}
.competition-round-schedule { margin: 1rem 0 .75rem; }
.competition-round-notice { margin: 0 0 .4rem; font-weight: 600; }
.competition-round details[data-final-answer] { margin-top: 1.25rem; }
.competition-round details[data-final-answer] summary { cursor: pointer; font-weight: 600; }

/*
 * Marks and the grader's note. "Your marks: 8 / 10" was a sentence of
 * body text under the official solution, which is a quiet way to print
 * the one line a participant came back for.
 */
.competition-marks {
  margin-top: 1.5rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line, #dcdcdc);
  border-radius: .6rem;
  background: var(--surface-soft, rgba(0, 0, 0, .02));
}
.competition-score { display: flex; align-items: baseline; gap: .9rem; margin: 0; }
.competition-score span { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft, #666); }
.competition-score strong { font-size: 1.7rem; line-height: 1.15; color: var(--green-deep, #1b5e20); }
.competition-feedback { margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line, #dcdcdc); }
.competition-feedback span { display: block; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft, #666); }
.competition-feedback p { margin: .35rem 0 0; }

/*
 * The answer card, below the chart.
 *
 * The two boxes are not the same piece of work: the answer is a
 * sentence and the explanation is the body of the entry, and they were
 * set to the same 7rem. The count below each stays empty until the last
 * fifth of the limit.
 */
.competition-answer h3 { margin: 0 0 .25rem; }
.competition-form textarea[name="answer"], .competition-answer textarea[name="preview-answer"] { min-height: 22rem; width: 100%; }
.competition-count { margin: -.5rem 0 0; text-align: right; font-variant-numeric: tabular-nums; }
.competition-count[data-full="true"] { color: var(--red, #9b2c2c); }
.competition-count:empty { display: none; }

/*
 * Profiles are a column of their own on the leaderboard, so the links
 * sit under one heading instead of trailing a participant's name.
 */
#panel-competition td.competition-social { white-space: normal; }
.competition-social a { color: var(--green); }
.competition-social a + a { margin-inline-start: .55rem; }
.competition-round h4 { margin: 1.6rem 0 0; }

/*
 * Round setup and submission review live in separate admin subtabs.
 */
.competition-admin-card h3 { margin-top: 0; }
.competition-setup-form { margin-top: 0; }
.competition-setup-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.competition-setup-heading label { margin: 0; flex-shrink: 0; }
.competition-setup-heading .field-note { margin: 0; text-align: right; min-width: 0; }
.competition-admin-card .competition-toolbar { margin-top: 0; }
.competition-entry .competition-pagination { margin-top: 1rem; }

/*
 * The help list and the terms. Both are read as a list rather than as
 * prose, so they are set as one, at the card's measure.
 */
.competition-help, .competition-terms { margin: 0 0 1.5rem; padding-left: 1.4rem; }
.competition-help li, .competition-terms li { margin-bottom: .6rem; }
.competition-help li:last-child, .competition-terms li:last-child { margin-bottom: 0; }
.competition-help a { color: var(--green); }
.competition-reference-notes a { color: var(--green); }

/*
 * A question only the administrator can see yet. Ruled off down its
 * left so it is plainly a draft standing in the place the real one
 * will take, with the condition for its release underneath.
 */
.competition-question-draft {
  border-left: 3px solid var(--line, #dcdcdc);
  padding-left: .9rem;
  margin-bottom: .45rem;
}
.competition-question-note { margin: 0 0 1.25rem; }

.competition-preview-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; font-size: .9rem; }
.competition-preview-choice { background: none; border: 0; border-radius: 0; box-shadow: none; padding: .15rem 0; min-height: 0; font: inherit; color: var(--ink-soft); cursor: pointer; }
.competition-preview-choice:hover, .competition-preview-choice[aria-pressed="true"] { color: var(--green); text-decoration: underline; text-underline-offset: .25rem; }
.competition-preview-choice:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.competition-reference-notes { margin: 1rem 0; }
#competition-rounds-content [role="tabpanel"] > :first-child { margin-top: 0; }
.competition-reference-notes > p:first-child { margin-top: 0; }
/* The three dates share the round column with the charts, so they fold by
   the space they have rather than by the width of the window. */
.competition-setup-dates { display: grid; grid-template-columns: repeat(auto-fit,minmax(12rem,1fr)); gap: 1rem; }
.competition-setup-dates input { width: 100%; min-width: 0; }

/*
 * No calendar button on the round dates. The field is typed into
 * segment by segment, and the picker glyph was a second control for
 * the same two values sitting inside the box.
 */
.competition-setup-dates input::-webkit-calendar-picker-indicator { display: none; }
/* An empty status line should not hold a row open in the grid. */
.competition-form .field-note:empty { display: none; }

/* The shared Kundali leads Round 1's setup; its own card already spaces it. */
.competition-reference-choice { margin-top: 0; }
.competition-reference-choice + .competition-setup-form { margin-top: 1.25rem; }

/*
 * The rank sits under its own heading. Every table here centres its values,
 * but the first column is the label column and its heading is left-aligned
 * for that reason, which left the places standing away from the word above
 * them - and away from the box that opens over them, which starts at the
 * cell's edge. The column reads down one line now, heading, number and box
 * alike.
 */
#competition-leaderboard td:first-child { text-align: left; }

/* The rank and award columns read as values; the organiser opens one at a time. */
/* Padded like the box that opens over it, so the digit does not move. */
.competition-cell-value { display: inline-block; padding: .1rem .35rem; border-radius: .2rem; cursor: text; }
.competition-cell-value:hover { background: var(--green-soft, #dcefe4); }
.competition-cell-value:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.competition-rank-form { margin: 0; }
.competition-rank-form input { width: 3.75rem; min-width: 0; min-height: 0; height: 1.65em; padding: 0 .25em; font: inherit; line-height: 1.3; border-radius: .2rem; }
.competition-rank-form input[aria-invalid="true"] { border-color: var(--red, #9b2c2c); }
#competition-rank-status { margin: .35rem auto 0; }
/* An award runs to more digits than a place does. */
.competition-awarded .competition-rank-form input { width: 6rem; }
/*
 * A note is prose, so its column is the one that may wrap, and the row that
 * holds one says so by taking a pointer. The whole of it opens underneath,
 * where there is width for a paragraph.
 */
#competition-leaderboard td.competition-feedback-cell { white-space: normal; min-width: 12rem; max-width: 24rem; }
/* The organiser's working list carries whole answers, so its columns wrap. */
#competition-leaderboard td.competition-answer-text { white-space: normal; min-width: 14rem; text-align: left; }
/* A payment address is not a name; the capitalising the second column gets
   in the standings must not reach it. */
#competition-leaderboard td.competition-answer-upi { white-space: nowrap; text-transform: none; }
#competition-leaderboard tr[data-has-note] { cursor: pointer; }
.competition-feedback-snippet { font: inherit; text-align: left; }
#competition-leaderboard tr.competition-feedback-row td { white-space: normal; text-align: left; padding-top: 0; }
#competition-leaderboard tr.competition-feedback-row .competition-text { margin: 0 0 .25rem; }
.competition-congratulations { margin-top: 0; font-size: 1.05rem; }
.competition-note-form { margin-top: 1rem; }
.competition-note-form textarea { min-height: 6rem; }
/* The UPI box carries its own advice, so it needs the room the others have. */
.competition-note-form input { width: 100%; }
/*
 * Where a block asks its question instead of labelling itself, the question
 * leads the heading row and does not hug the right edge the way the saved
 * status beside it does.
 */
.competition-setup-heading .competition-note-lead { margin: 0; text-align: left; }
/* Three questions in one card: each after the first starts a little clear of
   the answer to the last. */
.competition-note-form .competition-setup-heading:not(:first-child) { margin-top: .75rem; }
.competition-note-required { margin: 0; }
/*
 * A question, not a field name: it keeps the page's reading type rather than
 * the small capitals every other label wears, and the tick stays on its first
 * line however long it runs.
 */
.competition-youtube { display: flex; align-items: flex-start; gap: .6rem; margin-top: .5rem;
  font-size: 1rem; text-transform: none; letter-spacing: normal; font-weight: 400; color: var(--ink); }
.competition-youtube input { width: auto; margin: .25rem 0 0; flex: none; }
.competition-note-lead { margin: -.6rem 0 0; }
.competition-private-line { margin: 0 0 .35rem; }
.competition-preview-note { flex-basis: 100%; margin: .15rem 0 0; }
.competition-note-preview { margin: 0 0 .75rem; }
#competition-rank-status[data-failed="true"] { color: var(--red, #9b2c2c); }

/* One participant stays selected while the round tabs change the answer. */
/* « ‹ name › » - the round is chosen by its tab, not in here. */
.competition-review-nav { display: grid; grid-template-columns: auto auto minmax(0,1fr) auto auto; align-items: center; gap: .3rem; }
.competition-review-nav button { padding: .3rem .35rem; min-width: 1.5rem; font: inherit; text-decoration: none; align-self: center; border: 0; background: transparent; box-shadow: none; }
.competition-review-nav button:disabled { color: var(--ink-soft); opacity: .45; cursor: default; }
.competition-review-nav button:not(:disabled):hover { color: var(--green-deep); text-decoration: underline; }
.competition-participant-name { min-width: 20ch; text-transform: capitalize; text-align: center; font-weight: 600; overflow-wrap: anywhere; }
.competition-entry > label { display: grid; gap: .35rem; max-width: 12rem; }

@media (max-width: 600px) {
  .competition-review-nav { gap: .15rem; }
  .competition-review-nav button { padding: .3rem; min-width: 1.5rem; font-size: .85rem; }
  .competition-participant-name { font-size: .85rem; }
}

.competition-review-summary { display: grid; grid-template-columns: minmax(7rem,1fr) minmax(0,auto) minmax(7rem,1fr); font-size: .85rem; align-items: center; gap: .35rem .75rem; padding-bottom: .5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border, #ddd); }
.competition-review-summary .competition-review-nav { width: max-content; max-width: 100%; justify-self: center; }
.competition-graded-count { text-align: left; white-space: nowrap; }
.competition-grade-box { display: grid; gap: 0; justify-self: end; width: 4rem; font-size: inherit; }
.competition-grade-box input { width: 100%; min-width: 0; min-height: 0; height: 1.65em; padding: 0 .25em; font: inherit; line-height: 1.3; border-radius: .2rem; }
.competition-review-timing { grid-column: 1 / -1; grid-row: 1; margin: 0; text-align: center; }
.competition-review-summary > .competition-graded-count,
.competition-review-summary > .competition-review-nav,
.competition-review-summary > .competition-grade-box { grid-row: 2; }
.competition-form .competition-review-summary { margin-bottom: 0; }
.competition-entry { padding-top: 0; font-size: .85rem; }
.competition-entry > .competition-form { margin-top: 0; }
@media (max-width: 760px) {
  .competition-participant-name { width: 20ch; min-width: 0; max-width: 100%; }
  .competition-review-summary { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: .5rem; }
  .competition-review-summary .competition-review-nav { grid-column: 1 / -1; grid-row: 3; }
  .competition-grade-box { grid-column: 2; grid-row: 2; }
}

.competition-answer.card { padding: 1rem; }
.competition-answer textarea { display: block; font: inherit; resize: vertical; }
.competition-answer .competition-form { margin-top: 0; gap: .75rem; }

/* The existing participant row holds save feedback without moving the textbox. */
.competition-answer-heading { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.competition-answer-heading > .field-note { margin: 0; }
.competition-answer-heading .competition-save-status { position: absolute; top: 0; right: 0; width: calc(50% - .375rem); min-height: 0; max-height: 100%; overflow: auto; font-size: .75rem; line-height: 1.4; text-align: right; overflow-wrap: anywhere; }
.competition-save-status[hidden] { display: none; }
.competition-reading-field { position: relative; min-width: 0; }
.competition-reading-header { display: contents; }
.competition-reading-header label { margin: 0; }
/* The count appears inside the textbox, with no empty row below it. */
.competition-reading-field textarea[name="answer"] { padding-bottom: 2rem; }
.competition-answer .competition-count { position: absolute; right: .7rem; bottom: .4rem; margin: 0; min-height: 0; font-size: .75rem; line-height: 1.4; }
.competition-answer .competition-count:empty { display: none; }
.competition-reading-field textarea::placeholder { color: var(--ink-soft); opacity: 1; }
