:root {
  --bg: #f4f6f8;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --ink: #12171f;
  --muted: #647181;
  --line: rgba(18, 23, 31, 0.1);
  --green: #19b989;
  --green-dark: #0d8b67;
  --blue: #276ef1;
  --amber: #d9901a;
  --shadow: 0 22px 60px rgba(30, 44, 60, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(25, 185, 137, 0.12), transparent 34%),
    linear-gradient(225deg, rgba(39, 110, 241, 0.1), transparent 38%),
    var(--bg);
  font-family:
    Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar,
.section {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 112px;
  padding: 24px 28px;
  border-radius: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 36px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
}

h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.clock {
  display: grid;
  gap: 4px;
  min-width: 210px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-solid);
  text-align: right;
}

.clock span,
.meta,
.label,
.empty {
  color: var(--muted);
}

.clock strong {
  font-variant-numeric: tabular-nums;
  font-size: 34px;
  line-height: 1;
}

.section {
  margin-top: 18px;
  padding: 24px;
  border-radius: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(25, 185, 137, 0.1);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  display: grid;
  gap: 8px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag.platform-pc {
  background: rgba(39, 110, 241, 0.11);
  color: #1e55b9;
}

.tag.category {
  background: rgba(217, 144, 26, 0.13);
  color: #9d660e;
}

.tag.difficulty {
  background: rgba(18, 23, 31, 0.08);
  color: var(--ink);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.metric {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  background: rgba(244, 246, 248, 0.68);
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.label {
  font-size: 12px;
}

.value {
  min-width: 0;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.details {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.details strong {
  color: var(--ink);
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--green), #0d9fef);
}

.button.subtle {
  color: var(--ink);
  background: rgba(18, 23, 31, 0.08);
}

.button.registered {
  color: #fff;
  background: #171d26;
}

.category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.category-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  font-weight: 700;
}

.category-button.active {
  color: var(--ink);
  border-color: rgba(25, 185, 137, 0.45);
  background: rgba(25, 185, 137, 0.12);
}

.code-form {
  display: grid;
  grid-template-columns: 100px 126px 140px 110px minmax(120px, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.code-form input {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.code-list {
  display: grid;
  gap: 10px;
}

.code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.76);
}

.code-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  min-width: 0;
}

.code-main strong {
  font-size: 24px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.copy-button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  color: #fff;
  background: #171d26;
  cursor: pointer;
  font-weight: 800;
}

.copy-button:disabled {
  cursor: default;
  opacity: 0.72;
}

.empty {
  padding: 26px;
  border: 1px dashed rgba(18, 23, 31, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.dialog {
  width: min(520px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(18, 23, 31, 0.38);
}

.form {
  display: grid;
  gap: 15px;
  padding: 22px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(18, 23, 31, 0.08);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(25, 185, 137, 0.65);
  box-shadow: 0 0 0 4px rgba(25, 185, 137, 0.12);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 20px, 620px);
    padding: 12px 0 28px;
  }

  .topbar,
  .section {
    border-radius: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 20px;
  }

  h1 {
    font-size: 30px;
  }

  .clock {
    min-width: 0;
    text-align: left;
  }

  .section {
    padding: 18px;
  }

  .section-head,
  .card-head,
  .card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .board-grid {
    grid-template-columns: 1fr;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .button {
    width: 100%;
  }

  .code-form {
    grid-template-columns: 1fr 1fr;
  }

  .code-form input,
  .code-form button {
    grid-column: 1 / -1;
  }

  .code-row {
    align-items: stretch;
    flex-direction: column;
  }

  .copy-button {
    width: 100%;
  }
}
