:root {
  --bg: #fff3f3;
  --card: #ffffff;
  --primary: #1769d6;
  --primary-dark: #0f4f9f;
  --text: #1f2937;
  --danger: #b42318;
  --muted: #64748b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #ffe3e3, var(--bg));
}

.container {
  max-width: 860px;
  margin: 32px auto;
  padding: 24px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(169, 70, 70, 0.15);
}

h1 { margin: 0 0 8px; font-size: 28px; }
h2 { margin-top: 0; color: var(--muted); font-size: 20px; }

.panel {
  border: 1px solid #dbe4f2;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.cover-text p {
  margin: 0 0 10px;
  line-height: 1.8;
}

.cover-text .cover-heading {
  margin-left: 0;
}

.cover-text .cover-body {
  margin-left: 1.2em;
}

.req-mark {
  color: #b42318;
  font-weight: 700;
}

label {
  display: block;
  margin: 10px 0 6px;
}

.mailing-list-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: flex-start;
  column-gap: 20px;
  row-gap: 8px;
}

.mailing-list-options {
  white-space: nowrap;
}

.mailing-list-options label {
  margin: 10px 0 6px;
}

.mailing-list-note {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.8;
  color: inherit;
}

@media (max-width: 640px) {
  .mailing-list-row {
    grid-template-columns: 1fr;
  }

  .mailing-list-options {
    white-space: normal;
  }
}

input[type="text"], input[type="number"], input[type="email"], select {
  width: 100%;
  padding: 10px;
  border: 1px solid #b8c6dd;
  border-radius: 8px;
  font-size: 16px;
}

input[type="radio"] {
  margin-right: 8px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  justify-content: center;
}

button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #9c1313);
  color: #fff;
  padding: 10px 20px;
  font-size: 15px;
  cursor: pointer;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #9c1313);
  color: #fff;
  padding: 10px 20px;
  font-size: 15px;
  text-decoration: none;
}

button:disabled {
  background: #c6d2e5 !important;
  color: #6b7280;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.95;
}

.errors {
  margin: 0 0 16px;
  padding: 12px 18px;
  border-radius: 8px;
  color: var(--danger);
  background: #fee4e2;
}

.notice {
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 8px;
  background: #e7f6ec;
  color: #146c2e;
}

.logo-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e3e8f1;
}

.logo-code {
  font-weight: bold;
  color: var(--primary-dark);
}

.grad-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.grad-label {
  font-weight: 400;
  color: #334155;
  font-size: 16px;
}

.grad-input {
  width: 120px !important;
  display: inline-block;
}

.grad-unit {
  font-weight: 400;
  color: #334155;
  font-size: 16px;
}

.grad-sep {
  color: #334155;
  font-weight: 400;
  font-size: 16px;
}

.student-inline {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 8px;
  margin-left: 12px;
}

.student-note {
  margin: 14px 0 8px;
  line-height: 1.6;
}

.student-year-select {
  width: 150px;
  margin: 0;
}

.student-year-label {
  color: #334155;
  white-space: nowrap;
}

.step2-form > p {
  margin: 12px 0;
}

.step2-form .grad-inline {
  margin-top: 12px;
  margin-bottom: 12px;
  margin-left: 18px;
}

.step2-form .student-note {
  margin: 12px 0 12px;
}

.step2-form .student-inline {
  margin-top: 12px;
  margin-left: 18px;
}

.logo-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.logo-table th,
.logo-table td {
  border: 1px solid #cfd9ea;
  padding: 10px;
  vertical-align: top;
  background: #fff;
}

.logo-table th {
  background: #fdecec;
  text-align: center;
  white-space: nowrap;
}

.logo-table th:nth-child(1),
.logo-table td:nth-child(1) {
  width: 60px;
}

.logo-table th:nth-child(2),
.logo-table td:nth-child(2) {
  width: 180px;
}

.logo-table td:nth-child(1),
.logo-table td:nth-child(2) {
  text-align: center;
}

.logo-table td:nth-child(2) {
  padding: 6px;
  height: 170px;
}

.logo-image {
  width: 100%;
  max-width: none;
  height: 100%;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.common-mark-wrap {
  border: 1px solid #cfd9ea;
  background: #fff;
  padding: 8px;
  margin-bottom: 12px;
}

.common-mark-image {
  width: 100%;
  max-width: 560px;
  height: auto;
  display: block;
}

.common-mark-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  table-layout: fixed;
}

.common-mark-table td {
  border: 1px solid #cfd9ea;
  background: #fff;
  padding: 8px;
  vertical-align: top;
}

.common-mark-table .cm-image {
  width: 30%;
  text-align: left;
  vertical-align: top;
  padding: 8px 8px 2px 8px;
  padding-top: 26px;
}

.common-mark-table .cm-text {
  width: 70%;
  font-size: inherit;
  line-height: 1.65;
  text-align: left;
  vertical-align: top;
}

.cm-title {
  margin: -12px 0 6px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.45;
  color: #334155;
}

.cm-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 8px;
}

.cm-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cm-caption {
  margin: 0;
  color: #334155;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
}

.cm-caption-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 10px;
  margin: 14px 0 16px;
}

.cm-caption-left,
.cm-caption-right {
  margin: 0;
  color: #334155;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.45;
  word-break: keep-all;
}

.cm-caption-left {
  text-align: left;
  padding-left: 2px;
}

.cm-caption-right {
  text-align: left;
  justify-self: end;
  margin-right: 10px;
  padding-right: 2px;
}

.cm-arrow-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  width: auto;
  transform: translateY(18px);
}

.cm-arrow-image {
  width: 32px;
  height: auto;
}

.common-mark-g,
.common-mark-h {
  max-width: 96px;
}

.common-mark-combined {
  max-width: 100%;
  width: 100%;
  height: auto;
  margin-top: 10px;
}

.vote-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 14px;
}

.vote-table th,
.vote-table td {
  border: 1px solid #cfd9ea;
  text-align: center;
  padding: 8px 6px;
  background: #fff;
}

.vote-table thead th {
  background: #fdecec;
}

.vote-table tbody tr:nth-child(odd) td {
  background: #fff4f4;
}

.vote-table th:first-child,
.vote-table td:first-child {
  text-align: center;
  width: 90px;
  font-weight: 700;
}

.vote-logo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 6px;
}

.vote-logo-card {
  border: 1px solid #cfd9ea;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.vote-logo-title {
  font-weight: 700;
  color: #111111;
  margin-bottom: 6px;
}

.vote-logo-image {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  display: block;
}

.finish-row {
  display: grid;
  grid-template-columns: 180px auto;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}

.finish-row button {
  width: auto;
  max-width: max-content;
  min-width: 96px;
  justify-self: start;
}

.thanks-panel .actions {
  justify-content: center;
}

.thanks-panel .actions .button-link,
.thanks-panel .actions button {
  width: 260px;
  max-width: 100%;
  text-align: center;
}

/*================================================
 *  タブレット向けデザイン
 ================================================*/
@media screen and (max-width: 979px) {
  body {
    width: 100%;
    padding: 0 10px;
  }

  .container {
    width: 100%;
    margin: 16px auto;
    padding: 18px;
  }

  .panel {
    padding: 14px;
  }

  .logo-table th,
  .logo-table td,
  .vote-table th,
  .vote-table td {
    padding: 8px 6px;
  }

  .logo-table th:nth-child(2),
  .logo-table td:nth-child(2) {
    width: 150px;
  }

  .logo-table td:nth-child(2) {
    height: 145px;
  }

  .common-mark-table .cm-image {
    width: 45%;
  }

  .common-mark-table .cm-text {
    width: 55%;
  }
}

/*================================================
 *  スマートフォン向けデザイン
 ================================================*/
@media screen and (max-width: 767px) {
  body {
    padding: 0 8px;
  }

  .container {
    margin: 10px auto;
    padding: 12px;
    border-radius: 10px;
  }

  h1 {
    font-size: 22px;
  }

  .cover-text .cover-body {
    margin-left: 0.8em;
  }

  .actions {
    flex-direction: column;
    align-items: center;
  }

  button {
    width: 100%;
    max-width: 320px;
  }

  .button-link {
    width: 100%;
    max-width: 320px;
  }

  .thanks-panel .actions .button-link,
  .thanks-panel .actions button {
    width: 100%;
    max-width: 320px;
  }

  .finish-row button {
    width: auto;
    max-width: none;
  }

  .grad-inline {
    flex-wrap: wrap;
    overflow: visible;
    row-gap: 6px;
  }

  .grad-input {
    width: 92px !important;
  }

  .student-inline {
    align-items: flex-start;
    gap: 6px;
  }

  .logo-table {
    font-size: 13px;
  }

  .logo-table th,
  .logo-table td {
    padding: 6px 4px;
  }

  .logo-table th:nth-child(1),
  .logo-table td:nth-child(1) {
    width: 44px;
  }

  .logo-table th:nth-child(2),
  .logo-table td:nth-child(2) {
    width: 112px;
  }

  .logo-table td:nth-child(2) {
    height: 110px;
  }

  .common-mark-table td {
    display: block;
    width: 100%;
  }

  .common-mark-table .cm-image,
  .common-mark-table .cm-text {
    width: 100%;
  }

  .cm-row {
    grid-template-columns: 1fr;
    row-gap: 8px;
  }

  .cm-caption-row {
    grid-template-columns: 1fr 1fr;
    column-gap: 8px;
    row-gap: 0;
  }

  .cm-block,
  .cm-arrow-wrap {
    width: 100%;
  }

  .cm-arrow-wrap {
    transform: none;
  }

  .cm-arrow-image {
    width: 36px;
  }

  .vote-table {
    font-size: 13px;
  }

  .vote-table th,
  .vote-table td {
    padding: 6px 4px;
  }

  .vote-table th:first-child,
  .vote-table td:first-child {
    width: 68px;
  }

  .vote-logo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
