:root {
  --bg: #ffffff;
  --text: #0b2447;
  --primary: #1976d2;
}

* {
  box-sizing: border-box
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  margin: 0;
}

.topbar {
  background: var(--primary);
  color: white;
  padding: 8px 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.topbar .container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  flex: 0 0 auto;
  font-size: 1.25rem;
  font-weight: 600;
}

.search-wrap {
  flex: 1 1 auto
}

.search-wrap form {
  display: flex;
  gap: 8px;
  width: 100%
}

.auth-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px
}

input,
textarea,
button {
  font: inherit
}

/* 表单元素 */
input[type="text"],
input[type="number"],
input[type="password"],
textarea {
  padding: 8px 10px;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

button {
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: transparent;
}

/* 按钮风格 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(16, 24, 40, 0.04);
  background: linear-gradient(180deg, #f4f9ff, #eaf4ff);
  color: var(--text);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.btn-primary {
  background: linear-gradient(180deg, var(--primary), #1565c0);
  color: #fff;
  border-color: rgba(0, 0, 0, 0.04);
  box-shadow: 0 6px 18px rgba(25, 118, 210, 0.12);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(25, 118, 210, 0.16);
}

.btn-ghost {
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* header search */
.topbar .container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar .brand {
  flex: 0 0 auto;
  font-size: 1.25rem;
  font-weight: 700;
}

.search-wrap {
  flex: 1 1 60%;
}

.search-wrap form {
  display: flex;
  gap: 8px;
}

.search-wrap input[type="text"],
.search-wrap input[type="search"] {
  flex: 1 1 auto;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #dcdfe6;
  font-size: 1rem;
}

.search-wrap button {
  padding: 10px 14px;
  border-radius: 10px;
}

.auth-wrap {
  flex: 0 0 auto;
  position: relative
}

.auth-toggle {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 8px
}

.auth-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--bg);
  border: 1px solid #eef2f7;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(11, 36, 71, 0.08);
  min-width: 140px;
  display: none;
  z-index: 60
}

.auth-menu .item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: black;
}

.auth-menu .item:hover {
  background: rgba(25, 118, 210, 0.04)
}

.auth-menu .divider {
  height: 1px;
  background: #eef2f7;
  margin: 6px 0
}

/* ensure dropdown icon aligns */
.auth-toggle img {
  width: 36px;
  height: 36px
}

/* Header adjustments: brand, search box, auth sizing */
.brand-link {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  font-size: 1.25rem;
  font-weight: 700;
}

.search-box {
  display: flex;
  align-items: center;
  flex: 1;
  border-radius: 10px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid #dcdfe6;
  gap: 8px;
}

.search-box .search-icon {
  width: 18px;
  height: 18px;
  opacity: .7
}

.search-input {
  border: 0;
  outline: none;
  flex: 1;
  background: transparent;
  font-size: 0.96rem;
  height: 32px;
  line-height: 32px;
}

.search-btn {
  padding: 6px 10px;
  height: 32px;
}

.auth-name {
  margin-left: 4px;
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  vertical-align: top;
  position: relative;
  top: 4px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 6px rgba(25, 118, 210, 0.08)
}

.btn-sm {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: .9rem
}

/* 主内容 */
main.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 16px
}

.rating-card,
.rating-item,
.rating-item>div {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(250, 250, 250, 0.95));
  border: 1px solid #eef2f7;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.rating-item {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.rating-item .meta {
  font-size: .85rem;
  color: #6b7a90;
  margin: 0;
  padding: 0;
  line-height: 1.0;
}

/* 模态 */
.modal {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center
}

.modal-content {
  background: var(--bg);
  padding: 16px;
  border-radius: 8px;
  width: 90%;
  max-width: 600px
}

.modal-content h3 {
  margin-top: 0
}

.modal-content label {
  display: block;
  margin: 8px 0
}

/* improved modal layout */
.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

.modal-body {
  margin-top: 8px;
  margin-bottom: 12px;
}

.form-row {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
}

.form-input {
  padding: 10px;
  border: 1px solid #e6eef8;
  border-radius: 8px;
  font-size: 0.98rem;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.form-success {
  color: #2e7d32;
  background: rgba(46, 125, 50, 0.06);
  padding: 8px;
  border-radius: 6px;
  margin-top: 8px;
}

/* 报告专用 textarea：左右撑满模态，仅允许垂直缩放 */
#reportReason.form-input,
.modal-content textarea.form-input {
  width: 100%;
  box-sizing: border-box;
  resize: vertical; /* 仅允许垂直缩放 */
  min-height: 120px;
}

/* 响应 */
@media (max-width:700px) {
  .topbar .container {
    padding: 10px
  }

  .brand {
    font-size: 1rem
  }

  .modal-content {
    width: 95%
  }
}

/* 深色模式覆盖 */
body.dark {
  --bg: #0e1724;
  --text: #e6eef8;
  --primary: #0b3d91;
}

body.dark .btn {
  background: linear-gradient(180deg, #0f2138, #0b2740);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.04)
}

body.dark .btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text)
}

/* suggestions */
.suggestion-item {
  padding: 6px;
  cursor: pointer;
  border-bottom: 1px solid #eef2f7
}

.suggestion-item:hover {
  background: rgba(25, 118, 210, 0.04)
}

.form-error {
  color: #c62828;
  margin-top: 6px;
  font-size: 0.95rem
}

/* 搜索结果美化：网格 + 卡片 */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.search-result-card {
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  border: 1px solid #e6eef8;
  padding: 12px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(11, 36, 71, 0.04);
  transition: transform .14s ease, box-shadow .14s ease;
}

.search-result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(11, 36, 71, 0.08);
}

.search-result-card .result-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.search-result-card .result-title a {
  color: inherit;
  text-decoration: none
}

.search-result-card .result-meta {
  font-size: 0.9rem;
  color: #6b7a90;
  display: flex;
  gap: 8px;
  align-items: center;
}

.badge {
  background: rgba(25, 118, 210, 0.12);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.loading {
  color: #6b7a90
}

/* small icon button */
.icon-btn img {
  vertical-align: middle
}

.icon-btn {
  padding: 6px 8px;
  border-radius: 8px;
  background: transparent;
  border: none;
}

/* star rendering */
.star-container {
  display: inline-flex;
  gap: 2px;
  align-items: center
}

/* my page single-line rating item */
.my-rating-item {
  padding: 10px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow .12s ease, transform .08s ease, background .12s ease;
}

.my-rating-item:hover {
  box-shadow: 0 8px 20px rgba(11, 36, 71, 0.06);
  transform: translateY(-2px);
  background: rgba(246, 250, 255, 0.7);
}

/* highlight style when navigated to */
.rating-item.highlight {
  box-shadow: 0 12px 28px rgba(25, 118, 210, 0.12);
  border-color: rgba(25, 118, 210, 0.3);
  background: linear-gradient(180deg, #fffdfb, #f7fbff);
}

.rating-card-title {
  font-weight: 600;
  margin-bottom: 6px
}

.rating-card-stars {
  margin-bottom: 6px
}

.rating-card-content {
  color: #243447
}

.star {
  position: relative;
  display: inline-block;
  width: 1em;
  height: 1em;
  line-height: 1em;
  font-size: 1.1rem
}

.star-empty {
  color: #ddd;
  display: inline-block
}

.star-fill {
  color: #ffb400;
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  overflow: hidden;
  display: inline-block
}

/* interactive star picker styles */
.interactive-star {
  cursor: pointer;
  user-select: none;
  display: inline-block;
}

/* write area textarea style: match rating list width and be slightly taller */
#writeRating textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px;
  border-radius: 8px;
  resize: vertical;
}