* { box-sizing: border-box; }

body {
  margin: 0;
  background: #eef2f8;
  color: #16202e;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 14px 40px;
}

.head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

h1 {
  font-size: 22px;
  margin: 0;
}

.count {
  margin: 0;
  font-size: 13px;
  color: #5b6b81;
}

.search {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

#q {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #c7d2e0;
  border-radius: 10px;
  background: #fff;
  color: inherit;
}

#q:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

#clear {
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #c7d2e0;
  border-radius: 10px;
  background: #fff;
  color: #33415c;
  cursor: pointer;
}

#clear:hover { background: #f2f5fa; }

.status-wrap { margin: 0 0 10px; }

.status {
  margin: 0 0 6px;
  font-size: 14px;
  color: #b91c1c;
  line-height: 1.5;
}

#retry {
  padding: 8px 14px;
  font-size: 14px;
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 10px;
}

.card {
  width: 100%;
  min-height: 104px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #fff;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  position: relative;
}

.card:hover { border-color: #2563eb; box-shadow: 0 2px 10px rgba(37, 99, 235, .14); }

.card-num {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 11px;
  color: #7c8aa0;
}

.card-sym {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .5px;
  color: #1d4ed8;
}

.card-name {
  font-size: 13px;
  color: #33415c;
  word-break: keep-all;
  text-align: center;
}

.empty {
  margin: 24px 0 0;
  text-align: center;
  font-size: 14px;
  color: #5b6b81;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 10;
}

.modal[hidden] { display: none; }

.sheet {
  position: relative;
  width: 100%;
  max-width: 300px;
  padding: 26px 20px 22px;
  border-radius: 16px;
  background: #fff;
  text-align: center;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .3);
}

.close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: #5b6b81;
  cursor: pointer;
}

.close:hover { background: #eef2f8; }

.m-num {
  display: block;
  font-size: 13px;
  color: #7c8aa0;
  margin-bottom: 4px;
}

.m-sym {
  display: block;
  font-size: 52px;
  font-weight: 700;
  color: #1d4ed8;
  line-height: 1.1;
}

.m-name {
  margin: 6px 0 0;
  font-size: 18px;
}

@media (max-width: 420px) {
  h1 { font-size: 19px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
  .card { min-height: 92px; }
  .card-sym { font-size: 22px; }
}
