/* 内定承諾書（電子署名） */
:root {
  --primary: #1a4472;
  --accent: #2d6a9f;
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #2d3748;
  --muted: #64748b;
  --border: #d8e0ea;
  --success: #2e7d32;
  --error: #c62828;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(26, 68, 114, 0.08);
  --serif: 'Noto Serif JP', 'Yu Mincho', 'YuMincho', 'Hiragino Mincho ProN', serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

/* モーダル表示中は背景を固定（top は JS で設定） */
body.scroll-locked {
  position: fixed;
  left: 0;
  right: 0;
  overflow: hidden;
}

.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 1.5rem 1rem 1.75rem;
  text-align: center;
}

.site-header h1 {
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.site-header p {
  margin-top: 0.4rem;
  font-size: 0.88rem;
  opacity: 0.92;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
}

.lead {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* 承諾書本文 */
.shodaku-doc {
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.9;
  color: #1a202c;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem 1.25rem;
  background: #fff;
}

.shodaku-doc .to-line {
  margin-bottom: 1.25rem;
  letter-spacing: 0.12em;
}

.shodaku-doc .doc-title {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  margin: 0.5rem 0 1.25rem;
}

.shodaku-doc .ki {
  text-align: center;
  margin: 1.25rem 0 0.75rem;
}

.shodaku-doc .doc-items {
  list-style: none;
}

.shodaku-doc .doc-items li {
  display: flex;
  margin-bottom: 0.2rem;
}

.shodaku-doc .doc-items .num {
  flex-shrink: 0;
  width: 2em;
}

.sig-on-doc {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

.sig-on-doc-date {
  text-align: right;
  margin-bottom: 0.5rem;
}

.sig-on-doc-date span {
  display: inline-block;
  min-width: 10em;
  text-align: right;
  border-bottom: 1px solid #333;
}

.sig-on-doc-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid #333;
  min-height: 2.2em;
}

.sig-on-doc-row .label {
  flex-shrink: 0;
  width: 3.5em;
}

.sig-on-doc-row .value-inline {
  flex: 1;
  min-width: 0;
  word-break: break-all;
}

.sig-on-doc-name {
  align-items: flex-end;
}

.sig-preview-box {
  flex: 1;
  min-width: 0;
  height: 56px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding-bottom: 2px;
}

.sig-preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sig-placeholder {
  color: #94a3b8;
  font-size: 0.8rem;
  font-family: 'Noto Sans JP', sans-serif;
  padding-bottom: 0.2rem;
}

/* フォーム */
.form-group {
  margin-bottom: 1.1rem;
}

.form-group > label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.form-group label .req {
  color: var(--error);
  font-size: 0.8rem;
  margin-left: 0.35rem;
  font-weight: 500;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 68, 114, 0.12);
}

.field-note {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.field-note[hidden] {
  display: none;
}

/* 署名欄（タップでポップアップ） */
.sig-field {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 96px;
  padding: 0.5rem;
  border: 2px dashed var(--primary);
  border-radius: 10px;
  background: #fafcff;
  cursor: pointer;
  font-family: inherit;
}

.sig-field:hover {
  background: #f3f7fb;
}

.sig-field-placeholder {
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 600;
}

.sig-field-placeholder::before {
  content: '✎ ';
}

.sig-field.has-signature {
  border-style: solid;
  border-color: var(--border);
  background: #fff;
}

.sig-field img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sig-field [hidden] {
  display: none;
}

/* 署名ポップアップ */
.sig-modal {
  padding: 0.5rem;
  touch-action: none;
  overscroll-behavior: none;
}

.sig-modal-box {
  max-width: 760px;
}

.sig-pad-wrap {
  position: relative;
  width: 100%;
  height: 260px;
  height: min(56vh, 72vw, 440px);
  min-height: 170px;
  border: 2px dashed var(--primary);
  border-radius: 10px;
  background: #fafcff;
  touch-action: none;
  overflow: hidden;
}

.sig-pad-wrap canvas {
  position: relative;
  z-index: 1;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.sig-guide {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 24%;
  border-bottom: 1px dashed #c3cedb;
  pointer-events: none;
}

.sig-pad-hint {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #94a3b8;
  font-size: 0.95rem;
  pointer-events: none;
  white-space: nowrap;
}

.sig-pad-wrap.has-signature .sig-pad-hint {
  display: none;
}

.sig-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.sig-modal-actions button {
  white-space: nowrap;
  font-size: 0.9rem;
}

.sig-modal-actions .btn-submit {
  margin-top: 0;
}

.sig-modal-actions .btn-sub {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.btn-submit {
  width: 100%;
  padding: 0.95rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: opacity 0.15s;
}

.btn-submit:hover:not(:disabled) {
  opacity: 0.95;
}

.btn-submit:disabled,
.btn-sub:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sub {
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--primary);
  border-radius: 10px;
  cursor: pointer;
}

.btn-sub:hover:not(:disabled) {
  background: #f3f7fb;
}

.status-msg {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  min-height: 1.5em;
}

.status-msg.ok {
  color: var(--success);
}

.status-msg.err {
  color: var(--error);
}

/* 確認モーダル */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal[hidden] {
  display: none;
}

.modal-box {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
}

.modal-title {
  font-size: 1.05rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.modal-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.preview-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  background: #e5e9ef;
  padding: 0.5rem;
  cursor: zoom-in;
  -webkit-overflow-scrolling: touch;
}

.preview-scroll img {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
}

.preview-scroll.zoomed {
  cursor: zoom-out;
}

.preview-scroll.zoomed img {
  width: 220%;
  max-width: none;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.modal-actions .btn-submit {
  margin-top: 0;
}

.modal .status-msg {
  margin-top: 0.6rem;
  min-height: 1.2em;
}

/* 完了 */
.success-panel {
  display: none;
  text-align: center;
  padding: 2rem 1rem;
}

.success-panel.show {
  display: block;
}

.success-panel .icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--success);
}

.success-panel .btn-sub {
  margin-top: 1.5rem;
}

.form-panel.hidden {
  display: none;
}

@media (max-width: 480px) {
  .card {
    padding: 1.15rem;
  }

  .shodaku-doc {
    padding: 1.1rem 0.9rem;
    font-size: 0.9rem;
  }

  .shodaku-doc .doc-title {
    letter-spacing: 0.2em;
    font-size: 1.1rem;
  }

  .sig-preview-box {
    height: 44px;
  }

  .sig-modal-box {
    padding: 1rem 0.85rem;
  }
}
