/*
  styles.css 是整个小网站的样式文件。

  它同时服务 index.html 和 draw.html：
  - index.html 使用：.home-page、.hero、.eyebrow、.hero-text、.nav-grid、.nav-card、.creator 等样式。
  - draw.html  使用：.app、.toolbar、.tool-group、.home-link、button、.canvas-wrap、canvas、.hint、.creator 等样式。

  CSS 的基本写法：
    选择器 {
      属性: 值;
    }

  例如：
    body {
      margin: 0;
    }
  意思是选中 <body> 元素，把它默认外边距设为 0。
*/

/*
  * 是通配选择器，表示选中页面上的所有元素。

  box-sizing: border-box 的作用：
  让元素的 width/height 包含 padding 和 border。

  初学者可以这样理解：
  如果一个盒子 width: 100px，padding: 10px，border: 1px；
  默认情况下实际宽度会超过 100px。
  设置 border-box 后，实际占用宽度仍然是 100px，布局更好算。
*/
* {
  box-sizing: border-box;
}

/*
  body 是整个网页的可见主体。
  这里设置全站默认字体、文字颜色和背景。
*/
body {
  /* 去掉浏览器默认的 8px 外边距，让页面可以从最边缘开始布局。 */
  margin: 0;

  /* min-height: 100vh 表示 body 至少和浏览器窗口一样高。
     vh 是 viewport height，100vh 就是视口高度的 100%。 */
  min-height: 100vh;

  /* 字体优先使用微软雅黑；如果没有，就用 Arial；再没有就用系统默认 sans-serif。 */
  font-family: "Microsoft YaHei", Arial, sans-serif;

  /* 全站默认文字颜色，深灰色比纯黑更柔和。 */
  color: #1f2937;

  /*
    linear-gradient 是线性渐变背景。
    135deg 表示渐变方向。
    #eef2ff 到 #f8fafc 从淡蓝紫渐变到浅灰白。
  */
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
}

/*
  .app 和 .home-page 是两个页面的主容器。

  .app：draw.html 的主容器。
  .home-page：index.html 的主容器。

  这里把它们共同的宽度、居中和上下内边距放在一起写，避免重复。
*/
.app,
.home-page {
  /*
    width: min(1180px, calc(100% - 32px));
    表示宽度取两个值中更小的：
    1. 1180px
    2. 浏览器宽度减 32px

    这样大屏幕上不会太宽，小屏幕上左右也会留 16px 空白。
  */
  width: min(1180px, calc(100% - 32px));

  /* margin: 0 auto; 经典水平居中写法。
     上下外边距为 0，左右自动分配。 */
  margin: 0 auto;

  /* 上下留 28px 空间，左右不留。 */
  padding: 28px 0;
}

/* 首页容器的额外布局。 */
.home-page {
  /* 使用弹性布局 flex。 */
  display: flex;

  /* 首页至少占满一屏高度。 */
  min-height: 100vh;

  /* flex-direction: column 表示子元素从上到下排列。 */
  flex-direction: column;

  /* justify-content: center 表示在主轴方向居中。
     因为主轴是纵向，所以内容会垂直居中。 */
  justify-content: center;
}

/* 首页顶部标题区。 */
.hero {
  margin-bottom: 28px;
  text-align: center;
}

/* Welcome 小字。 */
.eyebrow {
  margin: 0 0 8px;
  color: #2563eb;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* 首页 h1 标题。 */
.hero h1 {
  margin: 0;

  /*
    clamp(36px, 7vw, 72px) 表示响应式字号：
    最小 36px，理想值 7vw，最大 72px。
    vw 是视口宽度单位，屏幕越宽字号越大，但不会超过 72px。
  */
  font-size: clamp(36px, 7vw, 72px);
  line-height: 1.1;
}

/* 首页标题下的说明文字。 */
.hero-text {
  margin: 16px 0 0;
  color: #64748b;
  font-size: 18px;
}

/*
  导航卡片的网格容器。
  index.html 中 <nav class="nav-grid"> 使用它。
*/
.nav-grid {
  display: grid;

  /*
    repeat(auto-fit, minmax(240px, 1fr)) 是响应式网格：
    - 每一列最小 240px。
    - 如果空间足够，就自动排多列。
    - 1fr 表示平分剩余空间。
  */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));

  /* 卡片之间的间距。 */
  gap: 18px;
}

/* 首页导航卡片，也就是 <a class="nav-card">。 */
.nav-card {
  min-height: 150px;
  padding: 24px;
  border: 1px solid #dbe3ef;
  border-radius: 20px;
  color: #1f2937;

  /* 去掉 a 标签默认下划线。 */
  text-decoration: none;

  /* 半透明白色背景。 */
  background: rgba(255, 255, 255, 0.9);

  /* 阴影：x 偏移 0，y 偏移 18px，模糊 42px，颜色为半透明深蓝灰。 */
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);

  /*
    transition 定义动画过渡。
    当 transform、box-shadow、border-color 改变时，用 0.18 秒平滑变化。
  */
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

/* 鼠标悬停在导航卡片上时的效果。 */
.nav-card:hover {
  /* 向上移动 4px，产生“浮起来”的感觉。 */
  transform: translateY(-4px);
  border-color: #2563eb;
  box-shadow: 0 22px 50px rgba(37, 99, 235, 0.16);
}

/*
  strong 和 span 默认是行内元素。
  display: block 让它们各占一行，方便上下排列。
*/
.nav-card strong,
.nav-card span {
  display: block;
}

.nav-card strong {
  margin-bottom: 12px;
  font-size: 28px;
}

.nav-card span {
  color: #64748b;
  line-height: 1.7;
}

/* 禁用状态的导航卡片。 */
.nav-card.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 禁用卡片 hover 时不要上浮，也不要变蓝。 */
.nav-card.disabled:hover {
  transform: none;
  border-color: #dbe3ef;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
}

/*
  画板页面的工具栏。
  draw.html 中 <section class="toolbar"> 使用它。
*/
.toolbar {
  display: flex;

  /* flex-wrap: wrap 表示空间不够时自动换行。 */
  flex-wrap: wrap;

  /* 子元素垂直方向居中对齐。 */
  align-items: center;

  gap: 14px;
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

/* 工具栏里的小分组，比如“画笔颜色 + 颜色选择器”。 */
.tool-group {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}

/*
  属性选择器：input[type="color"] 只选中 type 为 color 的 input。
  也就是 draw.html 里的颜色选择器。
*/
input[type="color"] {
  width: 48px;
  height: 38px;
  padding: 2px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: white;
  cursor: pointer;
}

/* 画笔大小滑动条。 */
input[type="range"] {
  width: 160px;

  /* accent-color 可以改变滑块控件的主题色。 */
  accent-color: #2563eb;
}

/* 返回首页链接，让 a 标签看起来像按钮。 */
.home-link {
  border-radius: 10px;
  padding: 10px 16px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  background: #475569;
  transition: transform 0.15s ease, background 0.15s ease;
}

.home-link:hover {
  transform: translateY(-1px);
  background: #334155;
}

/*
  所有 button 的通用样式。
  draw.html 里的画笔、橡皮擦、直线、清空、保存按钮都会应用。
*/
button {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
  background: #e2e8f0;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  background: #cbd5e1;
}

/*
  当前被选中的工具按钮。
  script.js 中 setTool 函数会用 classList.toggle("active", 条件) 切换这个类。
*/
button.active {
  color: white;
  background: #2563eb;
}

/* id 选择器：只选中 id="clearBtn" 的按钮。 */
#clearBtn {
  color: white;
  background: #ef4444;
}

#clearBtn:hover {
  background: #dc2626;
}

/* 保存图片按钮。 */
#saveBtn {
  color: white;
  background: #16a34a;
}

#saveBtn:hover {
  background: #15803d;
}

/* 画布外层容器。 */
.canvas-wrap {
  /* overflow: hidden 配合 border-radius，让 canvas 也看起来有圆角。 */
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 18px;
  background: white;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
}

/*
  canvas 元素的显示样式。

  注意：这里的 width/height 是 CSS 显示尺寸，
  draw.html 中 canvas 标签上的 width="1000" height="620" 是内部绘图尺寸。
*/
canvas {
  /* canvas 默认是行内元素，可能产生底部空隙；改成 block 更适合做大画布。 */
  display: block;

  /* 显示宽度占满父容器。 */
  width: 100%;

  /*
    高度取 min(620px, 68vh)：
    - 最大不超过 620px；
    - 小屏幕时不超过视口高度的 68%。
  */
  height: min(620px, 68vh);

  /* 鼠标放到画布上显示十字光标，像绘图软件。 */
  cursor: crosshair;

  /*
    touch-action: none 阻止触摸设备上的默认滚动/缩放手势干扰画画。
    配合 pointer 事件可以更好支持鼠标、触控笔、手指。
  */
  touch-action: none;
}

/* 画板下方提示文字。 */
.hint {
  margin: 14px 4px 0;
  color: #64748b;
  font-size: 14px;
}

/* 足球展示页面的主体容器。 */
.football-page {
  display: block;
}

/* 足球页面顶部标题区域。 */
.football-hero {
  margin-bottom: 22px;
  text-align: center;
}

.football-hero h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 58px);
  line-height: 1.1;
}

/* 足球比赛汇总说明。 */
.football-summary {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  color: #1d4ed8;
  background: #eff6ff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

/* 足球数据卡片网格。 */
.football-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.football-card {
  padding: 20px;
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.football-card-subtitle {
    min-height: 38px;
    margin: 0 0 8px;
    color: #2563eb;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
  }

.football-card h2 {
  margin: 0 0 12px;
  color: #1f2937;
  font-size: 22px;
}

.football-score {
  margin: 0 0 12px;
  color: #16a34a;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.football-card-time {
  margin: 0 0 12px;
  color: #64748b;
  font-weight: 700;
}

.football-card p {
  line-height: 1.7;
}

/* 留言反馈页面的主体容器。 */
.feedback-page {
  display: block;
}

/* 留言页面顶部标题区域。 */
.feedback-hero {
  margin-bottom: 22px;
  text-align: center;
}

.feedback-hero h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 58px);
  line-height: 1.1;
}

/* 留言反馈表单。 */
.feedback-form {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.form-group {
  display: grid;
  gap: 8px;
}

.form-group label {
  font-weight: 700;
}

.required-mark {
  color: #ef4444;
}

.form-group input,
.form-group textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px 14px;
  color: #1f2937;
  font: inherit;
  background: white;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.form-group textarea {
  min-height: 150px;
  resize: vertical;
}

.feedback-note {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.7;
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

#submitFeedbackBtn {
  color: white;
  background: #2563eb;
}

#submitFeedbackBtn:hover {
  background: #1d4ed8;
}

#submitFeedbackBtn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

#resetFeedbackBtn {
  background: #e2e8f0;
}

.feedback-status {
  margin: 14px 0 0;
  padding: 14px 16px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  color: #475569;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.feedback-status.loading {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.feedback-status.success {
  color: #15803d;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.feedback-status.error {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

/* 网站后台页面。 */
.admin-page {
  display: block;
}

.hidden {
  display: none !important;
}

.admin-login-card,
.admin-panel {
  margin-bottom: 18px;
}

.admin-login-card h2 {
  margin: 0 0 14px;
  font-size: 24px;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-actions button.active {
  color: white;
  background: #2563eb;
}

.admin-feedback-list {
  display: grid;
  gap: 16px;
}

.admin-feedback-card {
  padding: 18px;
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.admin-feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.admin-feedback-meta {
  margin: 8px 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.7;
}

.admin-feedback-message {
  margin: 12px 0;
  line-height: 1.8;
  white-space: pre-wrap;
}

.badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.badge-unread {
  color: #92400e;
  background: #fef3c7;
}

.badge-read {
  color: #15803d;
  background: #dcfce7;
}

.danger-button {
  color: white;
  background: #ef4444;
}

.danger-button:hover {
  background: #dc2626;
}

.feedback-empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  color: #64748b;
  background: rgba(255, 255, 255, 0.72);
}

/* 页脚作者信息。 */
.creator {
  margin-top: 18px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  letter-spacing: 0.3px;
}

/* 作者名字的彩虹渐变文字。 */
.creator span {
  font-weight: 800;

  /* 文字背景设置为彩虹渐变。 */
  background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e, #06b6d4, #6366f1, #ec4899, #ef4444);

  /* 背景宽度放大，动画移动时才会有流动效果。 */
  background-size: 300% 100%;

  /*
    background-clip: text 表示只在文字区域显示背景。
    -webkit- 前缀是为了兼容部分浏览器。
  */
  background-clip: text;
  -webkit-background-clip: text;

  /* 把文字本身变透明，这样才能看到文字背后的渐变背景。 */
  color: transparent;
  -webkit-text-fill-color: transparent;

  /* 使用下面定义的 rainbowText 动画，3秒循环一次，线性匀速。 */
  animation: rainbowText 3s linear infinite;
}

/*
  @keyframes 定义动画过程。
  rainbowText 会改变 background-position，让渐变背景移动，产生彩虹流动效果。
*/
@keyframes rainbowText {
  from {
    background-position: 0% 50%;
  }

  to {
    background-position: 300% 50%;
  }
}

/*
  媒体查询：当屏幕宽度小于等于 720px 时应用。
  主要用于手机端适配。
*/
@media (max-width: 720px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding: 14px 0;
  }

  .toolbar,
  .tool-group {
    align-items: stretch;
  }

  /* 手机上工具栏改成纵向排列。 */
  .toolbar {
    flex-direction: column;
  }

  /* 手机上每个工具组、按钮、滑块都占满宽度，方便点击。 */
  .tool-group,
  button,
  input[type="range"] {
    width: 100%;
  }

  /* 手机上反馈表单按钮纵向排列。 */
  .feedback-actions,
  .admin-actions,
  .admin-toolbar,
  .admin-feedback-header {
    flex-direction: column;
    align-items: stretch;
  }

  /* 手机上足球卡片改成单列展示。 */
  .football-grid {
    grid-template-columns: 1fr;
  }
}
