body {
  font-family: sans-serif;
  line-height: 1.2;
  background-color: #e7e5e5;
}

body.page-top {
  margin:0;
  line-height: 1;
}


h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 12px;
}

header{
  padding: 2px 0 3px 3px;
  line-height: 1;

}

#msgBox{
  display:inline-block;
  width:320px;
  height:80px;
  margin:0;
  line-height: 1.2;
}


.auth-links {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
  margin: 0 8px;
  flex-wrap: wrap;
  position: absolute;
  right: 0;
}

.auth-links span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-links [hidden] {
  display: none;
}

.auth-links form {
  margin: 0;
}

.auth-links button {
  border: 1px solid #bbb;
  background: #fff;
  padding: 2px 6px;
  cursor: pointer;
}

a#authStatus{
  color: black;
  text-underline-offset:4px;
}

.page-auth {
  margin: 12px;
  line-height: 1.4;
}

.page-auth form {
  display: grid;
  gap: 8px;
  max-width: 320px;
}

.page-auth input {
  box-sizing: border-box;
  width: 100%;
  padding: 6px 8px;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.page-auth button {
  width: fit-content;
  padding: 4px 10px;
}

.auth-error {
  border: 1px solid #c66;
  background: #fff2f2;
  color: #900;
  padding: 8px;
  white-space: pre-wrap;
}

.auth-message {
  border: 1px solid #8ab;
  background: #f0f8ff;
  color: #135;
  padding: 8px;
  max-width: 320px;
}

.check-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.check-row input {
  width: auto;
}

input[type=radio]{
  margin: 0;
}

#uSafeSearch {
  cursor: pointer;
  font-weight: bold;
}

nav{
  line-height: 1.5;
  margin-left: 8px;
}



#labelSafeSearch{
  cursor: pointer;
  margin-left: 10px;
}

.top-links {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.main {
  display: grid;
  gap: 12px;
}

#imgContainer img{
  margin: 2px;
  cursor: pointer;
}

.summary-top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.thumb {
  max-width: 100%;
  height: auto;
  border: 1px solid #ccc;
}

.meta {
  display: grid;
  gap: 8px;
  min-width: 320px;
}

.row {
  display: grid;
  gap: 4px;
  align-items: start;
}

.page-summary .row {
  grid-template-columns: 80px 1fr;
}



.label {
  color: #666;
}

.concept-sections {
  display: grid;
  gap: 8px;
}

.concepts-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.concept-btn {
  border: 1px solid #bbb;
  padding: 4px 8px;
  cursor: pointer;
}

.concept-sections > .concepts-group:nth-child(odd) .concept-btn {
  background: #f8f4f4;
}

.concept-sections > .concepts-group:nth-child(even) .concept-btn {
  background: #f4f4f8;
}

.concept-key {
  color: #111;
}

.concept-weight {
  color: #888;
}

.related-wrap {
  display: grid;
  gap: 8px;
}

.related-status,
#saveStatus,
.note {
  color: #666;
  min-height: 1em;
}

.related-grid {
  display: flex;
  flex-wrap: wrap;
}



.related-thumb {
  border: 1px solid #ccc;
  cursor: pointer;
  vertical-align: bottom;
}

.dir-btn {
  border: 1px solid #bbb;
  background: #f7f7f7;
  padding: 3px 8px;
  cursor: pointer;
}



.to-top-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  border: 1px solid #bbb;
  background: #fff;
  padding: 8px 12px;
  cursor: pointer;
  display: none;
}



.concept-click-mode {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  color: #111;
}



.concept-click-mode label {
  font-weight: normal;
  color: #111;
  display: block;
}




.page-top #imgContainer img {
  vertical-align: top;
}

.page-detail .toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.page-detail .viewer {
  border: 1px solid #ddd;
  max-width: 100%;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
}

.page-detail canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: transparent;
}

.page-detail #promptBox {
  margin-top: 12px;
  border: 1px solid #ddd;
  padding: 10px;
  white-space: pre-wrap;
  line-height: 1.4;
  display: none;
  max-width: 1100px;
}

.page-editor .row {
  grid-template-columns: 160px 1fr;
}

@media (max-width: 768px) {
  h1 {
    font-size: 1.5rem;
  }
  .concept-sections {
    gap: 10px;
  }
  .concept-btn {
    font-size:15px;
  }
  .meta {
    min-width: 0;
  }

}
