/* ==========================================================================
   SkipBoard v2 — handwriting screen
   ========================================================================== */

.screen-handwriting {
  padding: 0 0 var(--foot-h) 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

.hw-wrap {
  width: 100%;
  max-width: var(--content-max, 560px);
  margin: 0 auto;
  padding: var(--s-3) var(--gutter, 16px);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  box-sizing: border-box;
}

.hw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.hw-head .btn {
  min-height: var(--tap, 56px);
  min-width: var(--tap, 56px);
}

.hw-head-text h1 {
  font-family: var(--font-display);
  font-size: var(--t-24);
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.hw-photo-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  box-sizing: border-box;
}

.hw-photo-top {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.hw-photo-copy h2 {
  font-family: var(--font-display);
  font-size: var(--t-20);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--s-1) 0;
}

.hw-photo-copy p {
  margin: 0;
}

.hw-photo-top .btn,
.hw-photo-actions .btn {
  min-height: var(--tap, 56px);
  min-width: var(--tap, 56px);
  width: 100%;
}

.hw-photo-result {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  border-top: 1px solid var(--line-soft);
  padding-top: var(--s-3);
}

.hw-photo-msg {
  margin: 0;
  padding: var(--s-3);
  border-radius: var(--r-field);
  font-size: var(--t-15);
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.hw-photo-msg.is-ok {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

.hw-photo-msg.is-warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn);
}

.hw-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tap, 56px), 1fr));
  gap: var(--s-2);
}

.hw-photo-cell {
  min-height: var(--tap, 56px);
  min-width: var(--tap, 56px);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-1);
  box-sizing: border-box;
}

.hw-photo-cell canvas {
  display: block;
}

.hw-photo-char {
  font-size: var(--t-11);
  font-weight: 700;
  color: var(--muted);
}

.hw-progress-bar {
  width: 100%;
  height: var(--s-2);
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.hw-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width var(--dur-2) var(--ease);
}

.hw-prompt-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s-2);
  box-sizing: border-box;
}

.hw-prompt-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: var(--t-13);
  color: var(--muted);
}

.hw-char-big {
  font-family: var(--font-display);
  font-size: var(--t-44);
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  margin: var(--s-1) 0;
}

.hw-pad-container {
  position: relative;
  width: 100%;
  height: calc(var(--s-16) * 3.75);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  box-sizing: border-box;
}

.hw-canvas-guide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hw-canvas-draw {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hw-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: var(--s-2);
  width: 100%;
}

.hw-actions .btn {
  min-height: var(--tap, 56px);
  min-width: var(--tap, 56px);
  font-size: var(--t-16);
  font-weight: 600;
  padding: 0 var(--s-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
}

.hw-preview-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  box-sizing: border-box;
}

.hw-preview-card h2 {
  font-size: var(--t-13);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.hw-preview-canvas {
  width: 100%;
  height: var(--s-16);
  display: block;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px dashed var(--line);
}

.hw-foot {
  display: flex;
  justify-content: center;
  padding: var(--s-2) 0;
}

.hw-foot .btn {
  min-height: var(--tap, 56px);
  width: 100%;
}

.hw-phrase {
  margin: var(--s-2) 0;
  padding: var(--s-3);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--r-md, 12px);
  font-size: var(--t-20);
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.hw-phrase:empty { display: none; }
.hw-photo-copy .hw-photo-mode {
  min-height: var(--tap, 56px);
  color: var(--accent);
  padding-inline: 0;
}
