* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Noto Sans KR", Arial, "Apple SD Gothic Neo", sans-serif;
  background-color: #f8fcff;
  color: #111111;
}

button {
  margin: 0;
  padding: 0;
  font: inherit;
  border: 0;
  background-color: transparent;
  cursor: pointer;
}

p {
  margin: 0;
}

ul, li {
  list-style: none;
}

.flex {
  display: flex;
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  padding: 15px 15px;
}

/* language */
.lang_select {
  position: relative;
  justify-content: flex-end;
  font-family: sans-serif;
  z-index: 2;
}

.lang_select .btn_lang {
  padding: 8px;
  font-size: .75rem;
  color: #777;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
  border: 1px solid #d1d1d1;
  border-radius: 5px;
  background-color: #fff;
  cursor: pointer;
  user-select: none;
}

.lang_select .lang_list {
  display: none;
  position: absolute;
  top: 35px;
  right: 0;
  width: 100px;
  margin: 0;
  padding: 5px 0;
  background-color: #fff;
  border: 1px solid #aadafa;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.lang_select.active .lang_list {
  display: block;
}

.lang_select .lang_list li {
  width: 100%;
  background-color: #fff;
}

.lang_select .lang_list li[aria-selected="true"] {
  font-weight: bold;
  background-color: #aadafa;
}

.lang_select .lang_list button {
  width: 100%;
  padding: 5px 10px;
  color: #111;
  font-size: 0.75rem;
  text-align: left;
}

.lang_select .lang_list button:hover {
  background-color: #aadafa;
}

/* header*/
.header {
  flex-flow: column;
  gap: 15px;
  width: 100%;
  margin-bottom: 30px;
  text-align: center;
}

.header .title {
  margin: 0;
  color: #aadafa;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
}

.header .subtitle {
  margin: 12px 0 0;
  color: #555555;
  font-size: 14px;
}

/* content */
.content {
  width: 100%;
  display: flex;
  justify-content: center;
}

.fav9_section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fav9_grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 520px;
}

.grid_slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 0.9 / 1.2;
  border: 2px dashed #aadafa;
  border-radius: 14px;
  background-color: #fff;
  cursor: pointer;
  outline: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.grid_slot.filled {
  border: 0;
}

.grid_slot:focus,
.grid_slot:focus-visible,
.grid_slot:active {
  outline: none;
  box-shadow: none;
}

.grid_slot:hover {
  transform: translateY(-2px);
  background-color: #edf7ff;
}

.grid_slot .number {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 22px;
  height: 22px;;
  border-radius: 50% 50%;
  background-color: #aadafa;
  color: #333;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.grid_slot .label {
  color: #aadafa;
  font-size: 1.5rem;
}

.grid_slot .img_slot {
  position: absolute;
  top: 0;
  bottom: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  object-fit: cover;
  z-index: 1;
}

.grid_slot:has(img) {
  border: 0;
}

.grid_slot .btn_delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: #333;
  z-index: 2;
}

.btn_area {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 520px;
  margin-top: 30px;
}

.btn_area .btn {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 15px;
  border-radius: 10px;
  background-color: #aadafa;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.btn_area .btn:hover {
  background-color: #85c7f3;
  transform: translateY(-1px);
}

.btn_area .btn:disabled {
  background-color: #919191;
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn_area .btn.reset {
  border: 1px solid #d1d1d1;
  background-color: #fff;
  color: #777;
}

.btn_area .btn.reset:hover {
  background-color: #fcfcfc;
}

.footer {
  margin-top: 35px;
  text-align: center;
}

.footer .link {
  display: block;
  color: #555;
  font-size: .75rem;
  text-decoration: none;
}

.footer .link:hover {
  color: #111;
}

/* image modal */
.image_modal {
  position: fixed;
  display: none;
  align-items: center;
  justify-content: center;
  inset: 0;
  z-index: 999;
}

.image_modal.open {
  display: flex;
}

.image_modal_dim {
  position: absolute;
  background: rgba(0, 0, 0, 0.55);
  inset: 0;
}

.image_modal_content {
  position: relative;
  width: calc(100% - 32px);
  max-width: 460px;
  padding: 20px 15px;
  border-radius: 16px;
  background-color: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  z-index: 1;
}

.image_modal_close {
  position: absolute;
  top: 16px;
  right: 12px;
  color: #666;
  font-size: 20px;
  font-weight: bold;
}

.image_modal_title {
  margin: 0 0 10px;
  color: #222;
  font-size: 1rem;
  font-weight: 700;
}

.image_modal_body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.image_modal_text {
  color: #555;
  font-size: 0.875rem;
}

.image_upload_btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 35px;
  padding: 0 15px;
  border-radius: 999px;
  background-color: #aadafa;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.image_upload_btn:hover {
  background-color: #85c7f3;
}

.image_modal_tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.image_modal_tab {
  flex: 1;
  height: 42px;
  border: 1px solid #d1d1d1 ;
  border-radius: 10px;
  background-color: #fff;
  color: #777;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.image_modal_tab.active {
  border-color: #5ebeff;
  background-color: #85c7f3;
  color: #fff;
}

.image_modal_panel {
  display: none;
}

.image_modal_panel.active {
  display: block;
}

.image_search_box {
  display: flex;
  gap: 5px;
  width: 100%;
}

.image_search_input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border: 1px solid #d8d8d8;
  border-radius: 10px;
  font: inherit;
}

.image_search_btn {
  min-width: 72px;
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  background-color: #aadafa;
  color: #fff;
  font-weight: 600;
}

.image_search_btn:hover {
  background-color: #85c7f3;
}

.image_search_result {
  max-height: 300px;
  padding: 12px;
  border: 1px solid #eeeeee;
  border-radius: 12px;
  background-color: #fafafa;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.image_search_empty {
  margin: 0;
  font-size: 0.875rem;
  color: #888;
}

.image_result_grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.image_result_item {
  position: relative;
  aspect-ratio: 1 / 1.2;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  overflow: hidden;
  background-color: #fff;
  cursor: pointer;
}

.image_result_item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image_search_tip {
  font-size: 0.75rem;
  color: #555;
  word-break: break-all;
}

@media (min-width: 521px) {
  .btn_area {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}