:root{
  --bg:#f7f6f2;
  --bg-2:#f0efe9;
  --panel:#ffffff;
  --text:#111114;
  --muted:#6f6b63;
  --line: rgba(17,17,20,.08);
  --line2: rgba(17,17,20,.12);
  --radius:12px;
  --shadow: 0 2px 10px rgba(0,0,0,.04);
}
*{ box-sizing: border-box; }
body{
  margin:0;
  background: linear-gradient(180deg, var(--bg), var(--bg-2));
  color:var(--text);
  font: 15px/1.5 "Source Sans 3", "Segoe UI", sans-serif;
}
body.is-loading .app,
body.is-loading .langSetup,
body.is-loading .modal{
  filter: blur(12px);
}
body.is-loading{
  pointer-events: none;
}
button, input, select{ font: inherit; }
a{ color: inherit; }
code{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; font-size: 12px; }

.app{
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px;
  min-height: 100vh;
  display:flex;
  flex-direction:column;
}

.card{
  background: transparent;
  border: none;
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: none;
  flex: 1;
  display:flex;
  flex-direction:column;
}


.header{
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.brand{ font-weight: 650; letter-spacing:.2px; font-size: 14px; opacity: .95; display:flex; align-items:center; justify-content:space-between; gap:10px; }
.badge{
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line2);
  background: #fff;
  border-radius: 999px;
  padding: 4px 8px;
}

.controls{
  padding: 10px;
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.footerNote{
  margin: auto 10px 14px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  letter-spacing: .02em;
  width: 100%;
}
.searchRow{
  display:flex;
  gap: 8px;
  align-items:center;
  width: 100%;
}
.searchRow .autocomplete{
  flex: 1;
}
.recommendBtn{
  white-space: nowrap;
}
#tagSearch{
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px 50%;
  background-size: 16px;
}
.recommendBtn{
  display:flex;
  align-items:center;
  gap: 8px;
}
.recommendBtn::before{
  content:"";
  width:16px;
  height:16px;
  display:inline-block;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 22 9 12 22 2 9 12 2'/%3E%3Cpath d='M2 9h20'/%3E%3Cpath d='M12 2v20'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
}
.pageTitle{
  font-size: clamp(36px, 8vw, 90px);
  font-weight: 600;
  text-align: center;
  line-height: 1.1;
  letter-spacing: .02em;
  color: var(--text);
}
.pageTitle.titleImage{
  background-image: var(--title-src);
  background-size: cover;
  background-position: center;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
#tagPills,
[data-i18n="ui.tagsLabel"]{
  display:none;
}
.dayImage{ display:none; }
body.search-only .controls{
  align-items:center;
  padding-top: 20vh;
}
body.search-only .pageTitle{
  margin-bottom: 6px;
}
body.search-only .autocomplete{
  width: min(520px, 92vw);
}
body.search-only .searchRow{
  width: min(660px, 92vw);
}
body.search-only #textPanel{
  display:none;
}
body.search-only #tagPills{
  display:flex;
  justify-content:center;
  width: min(640px, 92vw);
}
body.search-only .pills{
  justify-content:center;
}
body.search-only .gridWrap{
  display:none;
}
.field{
  width:100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line2);
  background: #fff;
  color: var(--text);
  outline: none;
}
.field::placeholder{ color: rgba(17,17,20,.45); }
.row{
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
}
.row > .field{ width:auto; flex:1 1 180px; }
.fieldGroup{
  width:auto;
  flex:1 1 180px;
  display:flex;
  flex-direction:column;
  gap: 4px;
}
.customTextRow{
  display:flex;
  gap: 10px;
  align-items:flex-start;
  flex-wrap:wrap;
}
.customTextCol{
  flex: 1 1 260px;
  min-width: 220px;
}
.fontCol{
  flex: 0 0 160px;
  min-width: 140px;
  display:flex;
  flex-direction:column;
  gap: 4px;
}
.miniLabel{
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 2px 2px;
}
.miniLabel.slimLabel{
  font-size: 9px;
  letter-spacing: .12em;
  opacity: 0.7;
  margin: 0 1px 4px;
}
.label{
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 2px 6px;
}

.autocomplete{
  position: relative;
}
.acBox{
  position:absolute;
  left:0; right:0;
  top: calc(100% + 8px);
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 10px;
  overflow:hidden;
  display:none;
  z-index: 20;
}
.acItem{
  padding: 8px 10px;
  cursor:pointer;
  border-top: 1px solid var(--line);
  background: #fff;
}
.acItem:first-child{ border-top:0; }
.acItem:hover, .acItem[aria-selected="true"]{ background: rgba(17,17,20,.04); }

.pills{ display:flex; flex-wrap:wrap; gap:6px; }
.pillBtn{
  border: 1px solid var(--line2);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.pillBtn:hover{ background: rgba(17,17,20,.04); }
.pillBtn.selected{ background: rgba(17,17,20,.06); border-color: rgba(17,17,20,.18); }

.mainTitle{
  padding: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-weight: 650;
  font-size: 14px;
}

.gridWrap{
  padding: 8px;
  display:grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr;
  align-items:center;
  justify-items:center;
  gap: 6px;
  flex: 1;
  position: relative;
  overflow: hidden;
}
.gridWrap::before{
  content:"";
  position:absolute;
  inset:0;
  background-image: var(--hero-src);
  background-size: cover;
  background-position: center;
  filter: blur(28px) saturate(1.05);
  transform: scale(1.08);
  opacity: .35;
  pointer-events: none;
}
.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
  height: 100%;
  max-width: none;
  grid-row: 2;
  grid-column: 1;
  position: relative;
  z-index: 1;
  justify-items: center;
  align-items: center;
}
#empty{
  grid-row: 2;
  grid-column: 1;
  position: relative;
  z-index: 1;
}

.tile{
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow:hidden;
  background: #fff;
  cursor:pointer;
  padding: 0;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
  display:flex;
  align-items:center;
  justify-content:center;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}
.tile img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}
.muted{ color: var(--muted); font-size: 12px; }

.pager{
  padding: 10px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 8px;
  border-top: 1px solid var(--line);
}
.pagerNav{
  position: absolute;
  inset: 0;
  padding: 0;
  border: none;
  z-index: 2;
  pointer-events: none;
  align-items: stretch;
}
.pageActions{
  grid-row: 1;
  grid-column: 1;
  width: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 6px;
  padding: 8px 0 4px;
  position: relative;
  z-index: 1;
}
.pageActions .actionBtn{
  font-size: 15px;
  padding: 9px 14px;
}
.pageActions .actionBtn::before{
  width:16px;
  height:16px;
  background-size: 16px;
}
.actionBtn{
  display:flex;
  align-items:center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12px;
}
.actionBtn::before{
  content:"";
  width:14px;
  height:14px;
  display:inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px;
}
.downloadBtn::before{
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E");
}
.shareBtn::before{
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='18' cy='5' r='3'/%3E%3Ccircle cx='6' cy='12' r='3'/%3E%3Ccircle cx='18' cy='19' r='3'/%3E%3Cline x1='8.6' y1='13.5' x2='15.4' y2='17.5'/%3E%3Cline x1='15.4' y1='6.5' x2='8.6' y2='10.5'/%3E%3C/svg%3E");
}
.pagerBtn{
  min-width: 56px;
  padding: 10px 18px;
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
  border-color: rgba(255,255,255,.35);
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.pagerBtn:hover{
  background: transparent;
  border-color: rgba(255,255,255,.5);
  transform: translateY(-1px);
}
.pagerBtn:disabled{
  opacity: .35;
  transform: none;
}
.pagerNav .pagerBtn{
  height: 100%;
  min-width: 72px;
  font-size: 30px;
  border-radius: 0;
  pointer-events: auto;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.pagerNav .pagerBtn:first-child{
  border-left: none;
}
.pagerNav .pagerBtn:last-child{
  border-right: none;
}
.pill{
  border: 1px solid var(--line2);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff;
  color: var(--text);
  cursor:pointer;
}
.pill:hover{ background: rgba(17,17,20,.04); }
.pill.ghost{
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
.pagerBtn{
  background: transparent;
}
.pagerBtn:hover{
  background: transparent;
}
#textActions{
  display: none;
  margin-top: 6px;
}
.textActions{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.textActions .pill{
  padding: 6px 10px;
  font-size: 12px;
}
#textInfo{
  display: none;
}
.pill:disabled{ opacity: .5; cursor: default; }

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 18px;
  z-index: 50;
}
.modal.open{ display:flex; }

.langSetup{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(247,246,242,.9);
  z-index: 70;
}
.langSetup.open{ display: flex; }
.langSetupCard{
  width: min(420px, 92vw);
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.langSetupList{
  display: grid;
  gap: 8px;
}
.langSetupOption{
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
  transition: background .12s ease, border-color .12s ease;
}
.langSetupOption:hover{
  background: rgba(17,17,20,.04);
  border-color: rgba(17,17,20,.2);
}

body.lang-setup-open{ overflow: hidden; }
.modalCard{
  width: min(980px, 100%);
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 12px;
  overflow:hidden;
}
.modalTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}
.modalTop .mTitle{
  font-weight: 650;
  font-size: 14px;
  min-width: 0;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modalBody{
  padding: 10px;
  display:grid;
  grid-template-columns: 1fr 340px;
  gap: 10px;
  align-items:start;
}
@media (max-width: 920px){ .modalBody{ grid-template-columns: 1fr; } }
.preview{
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow:hidden;
  background: #fff;
}
.preview img{ width:100%; height:auto; display:block; cursor:pointer; }

.side{
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: rgba(17,17,20,.02);
}
.tagPill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: #fff;
  font-size: 12px;
  line-height: 1;
}
.tagX{
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: .6;
}
.tagX:hover{ opacity: 1; }


.check{display:flex;align-items:center;gap:8px;user-select:none;font-size:14px;opacity:.9}
.check input{width:16px;height:16px}

#customText{min-height:44px;resize:vertical}
#modalGreeting{min-height:120px;resize:vertical}
#colorPicker{width:100%; min-width:140px;}

@media (max-width: 960px){
  .app{ padding: 10px; }
  .controls{ padding: 8px; }
  .gridWrap{ padding: 6px; }
  .pageTitle{ font-size: clamp(34px, 9vw, 72px); }
  .pageActions{ padding: 6px 0 4px; }
}

@media (max-width: 720px){
  .app{ padding: 0; }
  .searchRow{ flex-direction: column; align-items: stretch; }
  .recommendBtn{ width: 100%; justify-content: center; }
  body.search-only .controls{ padding-top: 12vh; }
  body.search-only .autocomplete,
  body.search-only .searchRow,
  body.search-only #tagPills{ width: min(92vw, 520px); }
  .gridWrap{ padding: 0; }
  .grid{ width: 100%; gap: 8px; }
  .tile{ width: 100%; max-width: 100%; }
  .customTextRow{ display: none !important; }
  .fontCol{ flex: 1 1 160px; }
  .pagerNav .pagerBtn{ min-width: 56px; font-size: 24px; }
  .pageActions{ flex-wrap: wrap; }
}

@media (max-width: 520px){
  .pageTitle{ font-size: clamp(30px, 11vw, 56px); }
  .field{ padding: 7px 9px; }
  .pill,
  .pillBtn{ padding: 6px 9px; }
  .pageActions{ padding: 6px 0 2px; }
  .modal{ padding: 10px; }
  .modalCard{ max-height: 92vh; }
  .modalBody{ overflow: auto; }
  .modalTop{ flex-wrap: wrap; }
}
