* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f8fafc;
  color: #0f172a;
  font-family: system-ui, 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

body {
  margin: 0;
  min-height: 100dvh;
}

button,
input {
  font: inherit;
}

.app {
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}

.home-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.08);
  font-size: 24px;
  line-height: 1;
}

.time-badge {
  border: 1px solid rgb(21 94 117 / 0.55);
  border-radius: 999px;
  background: #fff;
  padding: 4px 12px;
  color: #155e75;
  font-size: 14px;
  font-weight: 800;
}

.input-view {
  display: flex;
  min-height: calc(100dvh - 108px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  text-align: center;
}

.hidden {
  display: none;
}

.app-icon {
  display: grid;
  width: 128px;
  height: 128px;
  place-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 18px 45px rgb(15 23 42 / 0.1);
  color: #155e75;
  font-size: 72px;
  font-weight: 900;
  line-height: 1;
}

.app-icon.small {
  width: 94px;
  height: 94px;
  border-radius: 22px;
  font-size: 54px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #64748b;
  font-size: 14px;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: 52px;
  line-height: 1.05;
}

.primary-button,
.ghost-button {
  width: 100%;
  min-height: 54px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
}

.primary-button {
  border: 0;
  background: #155e75;
  color: #fff;
  box-shadow: 0 10px 22px rgb(21 94 117 / 0.24);
}

.ghost-button {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #0f172a;
}

.input-grid {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  color: #475569;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
}

.field input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px 8px;
  background: transparent;
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
}

.input-note {
  margin: -10px 0 0;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}

.result-view {
  min-height: calc(100dvh - 68px);
  margin: 8px -8px 0;
  border-radius: 8px;
  background: #f8fafc;
  color: #111827;
  padding: 10px 2px 16px;
}

.result-meta {
  display: grid;
  gap: 5px;
  padding: 0 8px 12px;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
}

.result-meta strong {
  color: #111827;
  font-size: 15px;
  line-height: 1.4;
}

.sike-section {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.sike-card {
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  padding: 10px 5px 12px;
  text-align: center;
}

.sike-card h2,
.samjeon-grid h3 {
  margin: 0 0 7px;
  color: #334155;
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}

.noble {
  min-height: 18px;
  margin: 0 0 6px;
  color: #155e75;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
}

.upper,
.lower {
  margin: 0 auto;
  color: #fff;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

.glyph-box {
  display: grid;
  width: min(68px, 100%);
  aspect-ratio: 1;
  place-items: center;
  border: 4px solid #111827;
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.28);
}

.lower {
  margin-top: 8px;
}

.tone-water {
  background: #111827;
  color: #fff;
}

.tone-fire {
  background: #dc2626;
  color: #fff;
}

.tone-wood {
  background: #86efac;
  color: #052e16;
}

.tone-metal {
  background: #e5e7eb;
  color: #111827;
}

.tone-earth {
  background: #facc15;
  color: #111827;
}

.principle {
  margin: 14px 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  padding: 12px 10px;
  text-align: center;
}

.principle p {
  margin: 0;
  color: #155e75;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.2;
}

.samjeon-section h2 {
  margin: 0 0 12px;
  text-align: center;
  color: #111827;
  font-size: 20px;
  font-weight: 900;
}

.samjeon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  text-align: center;
}

.samjeon-grid > div {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  padding: 12px 8px;
}

.samjeon-grid h3 {
  margin-bottom: 12px;
  color: #334155;
  font-size: 17px;
}

.result-view .ghost-button {
  margin-top: 16px;
}

@media (max-width: 380px) {
  .app {
    padding-left: 14px;
    padding-right: 14px;
  }

  .result-view {
    margin-left: -8px;
    margin-right: -8px;
  }

  .sike-card h2 {
    font-size: 14px;
  }

  .upper,
  .lower {
    font-size: 36px;
  }
}
