/* 공통 스타일 */
:root {
  --brand: linear-gradient(135deg, #ef5f5f 0%, #ef5f5f 100%);
  --brand-light: rgba(239, 95, 95, 0.1);
  --brand-color: #ef5f5f;
  --ink: #1a1a1a;
  --ink-sub: #666;
  --btn: #fff;
  --btn-ink: #333;
  --btn-shadow: rgba(0, 0, 0, 0.08);
  --accent: #ef5f5f;
  --accent-light: rgba(239, 95, 95, 0.1);
  --surface: #ffffff;
  --border: rgba(0, 0, 0, 0.06);
  --radius: 24px;
  --radius-small: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-small: 0 4px 16px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  overscroll-behavior: none;
  height: 100%;
  margin: 0;
  padding: 0;
  overscroll-behavior: none;
  background-color: initial;
}
main {
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans KR", sans-serif;
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
}

.wrap {
  min-height: 40vh;
  padding: 30px 20px 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* 상단 네비게이션 */
.top-nav {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: max(env(safe-area-inset-top), 10px) 20px 10px 20px;
  /* 모바일 키보드 대응 */
  transform: translateZ(0);
  will-change: transform;
}

.nav-inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 60px;
}

.top-nav .logo a {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
}

.top-nav .logo a img {
  width: 100px;
  height: auto;
}

.nav-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.home-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  text-decoration: none;
  border-radius: var(--radius-small);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.home-btn:hover {
  background: var(--accent);
  color: white;
}

.home-btn:active {
  transform: scale(0.95);
}

.home-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* 하단 고정 네비게이션 */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 8px) 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.dock-inner {
  max-width: 480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 72px;
  color: var(--btn-ink);
  text-decoration: none;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.action:active {
  transform: scale(0.95);
}

.action svg {
  width: 24px;
  height: 24px;
  stroke: var(--ink-sub);
  stroke-width: 2;
  fill: none;
  z-index: 1;
  transition: all 0.2s ease;
}

.action:active svg {
  stroke: var(--accent);
  transform: scale(1.1);
}

.action span {
  font-size: 12px;
  font-weight: 600;
  z-index: 1;
  color: var(--ink-sub);
  transition: all 0.2s ease;
}

.action:active span {
  color: var(--accent);
}

/* 현재 페이지 활성 상태 */
.action.active svg {
  stroke: var(--accent);
}

.action.active span {
  color: var(--accent);
  font-weight: 700;
}

/* 컨텐츠 카드 */
.content-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.8s ease-out 0.2s both;
  border: 1px solid var(--border);
}

.card-header {
  text-align: center;
  margin-bottom: 24px;
}

.card-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
}

.card-subtitle {
  font-size: 14px;
  color: var(--ink-sub);
  margin: 0;
}

/* 푸터 */
.copyright {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  z-index: 50;
  max-width: 90%;
  line-height: 1.4;
}

/* 애니메이션 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 다크모드 대응 */
@media (prefers-color-scheme: dark) {
  :root {
    --brand: linear-gradient(135deg, #ef5f5f 0%, #ef5f5f 100%);
    --ink: #ffffff;
    --ink-sub: #a0a0a0;
    --btn: #1a1a1a;
    --btn-ink: #ffffff;
    --surface: #1a1a1a;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-small: 0 4px 16px rgba(0, 0, 0, 0.2);
  }
}

/* 반응형 */
@media (max-width: 375px) {
  .wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .content-card {
    padding: 24px 20px;
  }

  .dock {
    padding-left: 16px;
    padding-right: 16px;
  }

  .dock-inner {
    gap: 8px;
  }

  .action {
    height: 68px;
  }
}

/* 큰 화면 대응 */
@media (min-width: 768px) {
  .wrap {
    max-width: 480px;
    margin: 0 auto;
  }
}

/* 모바일 키보드 대응 */
.keyboard-active .wrap {
  padding-top: 10px !important;
  padding-bottom: 20px !important;
  transition: padding 0.3s ease;
}

.keyboard-active .content-card {
  margin-bottom: 10px !important;
  padding: 20px 15px !important;
}

.keyboard-active .card-header {
  margin-bottom: 15px !important;
}

/* 입력 포커스 시 z-index 조정 */
input:focus,
textarea:focus,
select:focus {
  position: relative;
  z-index: 1000;
}
