.soulha-word-puzzle {
  --paper: #ffffff;
  --cell: #fffef8;
  --ink: #131313;
  --muted: #5e5c57;
  --grid: #292926;
  --accent: #2e7854;
  --accent-soft: #e8f5eb;
  --border: #bfbaad;
  --error: #bd3f3f;
  --error-soft: #f7dddd;
  --blank-pending: #c8c1b5;
  --content-width: 616px;
  --gap: 14px;
  font-family: "Noto Sans KR", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background: transparent;
}

.soulha-word-puzzle, .soulha-word-puzzle * { box-sizing: border-box; }


.soulha-word-puzzle button, .soulha-word-puzzle input { font: inherit; }
.soulha-word-puzzle button { -webkit-tap-highlight-color: transparent; }

.soulha-word-puzzle .game-shell {
  width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap);
  padding: 34px 51px;
  overflow: hidden;
  border-radius: 24px;
  background: var(--paper);
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  transition: opacity 320ms ease, transform 320ms ease, filter 320ms ease;
}

.soulha-word-puzzle .game-shell.round-exit {
  opacity: 0;
  transform: translateY(-8px) scale(.985);
  filter: blur(3px);
}

.soulha-word-puzzle .game-shell.round-enter {
  opacity: 0;
  transform: translateY(10px) scale(.985);
  filter: blur(3px);
  transition: none;
}

.soulha-word-puzzle .game-shell.round-success .puzzle-board {
  animation: board-success 520ms ease both;
}

.soulha-word-puzzle .game-shell.quick-reset .board-wrap, .soulha-word-puzzle .game-shell.quick-reset .status-row, .soulha-word-puzzle .game-shell.quick-reset .chance-panel {
  opacity: .25;
  transform: scale(.992);
  transition: opacity 150ms ease, transform 150ms ease;
}

.soulha-word-puzzle .game-header, .soulha-word-puzzle .board-wrap, .soulha-word-puzzle .status-row, .soulha-word-puzzle .actions, .soulha-word-puzzle .share-row, .soulha-word-puzzle .chance-panel, .soulha-word-puzzle .hint-panel {
  width: min(var(--content-width), 100%);
}

.soulha-word-puzzle .game-header {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.soulha-word-puzzle .brand { flex: 1 1 auto; min-width: 0; }
.soulha-word-puzzle .brand h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.soulha-word-puzzle .timer {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.soulha-word-puzzle .timer-dot { color: var(--accent); font-size: 10px; }

.soulha-word-puzzle .intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding-bottom: 8px;
}
.soulha-word-puzzle .intro h2 {
  margin: 0;
  font-size: 27px;
  line-height: 38px;
  font-weight: 700;
  letter-spacing: -0.035em;
}
.soulha-word-puzzle .intro p {
  margin: 0;
  min-height: 22px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: -0.025em;
}

.soulha-word-puzzle .board-wrap { overflow: hidden; }
.soulha-word-puzzle .puzzle-board {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--grid);
}
.soulha-word-puzzle .cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  background: var(--grid);
  color: var(--ink);
  font-size: clamp(14px, 2.8vw, 20px);
  line-height: 1;
  font-weight: 700;
  user-select: none;
  transition: background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.soulha-word-puzzle .cell.open { background: var(--cell); }
.soulha-word-puzzle .cell.blocked { background: var(--grid); }

.soulha-word-puzzle .cell.answer.pending {
  background: var(--blank-pending);
  box-shadow: inset 0 0 0 1px rgba(19,19,19,.16);
}
.soulha-word-puzzle .cell.answer.active {
  box-shadow: inset 0 0 0 3px var(--accent);
}
.soulha-word-puzzle .cell.answer.correct {
  background-color: #f1efea;
  background-image: radial-gradient(circle at 1px 1px, rgba(19,19,19,.10) 1px, transparent 1.2px);
  background-size: 6px 6px;
  box-shadow: inset 0 0 0 1px rgba(19,19,19,.10);
  animation: correct-pop 220ms ease both;
}
.soulha-word-puzzle .cell.answer.wrong {
  background: var(--error-soft);
  box-shadow: inset 0 0 0 3px var(--error);
  animation: shake 180ms linear 0s 1;
}
.soulha-word-puzzle .cell.answer.attention {
  animation: attention 260ms ease 0s 2;
}

.soulha-word-puzzle .answer-input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
  font-size: inherit;
  line-height: 1;
  font-weight: 700;
  caret-color: var(--accent);
}
.soulha-word-puzzle .answer-input[readonly] { caret-color: transparent; cursor: default; }
.soulha-word-puzzle .answer-input::selection { background: #bfe0cc; }

.soulha-word-puzzle .status-row {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 15px;
  font-size: 20px;
  line-height: 1;
}
.soulha-word-puzzle .stage-status {
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.soulha-word-puzzle .chance-panel[hidden] { display: none; }
.soulha-word-puzzle .chance-panel {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 13px 16px 15px;
  border-radius: 10px;
  background: var(--accent-soft);
}
.soulha-word-puzzle .chance-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.soulha-word-puzzle .chance-heading strong {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 20px;
}
.soulha-word-puzzle .chance-heading span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -.02em;
}
.soulha-word-puzzle .chance-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.soulha-word-puzzle .chance-letter {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid #c4d8cb;
  border-radius: 8px;
  background: var(--cell);
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(19,19,19,.04);
}
.soulha-word-puzzle .chance-panel.chance-refresh .chance-letter {
  animation: chance-in 220ms ease both;
  animation-delay: calc(var(--chance-index) * 16ms);
}

.soulha-word-puzzle .hint-panel[hidden] { display: none; }
.soulha-word-puzzle .hint-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 13px 16px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
}
.soulha-word-puzzle .hint-topline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 30px;
}
.soulha-word-puzzle .hint-label {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 20px;
  line-height: 1.4;
}
.soulha-word-puzzle .hint-direction-choices[hidden] { display: none; }
.soulha-word-puzzle .hint-direction-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.soulha-word-puzzle .hint-direction-button, .soulha-word-puzzle .initial-hint-button {
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid rgba(46,120,84,.42);
  border-radius: 999px;
  background: rgba(255,254,248,.84);
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}
.soulha-word-puzzle .hint-direction-button.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--cell);
}
.soulha-word-puzzle .hint-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}
.soulha-word-puzzle .hint-line, .soulha-word-puzzle .hint-initial {
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.soulha-word-puzzle .hint-line strong, .soulha-word-puzzle .hint-initial strong {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 14px;
}
.soulha-word-puzzle .hint-initial span {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .08em;
}
.soulha-word-puzzle .hint-guide {
  color: var(--muted);
  font-size: 14px;
}
.soulha-word-puzzle .initial-hint-button {
  align-self: flex-start;
  margin-top: 1px;
}
.soulha-word-puzzle .hint-panel.hint-refresh .hint-line, .soulha-word-puzzle .hint-panel.hint-refresh .hint-initial, .soulha-word-puzzle .hint-panel.hint-refresh .hint-guide {
  animation: hint-in 210ms ease both;
}

.soulha-word-puzzle .actions {
  height: 56px;
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.soulha-word-puzzle .button {
  min-width: 0;
  width: 100%;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  transition: transform 100ms ease, filter 100ms ease, background-color 160ms ease, box-shadow 160ms ease;
}
.soulha-word-puzzle .button:active { transform: translateY(1px); }
.soulha-word-puzzle .button:focus-visible { outline: 3px solid rgba(46, 120, 84, .28); outline-offset: 2px; }
.soulha-word-puzzle .button-secondary {
  border-color: var(--border);
  background: var(--cell);
  color: var(--ink);
}
.soulha-word-puzzle .button-chance {
  border: 2px solid var(--accent);
  background: var(--cell);
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
}
.soulha-word-puzzle .button-chance:hover {
  background: var(--accent-soft);
}
.soulha-word-puzzle .button-chance { flex: 0 0 70px; }
.soulha-word-puzzle .button-hint, .soulha-word-puzzle .button-restart { flex: 0 0 112px; }
.soulha-word-puzzle .button-primary {
  flex: 0 0 138px;
  margin-left: auto;
  background: var(--accent);
  color: var(--cell);
}
.soulha-word-puzzle .button-primary.is-ready { box-shadow: 0 0 0 4px rgba(46,120,84,.12); }
.soulha-word-puzzle .button:hover { filter: brightness(.985); }

.soulha-word-puzzle .share-row {
  width: min(var(--content-width), 100%);
}
.soulha-word-puzzle .button-share {
  min-height: 44px;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
}
.soulha-word-puzzle .button-share:hover { background: var(--accent-soft); }

.soulha-word-puzzle .round-toast[hidden] { display: none; }
.soulha-word-puzzle .round-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 100;
  transform: translate(-50%, -44%) scale(.96);
  padding: 15px 24px;
  border-radius: 999px;
  color: #fff;
  background: rgba(46,120,84,.94);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.025em;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 12px 38px rgba(0,0,0,.18);
  transition: opacity 160ms ease, transform 180ms ease;
}
.soulha-word-puzzle .round-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.soulha-word-puzzle .round-toast[data-tone="error"] { background: rgba(189,63,63,.95); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

@keyframes correct-pop {
  0% { transform: scale(.94); }
  65% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

@keyframes attention {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(.93); box-shadow: inset 0 0 0 3px var(--error); }
}

@keyframes chance-in {
  0% { opacity: 0; transform: translateY(3px) scale(.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes hint-in {
  0% { opacity: 0; transform: translateY(3px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes board-success {
  0% { filter: brightness(1); transform: scale(1); }
  45% { filter: brightness(1.08); transform: scale(1.006); }
  100% { filter: brightness(1); transform: scale(1); }
}

@media (max-width: 760px) {
  
  .soulha-word-puzzle .game-shell {
    width: 100%;
    min-height: 0;
    padding: max(18px, env(safe-area-inset-top)) 0 max(20px, env(safe-area-inset-bottom));
    border-radius: 0;
    background: #fff;
  }
  .soulha-word-puzzle .game-header, .soulha-word-puzzle .board-wrap, .soulha-word-puzzle .status-row, .soulha-word-puzzle .actions, .soulha-word-puzzle .share-row, .soulha-word-puzzle .chance-panel, .soulha-word-puzzle .hint-panel { width: 100%; }
  .soulha-word-puzzle .intro h2 { font-size: clamp(23px, 6.6vw, 27px); line-height: 1.4; }
  .soulha-word-puzzle .intro p { font-size: clamp(13px, 3.7vw, 17px); }
  .soulha-word-puzzle .cell { font-size: clamp(16px, 5vw, 21px); }
  .soulha-word-puzzle .status-row { padding: 0; font-size: 18px; }
  .soulha-word-puzzle .stage-status { font-size: 15px; }
  .soulha-word-puzzle .chance-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .soulha-word-puzzle .chance-heading strong { font-size: 18px; }
  .soulha-word-puzzle .chance-heading span { font-size: 14px; }
  .soulha-word-puzzle .chance-letter { width: 32px; height: 32px; font-size: 15px; }
  .soulha-word-puzzle .actions {
    height: 50px;
    display: flex;
    align-items: stretch;
    gap: 6px;
  }
  .soulha-word-puzzle .button {
    min-width: 0;
    padding: 0 4px;
    font-size: clamp(12px, 3.45vw, 14px);
    white-space: nowrap;
  }
  .soulha-word-puzzle .button-chance {
    flex: 0 0 68px;
    width: 68px;
    font-size: 13px;
  }
  .soulha-word-puzzle .button-hint,
  .soulha-word-puzzle .button-restart,
  .soulha-word-puzzle .button-primary {
    flex: 1 1 0;
    width: auto;
    margin-left: 0;
  }
  .soulha-word-puzzle .hint-label { font-size: 18px; }
  .soulha-word-puzzle .hint-text { font-size: 14px; }
  .soulha-word-puzzle .hint-topline { align-items: flex-start; flex-direction: column; gap: 6px; }
  .soulha-word-puzzle .round-toast { font-size: 19px; }
}

@media (max-width: 420px) {
  .soulha-word-puzzle .actions { gap: 4px; }
  .soulha-word-puzzle .button { font-size: 12px; padding: 0 2px; }
  .soulha-word-puzzle .button-chance { flex-basis: 62px; width: 62px; font-size: 12px; }
  .soulha-word-puzzle .chance-letters { gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .soulha-word-puzzle *, .soulha-word-puzzle *::before, .soulha-word-puzzle *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

.soulha-word-puzzle .hint-direction-button:disabled, .soulha-word-puzzle .initial-hint-button:disabled {
  opacity: .38;
  cursor: not-allowed;
  filter: grayscale(.25);
}

.soulha-word-puzzle { width: 100%; display:flex; justify-content:center; padding:0; background:transparent; }
@media (max-width:760px){ .soulha-word-puzzle { padding:0; } }
