:root {
  --paper: #f6d695;
  --ink: #321b26;
  --violet: #5c2c75;
  --violet-dark: #2e183f;
  --teal: #2dcfc0;
  --aqua: #ccfff4;
  --gold: #e8b75d;
  --line: rgba(76, 36, 50, 0.24);
  --shadow: 0 18px 48px rgba(58, 30, 52, 0.26);
  color-scheme: light;
  font-family: "Trebuchet MS", "Hiragino Kaku Gothic ProN", Meiryo, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper) url("bg.jpg") center top / cover fixed;
}

button,
input {
  font: inherit;
}

.site-shell {
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 28px 0 32px;
}

.hero {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid rgba(93, 39, 63, 0.42);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(235, 255, 250, 0.78) 48%, rgba(255, 255, 255, 0.18)),
    #fff;
  box-shadow: var(--shadow);
}

.hero__art {
  position: absolute;
  inset: 0;
  background: url("hero.jpg") center / cover no-repeat;
  opacity: 0.86;
}

.hero__content {
  position: relative;
  width: min(440px, 100%);
  min-height: 420px;
  padding: 52px 38px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.78), transparent);
}

.brand {
  margin: 0 0 18px;
  color: var(--violet);
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.9);
}

h1,
h2 {
  margin: 0;
  color: var(--violet-dark);
  line-height: 1.05;
}

h1 {
  max-width: 360px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 7vw, 78px);
  font-weight: 700;
}

h2 {
  font-size: 24px;
}

.intro {
  max-width: 360px;
  margin: 20px 0 0;
  font-size: 16px;
  line-height: 1.6;
}

.panel,
.leaderboards {
  margin-top: 18px;
  border: 1px solid rgba(93, 39, 63, 0.36);
  background: rgba(255, 252, 238, 0.9);
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  padding: 24px;
}

.register {
  display: grid;
  gap: 16px;
}

.mode-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.mode-picker label {
  display: block;
  min-width: 0;
}

.mode-picker input {
  position: absolute;
  opacity: 0;
}

.mode-picker span,
.board-tabs button,
.actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid rgba(91, 44, 117, 0.36);
  color: var(--violet-dark);
  background: rgba(196, 253, 240, 0.48);
  cursor: pointer;
}

.mode-picker span {
  width: 100%;
}

.mode-picker input:checked + span,
.board-tabs button.active,
.actions button {
  color: #fff;
  background: linear-gradient(180deg, #7f438f, #4e2b71);
  border-color: #3b1f57;
}

.field {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  letter-spacing: 0.04em;
}

.field input[type="file"] {
  display: flex;
  align-items: center;
  padding-top: 12px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0;
}

.file-control {
  display: flex;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  padding: 6px;
  background: rgba(255, 255, 255, 0.88);
  text-transform: none;
}

.file-control button {
  min-height: 34px;
  border: 1px solid rgba(91, 44, 117, 0.36);
  padding: 0 12px;
  color: var(--violet-dark);
  background: rgba(196, 253, 240, 0.58);
  font-weight: 800;
  cursor: pointer;
}

.file-control span {
  padding: 0 10px;
  color: rgba(50, 27, 38, 0.72);
  font-size: 14px;
  font-weight: 700;
}

.field input:focus {
  outline: 2px solid rgba(45, 207, 192, 0.62);
  outline-offset: 2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions button {
  min-width: 142px;
  padding: 0 18px;
  font-weight: 800;
}

.actions .ghost {
  color: var(--violet-dark);
  background: rgba(255, 255, 255, 0.64);
}

.message {
  min-height: 28px;
  color: #0f5c51;
  font-weight: 700;
}

.message.error {
  color: #a32637;
}

.decoder-card {
  padding: 18px;
  border: 1px solid rgba(91, 44, 117, 0.24);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(196, 253, 240, 0.28));
}

.decoder-card dl {
  display: grid;
  gap: 14px;
  margin: 18px 0 0;
}

.decoder-card div {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(91, 44, 117, 0.18);
}

.decoder-card dt {
  color: rgba(50, 27, 38, 0.66);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.decoder-card dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
}

.leaderboards {
  padding: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.board-tabs {
  display: flex;
  gap: 8px;
}

.board-tabs button {
  min-height: 36px;
  padding: 0 14px;
  font-weight: 800;
}

.score-table-wrap {
  position: relative;
  margin-top: 18px;
  overflow-x: auto;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.66);
}

.score-table th,
.score-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
}

.screenshot-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(91, 44, 117, 0.36);
  color: var(--violet-dark);
  background: rgba(196, 253, 240, 0.58);
  text-decoration: none;
}

.screenshot-link:hover {
  color: #fff;
  background: linear-gradient(180deg, #7f438f, #4e2b71);
}

.screenshot-link svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.score-table th {
  color: var(--violet);
  font-size: 12px;
  text-transform: uppercase;
}

.score-table td:nth-child(1),
.score-table td:nth-child(3) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.empty {
  margin: 18px 0 0;
  color: rgba(50, 27, 38, 0.72);
}

footer {
  padding: 18px 4px 0;
  color: rgba(50, 27, 38, 0.72);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 760px) {
  .site-shell {
    width: min(100vw - 18px, 540px);
    padding-top: 10px;
  }

  .hero,
  .hero__content {
    min-height: 360px;
  }

  .hero__art {
    background-position: 62% center;
  }

  .hero__content {
    padding: 30px 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.72), transparent);
  }

  .grid {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .mode-picker {
    grid-template-columns: 1fr;
  }

  .field input {
    font-size: 15px;
    letter-spacing: 0.02em;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .board-tabs {
    width: 100%;
  }

  .board-tabs button {
    flex: 1;
    padding: 0 8px;
  }
}
