/* Font dots */
.font-dots {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-start;
  min-height: 1rem;
}

.font-dots .dot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--sub-color);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: max-content;
}


.font-dots .dot .dot-circle {
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  background: var(--sub-color);
  border: var(--border) solid var(--main-color);
}

.font-dots .dot[aria-pressed="true"] .dot-circle {
  background: var(--main-color);
}

.font-dots .dot .dot-label {
  white-space: nowrap;
}

/* Toggle dots for writing direction */
.toggle-dots {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  align-items: center;
}

.toggle-dots .dot {
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  background: var(--sub-color);
  border: var(--border) solid var(--main-color);
  cursor: pointer;
}

.toggle-dots .dot-label {
  white-space: nowrap;
}

.toggle-dots .dot[aria-pressed="true"] {
  background: var(--main-color);
}
/* ===== Global margin/padding removal (override) ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
}

/* Noto Sans utility class */
.noto-sans {font-family: 'Noto Sans KR', sans-serif;
}

/* Overrides */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;200;300;400;500;600;700;800;900&display=swap');

@keyframes blink {

  0%,
  20%,
  40%,
  60%,
  80%,
  100% {
    opacity: 1;
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    opacity: 0;
  }
}

.flash-highlight {
}

:root {
  /* 기본 색상 */
  --main-color: #ffffff;
  --sub-color: #000000;
  
  /* Dot sizes */
  --dot-size: 0.5rem;
  
  /* 반응형 크기 */
  --font-size: clamp(14px, 1.3vw, 50px);
  --basic-padding: clamp(0.5rem, 2vw, 2rem);
  --basic-margin: clamp(0.25rem, 1vw, 1rem);
  --border: clamp(1px, 0.1vw, 2px);
  --text-editor-height: 400px;
  
  
  /* 스크롤바 */
  --scrollbar-xs: 6px;
  --scrollbar-sm: 8px;
  --scrollbar-lg: 12px;
  
  /* CSS 스케일링 */
  --css-scale: 1;
}


  /* Text Editor */
  #textEditor {
    height: var(--text-editor-height);
    width: 100%;
    box-sizing: border-box;
    padding: 1rem;
    margin: 0;
    overflow: auto;
  }
/* 스크롤바 */
.scrollable,
  html {
    font-size: var(--font-size);
    scrollbar-width: thin;
    scrollbar-color: var(--main-color) var(--sub-color);
  }

*::-webkit-scrollbar {
  width: var(--scrollbar-xs);
  height: var(--scrollbar-xs);
}

*::-webkit-scrollbar-track {
  background: var(--sub-color);
}

*::-webkit-scrollbar-thumb {
  background: var(--main-color);
  border-radius: 9999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--main-color) 70%, #000 30%);
}

@media (min-width: 768px) {
  *::-webkit-scrollbar {
    width: var(--scrollbar-sm);
    height: var(--scrollbar-sm);
  }
}

@media (min-width: 1280px) {
  *::-webkit-scrollbar {
    width: var(--scrollbar-lg);
    height: var(--scrollbar-lg);
  }
}

/* 5. 실제 스크롤 나는 div 에 .scrollable 지정 ------------------ */

/* Body layout */
body {
  font-family: 'Noto Sans KR', sans-serif;
  display: block;
  box-sizing: border-box;
  overflow: visible;
  line-height: 1.65;
  word-break: keep-all;
  color: var(--main-color);
  background-color: var(--sub-color);
}

.main-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
}

body::selection {
  background: var(--main-color);
  color: #000;
}

.main-body::-moz-selection {
  background: var(--main-color);
  color: #000;
}







.range-name {
  writing-mode: tb;
  
  word-break: keep-all;
  white-space: nowrap;
}

.range-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  align-items: center;
}

.slider-wrapper {
  transform-origin: center;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.input-sizing {
  width: max-content;
  height: 12vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.customRange {
  transform: rotate(-90deg);
  -webkit-appearance: none;
  appearance: none;
  width: 12vh;
  height: var(--border);
  background: var(--main-color);
  cursor: pointer;
}

/* Chrome & Safari */
.customRange::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: calc(var(--basic-padding)*0.7);
  height: calc(var(--basic-padding)*0.7);
  background: #333;
  border-radius: 50%;
  cursor: pointer;
}

.functions-container button {
  all: unset;
  background-color: var(--main-color);
  width: calc(var(--basic-padding)*0.7);
  height: calc(var(--basic-padding)*0.7);
  border-radius: 50%;
}



/* Headings */

/* functions containers */
.functions-container {
  display: flex;
  flex-direction: column;
  position: relative;
  gap: 0;
  top: 0;
  visibility: visible;
  overflow: visible;
  clear: both;
}



/* Glyph container */
.glyph-container {
  display: flex;
  flex-direction: column;
  overflow: visible;
  position: relative;
  gap: 0;
  top: 0;
  visibility: visible;
  clear: both;
}

.glyphs {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 0.5rem;
  overflow: hidden;
}

@media screen and (max-width: 1280px) {
  .glyphs {
    grid-template-columns: 1fr 2fr;
  }
}

@media screen and (max-width: 768px) {
  .glyphs {
    grid-template-columns: 1fr 1fr;
  }
}

/* 글리프 미리보기 섹션 */
.glyphs-cover {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  width: 100%;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--sub-color);
}

.glyphs-title {
  font-size: var(--font-size);
  margin-bottom: 1rem;
  text-align: center;
  font-family: 'Noto Sans KR', sans-serif;
}

.preview {
  width: -webkit-fill-available;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--sub-color);
  border: var(--border) solid var(--main-color);
  font-size: var(--font-size);
  color: var(--main-color);
  text-align: center;
  position: relative;
}

/* 글리프 목록 섹션 */
.glyphs-contents {
  display: flex;
  flex-direction: row;
  overflow-x: hidden;
  overflow-y: hidden;
  height: 100%;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
}

/* 글리프 그룹 */
.glyph-group {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  overflow-y: hidden;
  padding-bottom: 1px;
  align-items: center;
}

/* 슬라이드 네비게이션 */
.slide-navigation {
  position: absolute;
  display: flex;
  justify-content: space-between;
  z-index: 20;
  top: 1rem;
  width: -webkit-fill-available;
  height: -webkit-fill-available;
  pointer-events: none;
  align-items: flex-start;
}

.slide-btn {
  width: 2rem;
  height: 2rem;
  background-color: var(--sub-color);
  color: var(--main-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  pointer-events: auto;
  padding-bottom: 0.2rem;
}

.slide-btn:hover {
}

.glyphs-characters {
  display: flex;
  flex-wrap: wrap;
  margin-left: 0.5px;
  justify-content: center;
}

.glyphs-characters div {
  font-size: calc(var(--font-size) * 2);
  height: calc(var(--font-size) * 2.5);
  aspect-ratio: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  outline: var(--border) solid var(--main-color);
  outline-offset: -0.5px;
  user-select: none;
  position: relative;
  z-index: 1;
}

/* 반응형 스케일링은 JavaScript에서 처리됨 */

.glyphs-characters div span {
  transform: translateY(0);
  text-rendering: optimizeLegibility;
  font-feature-settings: "liga"0, "calt"0;
  font-variant-emoji: text;
  unicode-bidi: isolate;
  direction: ltr;
}

.glyphs-characters div:hover {
  background-color: var(--main-color);
  color: var(--sub-color);
  cursor: pointer;
}


@media screen and (max-width: 768px) {
  .glyphs-characters div::before {
    min-width: 20vw;
    min-height: 20vh;
  }
}




.glyphs-cover {
  position: relative;
  z-index: 1;
}


.glyphs-title {
  padding-top: 1rem;
}




/* Font Preview Styles */
.font-preview {
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  gap: 1rem;
  padding: 0;
  margin: 0;
  overflow: visible;
}

.font-selector-section {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.font-selector-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
}

.credit-section {
  flex: 0 0 auto;
  text-align: right;
}


.controls-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: center;
  min-height: 60px;
  padding: 1rem 0;
  margin: 0;
  box-sizing: border-box;
  overflow: visible;
}

.writing-mode-control,
.font-size-control,
.letter-spacing-control,
.line-height-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
}

.font-preview div[contenteditable] {
  -webkit-appearance: none;
  -moz-appearance: none;
  display: flex;
  width: 100%;
  max-height: var(--text-editor-height);
  overflow: auto;
  background-color: var(--sub-color);
  line-height: calc(1.5 * 30px);
  outline: none;
  border: var(--border) solid var(--main-color);
  flex-direction: column;
  z-index: 1;
  box-sizing: border-box;
  margin: 0;
  padding: 1rem;
}

/* 세로쓰기일 때 크기 조정 */
.font-preview div[contenteditable][style*="vertical-rl"] {
  width: 100% !important;
  height: var(--text-editor-height) !important;
  max-width: 100% !important;
  min-width: 100% !important;
  box-sizing: border-box !important;
}

.credit a {
  color: #ccc;
  text-decoration: none;
  text-align: right;
  position: absolute;
  right: 0;
}

.control-icon {
  width: 30px;
  display: flex
;
  flex-direction: row;
  align-items: flex-end;
}

.control-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: min-content;
  text-align: left;
  line-height: 1;
  white-space: nowrap;
}

#fristSection {
  -webkit-appearance: none;
  -moz-appearance: none;
  display: grid;
  grid-template-columns: 1fr 3fr;
}

.select-control {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  height: 38px;
  background: var(--sub-color);
  border: var(--border) solid var(--main-color);
  border-radius: 0;
  cursor: pointer;
  outline: none;
}

.select-control:focus {
  border-color: var(--main-color);
}

#writingMode .nameofrange:nth-child(2) {
  display: none;
}


#secondSection {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-gap: 0;
  background-color: var(--sub-color);
  border: var(--border) solid var(--main-color);
  align-items: center;
}

#editableDiv {
  overflow: visible;
}

.control-input {
  width: 100%;
  display: flex;
}

.control-input input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 2px;
  outline: none;
  border-radius: var(--basic-margin);
  border: var(--border) solid var(--main-color);
  background: var(--sub-color);
}

.control-input input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: var(--basic-margin);
  border: var(--border) solid var(--main-color);
  background: var(--sub-color);
  cursor: pointer;
}

.control-input input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--sub-color);
}

.control-input select {
  width: 100%;
  padding: 0.5rem;
  border: var(--border) solid var(--main-color);
  background: var(--sub-color);
  color: var(--main-color);
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  font-size: var(--font-size);
  height: 3em;
}

.control-input select:hover {
  background: var(--main-color);
  color: var(--sub-color);
}

.control-input select:focus {
  border-color: var(--main-color);
  border: var(--border) solid var(--main-color);
}

.font-select {
  width: 15rem !important;
  height: 2rem;
}

/* 아이콘 래퍼 */
.icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
}

/* 아이콘 사이즈 조정 클래스들 */
.icon-writing-direction {
  width: 1rem;
  height: 1.5rem;
  transition: transform 0.3s ease;
  fill: var(--main-color);
}

/* 세로쓰기 선택 시 아이콘 회전 */
body[data-direction="1"] .writing-mode-control .icon-wrapper svg {
  transform: rotate(90deg);
}

.writing-mode-control .icon-wrapper svg {
  transition: transform 0.3s ease;
}

.icon-font-size {
  width: 1rem;
  height: 1.5rem;
  fill: var(--main-color);
}

.icon-letter-spacing {
  width: 1.5rem;
  height: 1.5rem;
  fill: var(--main-color);
}

.icon-line-height {
  width: 1rem;
  height: 1.5rem;
  fill: var(--main-color);
}

/* SVG 전역 스타일 */
.cls-1 {
  fill: var(--main-color);
  fill: currentColor; /* fallback for mobile browsers */
}

.cls-2 {
  fill: var(--main-color);
  fill: currentColor; /* fallback for mobile browsers */
}

/* 모바일 브라우저에서 SVG 렌더링 강제 적용 */
@media screen and (max-width: 768px) {
  /* SVG 컨테이너 강제 표시 */
  .icon-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 1.5rem !important;
    height: 1.5rem !important;
    min-width: 1.5rem !important;
    min-height: 1.5rem !important;
  }
  
  /* SVG 요소 강제 표시 */
  svg {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 1rem !important;
    min-height: 1rem !important;
    max-width: 1.5rem !important;
    max-height: 1.5rem !important;
    fill: #ffffff !important;
    color: #ffffff !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* 모든 SVG 하위 요소 강제 표시 */
  svg *,
  svg rect,
  svg path,
  svg polygon,
  svg circle,
  svg ellipse,
  svg line,
  svg polyline {
    fill: #ffffff !important;
    color: #ffffff !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* 클래스별 강제 적용 */
  .cls-1,
  .cls-2,
  svg .cls-1,
  svg .cls-2 {
    fill: #ffffff !important;
    color: #ffffff !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* 특정 컨트롤 SVG 강제 표시 */
  .writing-mode-control .icon-wrapper,
  .font-size-control .icon-wrapper,
  .letter-spacing-control .icon-wrapper,
  .line-height-control .icon-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .writing-mode-control svg,
  .font-size-control svg,
  .letter-spacing-control svg,
  .line-height-control svg {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    fill: #ffffff !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}



@media screen and (max-width: 1028px) {
  .controls-section {
    grid-template-columns: repeat(2, 1fr);
  }
  #secondSection {
    grid-template-columns: 1fr 1fr;
    grid-gap: 0;
  }

  #fristSection {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media screen and (max-width: 768px) {
  .font-preview div[contenteditable] {
    line-height: calc(1.5 * 20px);
  }
  #secondSection {
    grid-template-columns: 1fr 1fr;
    grid-gap: 0;
  }

  #fristSection {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media screen and (max-width: 768px) {
  .controls-section {
    grid-template-columns: 1fr;
  }
  
}
