/* Base reset / typography */
* {
  margin: 0;
  padding: 0;
  font-family: "Open Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
body {
  background-color: #ffffff;
}

pre {
  font-family: Fixedsys, Courier, monospace;
  font-size: 1.3ex;
  white-space: pre;
}

.giphy-embed {
  padding-left: 20%;
  justify-self: center;
  align-self: center;
  text-align: center;
}

.user_solution {
  justify-self: center;
  align-self: center;
}

code {
  font-family: monospace;
  background-color: #EDEDED;
}

.description {
  width: 100%;
  text-align: left;
}

.solution {
  width: 100%;
  align-self: center;
  justify-self: center;
}

.description > p {
  padding: 2px;
}

.description > ul {
  position: relative;
  list-style: none;
  padding-left: 40px;
  padding: 2px;
  text-indent: 20px;
}

.description ul li:before {
  content: "...";
}

/* Ranking points */
.points {
  width: 80%;
  font-weight: 700;
  text-decoration: none;
  align-self: center;
  justify-self: center;
  padding: 50px;
  text-align: center;
}

/* Links */
a {
  color: #32414b;
  font-weight: 700;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Tables */
th, td {
  padding: 5px;
}

/* Buttons (match submit style) */
input[type="submit"],
button,
.button,
.login-form button,
.lost-form button {
  background-color: #a51e37;
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  font-weight: 700;
  display: inline-block;
  font-size: 16px;
  transition: 0.4s;
  cursor: pointer;
}

input[type="submit"]:hover,
button:hover,
.button:hover,
.login-form button:hover,
.lost-form button:hover {
  background-color: white;
  color: #a51e37;
  border: 2px solid #a51e37;
}

/* Optional secondary button style */
button.lost {
  background-color: transparent;
  color: #a51e37;
  border: 2px solid #a51e37;
  padding: 10px 20px;
}
button.lost:hover {
  background-color: #a51e37;
  color: white;
}

/* Text inputs */
.field-container td input:focus {
  font-weight: 700;
}

input[type=email],
input[type=text],
input[type=password] {
  width: 300px;
  padding: 12px 20px;
  margin: 8px 0;
  border: 1px solid #32414b;
  background-color: #ffffff;
  color: #32414b;
  box-sizing: border-box;
}

input[type=email]:focus,
input[type=text]:focus,
input[type=password]:focus {
  border: 3px solid #7a1629;
}

p.matrix-heading {
  font-weight: 600;
  padding: 5px;
}

/* Radio controls */
.container {
  display: block;
  position: relative;
  width: 80px;
  padding-left: 35px;
  margin-bottom: 12px;
  cursor: pointer;
  font-size: 16px;
  user-select: none;
}
.container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}
.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 20px;
  width: 20px;
  background-color: #eee;
  border-radius: 50%;
}
.container:hover input ~ .checkmark {
  background-color: #ccc;
}
.container input:checked ~ .checkmark {
  background-color: #7a1629;
}
.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}
.container input:checked ~ .checkmark:after {
  display: block;
}
.container .checkmark:after {
  top: 7px;
  left: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: white;
}

/* Collapsible rows (fixed selector) */
#inverse_row, #password_row {
  overflow: hidden;
  opacity: 0;
  max-height: 0;
}

/* Ranking table */
.ranking {
  width: 100%;
  justify-self: center;
  align-self: start;
  font-size: 20px;
}

/* Grid layout */
.grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(50px, 1fr));
  grid-template-rows: repeat(auto-fit, minmax(20px, 1fr));
  grid-template-areas:
    "title"
    "header"
    "sidebar"
    "content"
    "footer";
  grid-gap: 10px;
}

.title {
  grid-area: title;
  align-self: center;
}

.header {
  grid-area: header;
  align-self: center;
  justify-self: center;
}

/* Sidebar (mobile) */
.sidebar {
  grid-area: sidebar;
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  grid-template-rows: repeat(3, minmax(20px, 1fr));
  grid-template-areas:
    "sidebar-log . sidebar-el1"
    "sidebar-el2 . sidebar-el3"
    "sidebar-el4 . sidebar-el5";
  justify-self: center;
  align-self: center;
}

.sidebar-log { grid-area: sidebar-log; }
.sidebar-el1  { grid-area: sidebar-el1; }
.sidebar-el2  { grid-area: sidebar-el2; }
.sidebar-el3  { grid-area: sidebar-el3; }
.sidebar-el4  { grid-area: sidebar-el4; }
.sidebar-el5  { grid-area: sidebar-el5; }

/* Content & footer */
.content {
  grid-area: content;
  align-self: center;
  justify-self: center;
  grid-template-columns: repeat(1, minmax(100px, 1fr));
  grid-template-rows: repeat(1, minmax(20px, 1fr));
}

.footer {
  grid-area: footer;
}

/* Side regions (mobile) */
.rightside {
  grid-area: rightside;
  display: none;
}
.topleft {
  grid-area: topleft; /* fixed from rightside */
  display: none;
}

/* Desktop layout */
@media screen and (min-width: 736px) {
  .grid {
    display: grid;
    grid-template-columns: 100px 150px 900px 1fr;
    grid-template-rows: repeat(auto-fit, minmax(20px, 1fr));
    grid-template-areas:
      ". topleft title header"
      ". sidebar content rightside"
      ". sidebar content rightside"
      ". sidebar footer .";
  }

  .sidebar {
    grid-area: sidebar;
    display: grid;
    grid-template-columns: repeat(1, minmax(150px, 1fr));
    grid-template-rows: repeat(6, minmax(60px, 1fr)); /* fixed count */
    grid-template-areas:
      "sidebar-log"
      "sidebar-el1"
      "sidebar-el2"
      "sidebar-el3"
      "sidebar-el4"
      "sidebar-el5";
    justify-self: center;
    align-self: start;
  }

  .content {
    grid-area: content;
    align-self: start;
    justify-self: center;
    grid-template-columns: repeat(1, minmax(100px, 1fr));
    grid-template-rows: repeat(1, minmax(20px, 1fr));
  }

  .topleft {
    grid-area: topleft;
    display: grid;
    grid-template-columns: repeat(1, minmax(300px, 1fr));
    grid-template-rows: repeat(1, minmax(100px, 1fr));
    align-self: start;
    background-image: url("header.png");
    background-repeat: no-repeat;
    background-position: left;
    background-size: contain;
  }

  .rightside {
    grid-area: rightside;
    display: grid;
    grid-template-columns: repeat(1, minmax(50px, 1fr));
    grid-template-rows: repeat(1, minmax(400px, 1fr));
    align-self: start;
    background-image: url("side.png");
    background-repeat: no-repeat;
    background-position: top left;
    background-size: contain;
  }
}

/* New auth form helpers */
.login-form, .lost-form {
  margin: 1rem 0;
}
.form-row {
  margin-bottom: 0.8rem;
}
.form-row label {
  font-weight: bold;
}
.form-row input {
  width: 100%;
  padding: 0.4rem;
}
.login-form .form-row input {
  width: 100%;
  max-width: 420px;
}
