/* Layout — mobile-first shell */

.hsk-shell {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--qmf-header-height, 0px));
  background: var(--hsk-canvas, #f5f5f7);
  color: var(--hsk-text-primary, #1d1d1f);
  font-family: var(--hsk-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

.hsk-shell__main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

@media (min-width: 900px) {
  .hsk-shell--with-nav .hsk-shell__main {
    display: grid;
    grid-template-columns: 1fr 280px;
    align-items: start;
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    gap: 16px;
    padding: 0 16px;
  }
}

/* Header — native translucent toolbar */
.hsk-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hsk-border);
}

.hsk-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  max-width: 960px;
  margin: 0 auto;
}

.hsk-header__left { justify-self: start; }
.hsk-header__center { justify-self: center; }
.hsk-header__right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hsk-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.hsk-header__logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--hsk-border), 0 1px 2px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.hsk-header__logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.hsk-header__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.hsk-header__brand-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--hsk-text-primary);
  letter-spacing: -0.01em;
}

.hsk-header__brand-sub {
  font-weight: 600;
  color: var(--qmf-accent-primary);
}

.hsk-header__page-title {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--hsk-text-secondary);
}

.hsk-header__skill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--qmf-accent-primary) 9%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--qmf-accent-primary) 16%, transparent);
  color: var(--qmf-accent-primary);
  font-size: 0.78rem;
  font-weight: 600;
}

.hsk-header__badge-icon {
  display: inline-flex;
}

.hsk-header__badge-icon .hsk-icon {
  width: 0.95rem;
  height: 0.95rem;
}

.hsk-header__score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.05;
}

.hsk-header__score-label {
  font-size: 0.6rem;
  color: var(--hsk-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.hsk-header__score-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--hsk-text-primary);
  font-variant-numeric: tabular-nums;
}

.hsk-header__progress {
  height: 2px;
  background: transparent;
}

.hsk-header__progress-bar {
  height: 100%;
  background: var(--qmf-accent-primary);
  border-radius: 0 2px 2px 0;
  transition: width 0.4s var(--hsk-ease-out);
}

/* Body */
.hsk-body {
  flex: 1;
  padding: 16px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.hsk-body__card {
  background: var(--hsk-surface, #fff);
  border: 1px solid var(--hsk-border);
  border-radius: var(--hsk-radius-xl);
  box-shadow: var(--hsk-shadow-card);
  overflow: hidden;
}

.hsk-body__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--hsk-border);
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.015);
}

.hsk-body__part {
  font-weight: 600;
  color: var(--hsk-text-primary);
}

.hsk-body__range {
  color: var(--hsk-text-secondary);
  font-variant-numeric: tabular-nums;
}

.hsk-body__viewport {
  position: relative;
  min-height: 280px;
  padding: 16px;
}

.hsk-body__content {
  animation: hsk-fade-in 0.28s var(--hsk-ease-out) both;
}

.hsk-body__content--exit {
  animation: hsk-fade-out 0.22s var(--hsk-ease-out) both;
}

/* Footer — native translucent toolbar */
.hsk-footer {
  position: sticky;
  bottom: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--hsk-border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.hsk-footer__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  max-width: 960px;
  margin: 0 auto;
}

.hsk-footer__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.hsk-footer__indicator {
  font-size: 0.75rem;
  color: var(--hsk-text-secondary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.hsk-footer__notice {
  font-size: 0.72rem;
  color: var(--hsk-error);
  font-weight: 600;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.hsk-footer__notice--on {
  opacity: 1;
  transform: translateY(0);
}

.hsk-footer__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  border: none;
  font-size: 0.9rem;
  font-weight: 590;
  cursor: pointer;
  transition: transform 0.12s var(--hsk-ease-out), box-shadow 0.15s, background 0.15s, opacity 0.15s;
}

.hsk-footer__btn:active { transform: scale(0.96); }
.hsk-footer__btn:disabled { opacity: 0.35; cursor: not-allowed; }

.hsk-footer__btn--ghost {
  background: rgba(120, 120, 128, 0.08);
  color: var(--hsk-text-primary);
}

.hsk-footer__btn--ghost:hover:not(:disabled) {
  background: rgba(120, 120, 128, 0.14);
}

.hsk-footer__btn--secondary {
  background: color-mix(in srgb, var(--qmf-accent-primary) 12%, #fff);
  color: var(--qmf-accent-primary);
}

.hsk-footer__btn--primary {
  background: var(--qmf-accent-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 4px 14px color-mix(in srgb, var(--qmf-accent-primary) 32%, transparent);
  justify-self: end;
}

.hsk-footer__btn--primary:hover {
  background: var(--qmf-accent-primary-dark, #3730a3);
}

.hsk-footer__btn--ghost { justify-self: start; }

/* Skeleton */
.hsk-skeleton {
  background: linear-gradient(90deg, rgba(120,120,128,0.08) 25%, rgba(120,120,128,0.16) 50%, rgba(120,120,128,0.08) 75%);
  background-size: 200% 100%;
  animation: hsk-shimmer 1.4s ease infinite;
  border-radius: 8px;
}

.hsk-skeleton--line { height: 14px; margin-bottom: 10px; }
.hsk-skeleton--short { width: 60%; }
.hsk-skeleton--block { height: 120px; margin-top: 16px; }

@media (max-width: 640px) {
  .hsk-header__brand-text { display: none; }
  .hsk-header__inner { grid-template-columns: 1fr 1fr; }
  .hsk-header__center { display: none; }
  .hsk-footer__btn span { display: none; }
  .hsk-footer__btn { padding: 12px; }
}

@media (min-width: 768px) {
  .hsk-body { padding: 24px; }
  .hsk-body__viewport { padding: 24px; min-height: 360px; }
}
